[Lazarus] Multiple versions of MySQL/MariaDB

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Multiple versions of MySQL/MariaDB

Koenraad Lelong-2
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.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multiple versions of MySQL/MariaDB

leledumbo
Administrator
> 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.
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multiple versions of MySQL/MariaDB

Michael Van Canneyt
In reply to this post by Koenraad Lelong-2


On Fri, 28 Aug 2015, Koenraad Lelong wrote:

> 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.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus