summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2009-12-03 17:26:54 +0200
committerMichael Widenius <monty@askmonty.org>2009-12-03 17:26:54 +0200
commit9aafd0dae2e9302b7af877f1670b5dc7360a7daf (patch)
tree8c35e04b4789e7739ff18260490c6dbff0947388 /sql-common
parent626dd5e81a87f2eefecc49f7a140708062d7fde4 (diff)
downloadmariadb-git-9aafd0dae2e9302b7af877f1670b5dc7360a7daf.tar.gz
Ensure that mysql_get_server_version() also works if there is a non numerical prefix before the version number
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 9a8444a84e9..56d4cf04044 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -3208,7 +3208,7 @@ const char * STDCALL mysql_error(MYSQL *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);