DBD-mysql icon indicating copy to clipboard operation
DBD-mysql copied to clipboard

mysql.so is compiled with a specific MySQL flavor and version

Open atoomic opened this issue 7 years ago • 9 comments

Multiple places are checking MYSQL_VERSION_ID or MARIADB_BASE_VERSION to provide different implementations of a function.

So it appears that once you have compiled your DBD::mysql driver against a specific version then you might have "surprises" using the driver to connect to an older/newer server.

We were under the assumption that we could use DBD::mysql to connect to multiple version of servers.

This, for example, is one of the changes made to shutdown db47688a4465f3cc4c2f1daf4aeb12ec259b0c73 which was introduced in MySQL 5.7.9

When mysql.so is compiled with a 5.7.9 version once used with a 5.6 server.... it will raise an error.

The shutdown function does not appear to be the only one affected by this.

atoomic avatar Mar 26 '18 19:03 atoomic

See #56 for an example of where this change went in.

toddr avatar Mar 26 '18 19:03 toddr

I discovered this while using the func function with a MySQL 5.6 server whereas the driver was compiled with the mariadb-connector from https://downloads.mariadb.org/connector-c/3.0.3/

$dbh->func( 'shutdown', 'admin' );

which raises this exception from the server

The system received an error from the “MySQL” database “mysql”: ER_PARSE_ERROR (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SHUTDOWN' at line 1)

atoomic avatar Mar 26 '18 19:03 atoomic

Hi! Some of those problems are or would be fixed in DBD::MariaDB. If you have a full testable reproducer against DBD::MariaDB, please fill a issue to https://github.com/gooddata/DBD-MariaDB project and we will look at it.

pali avatar Mar 26 '18 19:03 pali

Can you tell me if this client is compatible to connect to mysql and mariadb servers 4.x and above?

toddr avatar Mar 26 '18 19:03 toddr

DBD::MariaDB is still under development, please read https://www.nntp.perl.org/group/perl.dbi.users/2018/01/msg37584.html and https://www.nntp.perl.org/group/perl.dbi.users/2018/01/msg37586.html Travis tests for MySQL 4.1 passes; new MariaDB 10.2 and 10.3 too.

pali avatar Mar 26 '18 19:03 pali

Reviewing the code changes in https://github.com/gooddata/DBD-MariaDB, the issue was fixed by removing func as a valid feature of the driver. Possibly the same disclaimer should be added to the DBD::mysql client that it only works with servers of the same type? Either that or remove support for the func method call.

toddr avatar Mar 26 '18 20:03 toddr

indeed looks like DBD::MariaDB simply removed support for that internal 'admin' helper, which solved the issue lol view: https://github.com/gooddata/DBD-MariaDB/commit/1ece8cd071c87d875c17a98bdb4c0fcb1f235a12

atoomic avatar Mar 26 '18 20:03 atoomic

thanks @pali for all this work, looking forward to use DBD::MariaDB in the future

atoomic avatar Mar 26 '18 20:03 atoomic

Yes, admin method was removed because it was deprecated (see commit e35a6284602900c4085d1f82d34756977684defb) and replaced by calling SQL statements. I'm cleaning up old and deprecated code. But as I said, if you have reproducer for some bug (or missing feature), please fill an issue and we will look at it.

pali avatar Mar 26 '18 20:03 pali

The matrix of supported client libraries has been reduced in master, which should fix this issue as well.

dveeden avatar Aug 23 '23 15:08 dveeden