← Back to team overview

maria-developers team mailing list archive

bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2777)

 

#At lp:maria based on revid:monty@xxxxxxxxxxxx-20091203120237-g7oekcuv6emhor1z

 2777 Michael Widenius	2009-12-03
      Ensure that mysql_get_server_version() also works if there is a non numerical prefix before the version number
      modified:
        sql-common/client.c

=== modified file 'sql-common/client.c'
--- a/sql-common/client.c	2009-12-03 11:19:05 +0000
+++ b/sql-common/client.c	2009-12-03 15:26:54 +0000
@@ -3208,7 +3208,7 @@ const char * STDCALL mysql_error(MYSQL *
     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 @@ ulong STDCALL
 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);




Follow ups