← Back to team overview

maria-developers team mailing list archive

[Branch ~maria-captains/maria/5.1] Rev 2777: Ensure that mysql_get_server_version() also works if there is a non numerical prefix before the v...

 

------------------------------------------------------------
revno: 2777
committer: Michael Widenius <monty@xxxxxxxxxxxx>
branch nick: maria-5.1
timestamp: Thu 2009-12-03 17:26:54 +0200
message:
  Ensure that mysql_get_server_version() also works if there is a non numerical prefix before the version number
modified:
  sql-common/client.c


--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1

Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
=== modified file 'sql-common/client.c'
--- sql-common/client.c	2009-12-03 11:19:05 +0000
+++ sql-common/client.c	2009-12-03 15:26:54 +0000
@@ -3208,7 +3208,7 @@
     mysql		Connection
 
   EXAMPLE
-    4.1.0-alfa ->  40100
+    MariaDB-4.1.0-alfa ->  40100
   
   NOTES
     We will ensure that a newer server always has a bigger number.
@@ -3221,7 +3221,11 @@
 mysql_get_server_version(MYSQL *mysql)
 {
   uint major, minor, version;
-  char *pos= mysql->server_version, *end_pos;
+  const char *pos= mysql->server_version;
+  char *end_pos;
+  /* Skip possible prefix */
+  while (*pos && !my_isdigit(&my_charset_latin1, *pos))
+    pos++;
   major=   (uint) strtoul(pos, &end_pos, 10);	pos=end_pos+1;
   minor=   (uint) strtoul(pos, &end_pos, 10);	pos=end_pos+1;
   version= (uint) strtoul(pos, &end_pos, 10);