[Lazarus] MySQL 5.1

Joost van der Sluis joost at cnoc.nl
Sun Sep 19 12:58:34 CEST 2010


On Sat, 2010-09-18 at 13:36 -0500, Andrew Brunner wrote:
> Hi Michael,
> 
> I have a wrapper API for SQL Database access.  I support MySQL by way
> of TMySQL50Connection.  Since my system has the client and server at
> 5.1 and I can hard-code this new component so I don't throw the
> exception...
> 
> Will an exception be thrown for all users who try to use client/server
> 5.0 when the actual component is assigned as TMySQL51Connection?  Is
> TMySQL51Connection backwards compatible to 5.0?

No. That's not possible, because Mysql 5.1 isn't backwards compatible.
That's what Ik tried to explain, and the reason you should stay away
form MySQL. For 'normax' Linux distributions, this is not a problem,
because they recompile everything that depends on MySQL if a new MySQL
version becomes available (using the c-header file). So, you have to do
that too.

A MySQL program has to be compiled for exactly the same version of the
MySQL client-lib. It's sad but true.
Or you have to build a detection-mechanism for the client-lib-version
(config-file), and use the appropriate TMySQLConnection. 

(If you want to know more about the reason for this: it is very well
possible that a 'varchar' field has an internal number of 5, and a
'integer' field a internal number of 6 in one version of the
MySQL-client-lib. While those numbers are reversed in another version.
So without knowing the exact client-version-number, you can not know
what kind of field a field with internal number 6 is.)

> I'm hoping I don't need to expand my Database API to handle the many
> flavors of MySQL.

You have. It's simple though, you only need another TSQLConnection. 

Joost





More information about the Lazarus mailing list