View Issue Details

IDProjectCategoryView StatusLast Update
0026620FPCDatabasepublic2014-09-09 10:28
ReporterVitaly YakuninAssigned ToBigChimp 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformAllOSopenSuSEOS VersionFactory
Product VersionProduct Build45807 
Target Version3.0.0Fixed in Version3.0.0 
Summary0026620: Error after upgrade MariaDB
DescriptionAfter the upgrade, I began to see the error:
"TMySQL56Connection can not work with the installed MySQL client version: Expected (5.6), got (10.0.12-MariaDB)"
TagsNo tags attached.
Fixed in Revision28593
FPCOldBugId
FPCTarget
Attached Files
  • maria.diff (1,091 bytes)
    Index: packages/fcl-db/src/sqldb/mysql/mysqlconn.inc
    ===================================================================
    --- packages/fcl-db/src/sqldb/mysql/mysqlconn.inc	(revision 28586)
    +++ packages/fcl-db/src/sqldb/mysql/mysqlconn.inc	(working copy)
    @@ -37,6 +37,12 @@
     {$ENDIF}
     
     Const
    +{$IFDEF mysql56}
    +  // MariaDB 10.0 is compatible with MySQL 5.6
    +  // MariaDB 5.1..5.5 presumably report the same version number
    +  // as MySQL
    +  MariaDBVersion = '10.0'
    +{$ENDIF}
       MySQLVersion =
     {$IFDEF mysql56}
         '5.6';
    @@ -464,8 +470,13 @@
     begin
       InitialiseMysql;
       Fullversion:=strpas(mysql_get_client_info());
    -  ClientVerStr := copy(FullVersion,1,3);
    -  If (ClientVerStr<>MySQLVersion) then
    +  ClientVerStr := copy(FullVersion,1,4);
    +  // Compare first 4 characters of version string
    +  If (ClientVerStr<>copy(MySQLVersion+'    ',1,4)) 
    +{$IFDEF mysql56}
    +    or (ClientVerStr<>copy(MariaDBVersion+'    ',1,4))
    +{$ENDIF}
    +    then
         Raise EInOutError.CreateFmt(SErrVersionMisMatch,[ClassName,MySQLVersion,FullVersion]);
       inherited DoInternalConnect;
       ConnectToServer;
    
    maria.diff (1,091 bytes)

Activities

Reinier Olislagers

2014-08-23 13:11

developer   ~0076679

After what upgrade?
1. From what version of
2. what product?
3. To what version of Mariadb?

If the upgrade was from MySQL, apparently MariaDB is not a drop in replacement. If so, a patch would be appreciated...

Thanks.

LacaK

2014-08-23 19:36

developer   ~0076688

As stated here: https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/
- All client APIs, protocols and structs are identical.
- The shared client library is binary compatible with MySQL's client library.
for same versions 5.1, 5.5, 5.6 of MySQL and MariaDB.

And it seems, that MariaDB 10.0 corresponds to MySQL 5.6
So simplest fix would be make 10.0 as "alias" to 5.6

Of course later if MariaDB will abandon binary compatibility at client API level then it will be worse.

Vitaly Yakunin

2014-08-25 09:02

reporter   ~0076706

I updated the OS. In the new openSuSE Factory has an upgraded 10.0 MariaDB

Reinier Olislagers

2014-09-03 15:35

developer   ~0076872

Thank you for your answer to question 3. Could you please answer questions 1 and 2 as well?

@LacaK: apparently the shared lib is not API compatible as it doesn't report the same version number but apart from that, yes, I agree with your fix.

Reinier Olislagers

2014-09-03 15:58

developer   ~0076873

@LacaK, Vitaly Yakunin: what about the attached patch? Haven't tested it here though...

Reinier Olislagers

2014-09-03 15:58

developer  

maria.diff (1,091 bytes)
Index: packages/fcl-db/src/sqldb/mysql/mysqlconn.inc
===================================================================
--- packages/fcl-db/src/sqldb/mysql/mysqlconn.inc	(revision 28586)
+++ packages/fcl-db/src/sqldb/mysql/mysqlconn.inc	(working copy)
@@ -37,6 +37,12 @@
 {$ENDIF}
 
 Const
+{$IFDEF mysql56}
+  // MariaDB 10.0 is compatible with MySQL 5.6
+  // MariaDB 5.1..5.5 presumably report the same version number
+  // as MySQL
+  MariaDBVersion = '10.0'
+{$ENDIF}
   MySQLVersion =
 {$IFDEF mysql56}
     '5.6';
@@ -464,8 +470,13 @@
 begin
   InitialiseMysql;
   Fullversion:=strpas(mysql_get_client_info());
-  ClientVerStr := copy(FullVersion,1,3);
-  If (ClientVerStr<>MySQLVersion) then
+  ClientVerStr := copy(FullVersion,1,4);
+  // Compare first 4 characters of version string
+  If (ClientVerStr<>copy(MySQLVersion+'    ',1,4)) 
+{$IFDEF mysql56}
+    or (ClientVerStr<>copy(MariaDBVersion+'    ',1,4))
+{$ENDIF}
+    then
     Raise EInOutError.CreateFmt(SErrVersionMisMatch,[ClassName,MySQLVersion,FullVersion]);
   inherited DoInternalConnect;
   ConnectToServer;
maria.diff (1,091 bytes)

LacaK

2014-09-03 21:05

developer   ~0076880

Yes I have in mind something like this.
I would do it bit different something like:
  if (pos(MySQLVersion, ClientVerStr) <> 1) and
     (pos(MariaDBVersion, ClientVerStr) <> 1) then raise ...

and put:
+ // MariaDB 10.0 is compatible with MySQL 5.6
+ // MariaDB 5.1..5.5 presumably report the same version number
+ // as MySQL
+ MariaDBVersion =
+{$IFDEF mysql56}
+ '10.0';
+{$ELSE}
+ MySQLVersion;
+{$ENDIF}


after const MySQLVersion =
(so MariaDBVersion constant will be always defined)

Vitaly Yakunin

2014-09-04 06:50

reporter   ~0076886

1. 5.5.33
2. fpc 2.7.1

Reinier Olislagers

2014-09-04 12:19

developer   ~0076890

@Vitaly Yakunin: thanks to Lacak's advice in 76880); committed in r28593 Please test and close if ok or reopen if not. I cannot test myself (don't have mariadb installed).
@Vitaly Yakunin: thanks. Assuming you mean mariadb 5.5.33..

Issue History

Date Modified Username Field Change
2014-08-21 05:52 Vitaly Yakunin New Issue
2014-08-22 01:04 Maxim Ganetsky Project Lazarus => FPC
2014-08-23 13:11 Reinier Olislagers Note Added: 0076679
2014-08-23 13:11 Reinier Olislagers Status new => feedback
2014-08-23 19:36 LacaK Note Added: 0076688
2014-08-25 09:02 Vitaly Yakunin Note Added: 0076706
2014-08-25 09:02 Vitaly Yakunin Status feedback => new
2014-09-03 15:35 Reinier Olislagers Note Added: 0076872
2014-09-03 15:35 Reinier Olislagers Status new => feedback
2014-09-03 15:58 Reinier Olislagers Note Added: 0076873
2014-09-03 15:58 Reinier Olislagers File Added: maria.diff
2014-09-03 21:05 LacaK Note Added: 0076880
2014-09-04 06:50 Vitaly Yakunin Note Added: 0076886
2014-09-04 06:50 Vitaly Yakunin Status feedback => new
2014-09-04 11:58 Reinier Olislagers Assigned To => Reinier Olislagers
2014-09-04 11:58 Reinier Olislagers Status new => assigned
2014-09-04 12:19 Reinier Olislagers Fixed in Revision => 28593
2014-09-04 12:19 Reinier Olislagers Note Added: 0076890
2014-09-04 12:19 Reinier Olislagers Status assigned => resolved
2014-09-04 12:19 Reinier Olislagers Fixed in Version => 2.7.1
2014-09-04 12:19 Reinier Olislagers Resolution open => fixed
2014-09-04 12:19 Reinier Olislagers Target Version => 2.8.0
2014-09-09 10:28 Vitaly Yakunin Status resolved => closed