Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-08

Multiple versions of MySQL/MariaDB

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Koenraad Lelong

Hi,

What defines the TMySQL-connection-version ? Are those the installed libraries on the client ? Or is it the server ?

Is it possible to detect which version of MySQL/MariaDB is used , and according to the result select the right connection, at run-time ?

The problem is that my development-PC does not neccessarily have the same libraties as the user-PC.

FWIW, I'm running linux on the development-PC.

Regards,

Koenraad.

Reply by email

leledumbo
to Koenraad Lelong
Is it possible to detect which version of MySQL/MariaDB is used , and according to the result select the right connection, at run-time ?

Trial and error:
Loop over the connection component until you find one that doesn't raise exception when activated. Simple, but takes more resource.

Querying the tool:
Executes `mysql --version` and parse the result. Apparently the output is consistent enough between versions, it's always the fifth column. More complicated logic, but lower resource usage.

Let the user decide:
Provide a config file and let user fill it. Just connect anyway to whatever value supplied by user, certainly you can limit to certain accepted values only. This lifts the responsibility to user to supply the correct version.

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Multiple-versions-of-MySQL-MariaDB-tp4043756p4043757.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Michael Van Canneyt
to Koenraad Lelong: What defines the TMySQL-connection-version ? Are those the installed libraries on the…
Koenraad Lelong wrote 7 lines
Hi, What defines the TMySQL-connection-version ? Are those the installed libraries on the client ? Or is it the server ? Is it possible to detect which version of MySQL/MariaDB is used , and according to the result select the right connection, at run-time ?

Load the mysql library manually and check the version returned by

function mysql_get_client_version:culong;

By far the easiest, I would imagine ?

Michael.

Reply by email