[Lazarus] Lazarus & MySQL 5.1

Joost van der Sluis joost at cnoc.nl
Wed Mar 3 15:52:38 CET 2010


On Tue, 2010-03-02 at 20:11 +0100, Marco van de Voort wrote:
> On Tue, Mar 02, 2010 at 02:59:12PM +0000, Henry Vermaak wrote:
> > > seems to have fallen from the air, connecting to nothing ?
> > 
> > I presume it comes from here (in mysql.inc):
> > 
> >   const
> >     mysqllib = 'libmysqlclient.'+sharedsuffix;
> >   {$IF DEFINED(mysql50)}
> >     mysqlvlib = mysqllib+'.15';
> >   {$ELSEIF DEFINED(mysql41)}
> >     mysqlvlib = mysqllib+'.14';
> >   {$ELSE}
> >     mysqlvlib = mysqllib+'.12';
> >   {$ENDIF}
> > 
> > This probably doesn't cover all the cases.  Assuming that a specific
> > client library can only talk to a specific server may also be wrong.
> > Debian testing also has libmysqlclient 16 and mysql-server 5.1.
> 
> mysql version is a disaster (and one of the reasons why I avoid mysql when I
> can). IMHO FPC should never hardcode the number in the first place, but
> should link to mysqlclient.so (using the symlink, the unix way).

That's impossible for MySQL.

Because, for example, an 'integer' field in version .13 can have the id
1, but for version .14 the id 1 can be used for a 'varchar'.

There is no way to know what the field-type of a column is, if you don't
take the MySQL version into account.

To avoid these kind of problems most distributions come with more
version of the mysql-client libraries, which they call .15, .16 etc. So
fpc first tries to find the right client-version (using the .15 suffix)
and then the general one. 

Why MySQL 5.1. doesn't works is because as an extra check it checks if
the version number is the number it expects. That check doesn't search
for mysql 5.1 for older versions of fpc. (including 2.4.0)

> Anyway, long story short, FPC has a provision for such mistakes, -XLA
> 
> Try passing -XLAlibmysqlclient.so.15=libsqlclient.so.16 and pray.

Doesn't work. The version check will fail.

Bottom-line: don't use MySQL. And do not upgrade your MySQL-client
library version.

Joost.






More information about the Lazarus mailing list