Sign in Join

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

Mailing lists / lazarus / 2003-05

Lazarus with Mysql again

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Michael Van Canneyt
to Tony Maro: I'll second that... I originally was going to write CBT to support MySQL and junked the…
Tony Maro wrote 9 lines
Rafael A. wrote: >Does anybody here know where I can find a good tutorial where I can learn >about Lazarus (Free Pascal) with Mysql??? > > I'll second that... I originally was going to write CBT to support MySQL and junked the idea when I never could figure out how to use the MySQL units.

I am amazed at the amount of trouble people seem to have with this subject. Currently, the DB situation of FPC is as follows:

- Low level access (i.e. straight API header translation) to MySQL (3.23 and 4.0)
Oracle
Interbase/Firebird
PostgreSQL
ODBC (Linux and Windows)

The units for this can be found in packages/base in the FPC source tree, test programs are provided, I've tested all of them myself.

- Then there are TDataset descendent implementations in the FCL for MySQL
Interbase
DBase
Flat-file
They all work definitely read-only, but could use more testing.

In the FCL, there is also a simple OOP wrapper around the ODBC layer.

Now, since these implementations depend on the low-level access units, it is wise to take the low-level test programs and see whether that works. (Independent of Lazarus, don't use any GUI) Only then you should start using the TDataset implementation.

The case for (or against) MYSQL is a bit tricky: Unfortunately the MySQL people change their API in incompatible ways from one version to the next. They can mask this for C application programmers with some macro magic, but that does not work for Pascal, obviously.

It is therefore IMPERATIVE that the version reported by
- Client library
- MySQL Server
- the 'mysql_version' unit
match EXACTLY. That means: 3.23 3.22 !

Failure to meet this requirement will result in inexplicable crashes, stack corruptions etc.

It is for this reason that for any serious database development in FPC/Lazarus, I currently recommend against using MySQL. If you absolutely must connect to MySQL, try the ODBC driver, it should hide all the API horrors.

If you don't like this idea (I wouldn't use ODBC myself), and you're not tied to MySQL, try using Interbase.
Its free counterpart Firebird (http://www.firebirdsql.org) is very stable, and offers MUCH more functionality as MySQL. And: it is supported by FPC.

I use it myself, in commercial projects for huge databases, so rest convinced that it works OK.

Michael.

Rafael A.

Does anybody here know where I can find a good tutorial where I can learn about Lazarus (Free Pascal) with Mysql???

Tnx
Rafael A.

_________________________________________________________ Voce quer um iGMail protegido contra v�rus e spams? Clique aqui: http://www.igmailseguro.ig.com.br