[Gambas-devel] The database component

Benoît Minisini gambas at ...1...
Sun Jan 26 21:26:28 CET 2003


THE DATABASE COMPONENT

The aim is to provide a common interface to the many databases that exist all 
around the world, so that the same Gambas code works, whatever the database 
is.

For the beginning, we must limit our ambition. So I propose to deal with MySQL 
and PostgreQSL only.

I propose the following architecture :

- A common database component, named "gb.db", that will be the interface used 
by Gambas programs.

- One database driver component for each database type, that will access the 
corresponding database using the C libraries they provide. These driver 
components will be named "gb.db.mysql", "gb.db.postgresql", etc.

The common database component will load the driver components at demand, so 
that you don't need to include them in your project.


THE COMMON COMPONENT

I want the common component to have the following possibilities :
- Connect to a database.
- Disconnect from a database.
- Send SQL instructions and get the result.
- Getting and modifying the structure of the database.
- Managing transactions.

I will publish a more detailed proposal about this component interface in a 
next mail.


WRITING DRIVERS

I have one book at home that explain how to access PostgreSQL, but I have no 
knowledge of MySQL or other databases.

Fortunately, the Qt sources contain C++ classes used for accessing databases, 
and we can use them to implement our own drivers. They are located in the 
following directory of the Qt source package : ./src/sql/drivers. Reading 
them is very instructive.


PROBLEMS WITH SQL

Retrieving data is something very standard in SQL, but, alas, managing the 
structure of the database is very database-dependent. :-(

So I think the more difficult task in writing the database component will be 
the functions to manage the database structure.


WHAT TO DO NOW ?

I invite everybody to read the gb.example component source.

I invite everybody to read the man page of the diff command. As I don't want 
to set a CVS repository up, you will send me code with the diff command if 
necessary.

For the drivers, the simpler would be to have a maintainer to each one. I can 
do the PostgreSQL driver with my book, bu not the MySql one.

I will make void components in the next version of Gambas so that you will 
easily add code without dealing with the automake stuff.

For the "gb.db" common component, I will give details in the next mail, maybe 
next week with the few time I have.


Best regards,

-- 
Benoît Minisini
mailto:gambas at ...1...






More information about the Devel mailing list