The mysql unit.

Free Pascal interface to MySQL

Overview

You can use Free Pascal to access a MySQL database server from Linux. (for more info on MySQL, see their home page.)

Interfacing is very easy, all you need to do is compile some units, and use these units in your program. You need to specify the place of the MySQL client Library (libmysqlclient when compiling, and that is it. the provided units take care of the rest.

Provided units and programs

The packages provides 3 units, of which normally only the first is needed: The same units exist for versions 3.22 and 4.00 of mysql as well, in subdirecties. The default supported version is version 3.23.

The test program is called testdb.

Installation

The mysql interface is distributed with the Free Pascal packages, and come with the compiler distribution: Normally no action should be taken to work with MySQL.

In case you want to modify and compile the units yourself, the mysql sources are in the packages directory:

packages/base/mysql
This directory contains the units, a test program and a makefile. cd to the directory and type
make
This should compile the units. If compilation was succesful, you can install with
make install
You can then test the program by running
make test
This will: You will see a lot of messages on your screen, giving you feedback and results. If something went wrong, make will inform you of this.

Future plans

The interface to mysql is a pure translation of the mysql C header files. This means that the used functions are rather un-pascalish. It would be great to have an OOP interface for it, A la Delphi. This interface is being worked on.

Finally

If you have found a bug, or if you have made some functions to interface these units in a more pascal-like fashion, feel free to contact me at michael.vancanneyt@freepascal.org


Back to packages