gnue-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUe-dev] Schema Creation for dbdrivers implemented


From: Johannes Vetter
Subject: [GNUe-dev] Schema Creation for dbdrivers implemented
Date: Wed, 23 Jun 2004 15:51:50 +0200

Hello,

In the last days I've implemented the first version of a Schema Creation
Framework for our DB-Drivers. Currently there are full-featured
implementations for PostgreSQL and Interbase/Firebird available. The
MySQL-driver lacks the support of the createDatabase () function but is
usable in most cases.

The basic concept is still as suggested in the proposal I've sent to
this list about two weeks ago. In a few words a schema-creator provides
a few functions like 'createTable', 'modifyTable', 'createConstraint',
and so on which take a definition-dictionary as argument. These
functions then process their definitions and perform the task.
Additionally the return code-sequences reflecting the work the had done.

Besides this the 'drivers/Base/Connection' provides a function called
'updateSchema' which gets a list of 'tableDefinition'-dictionaries (used
be the functions mentioned above). updateSchema uses the connection's
introspector to get rid of elements in the defintion which already
exists and it uses it's schemaCreator to create the missing elements.
After this function is done and no exception has been raised, one could
be sure to have a database schema as described in the given definition.

How to create a new driver-implementation:
To create a new schema creation implementation for a given driver you
have to decide wether it's a DBSIG2-driver or not. In the latter case
you would derive from "drivers/Base/Schema/Creation", otherwise one
would derive from "drivers/DBSIG2/Schema/Creation" which has really a
lot of things already done for you. Usually one would have to implement
the type-conversions (like what datatype is used for type x ...), and a
handler for serial-fields or timestamp-serials.

Please have a look at the postgres and interbase implementation to get
an idea of how it works.

What's about gnue-schema?

Well, gnue-schema has changed it's interface a little bit. Instead of
just creating SQL-code which you would then fire against your database,
gnue-schema can do all this for you. If you're using a PostgreSQL, 
Interbase or Firebird database backend gnue-schema is also able to
create the database for you. You can provide a connection name to
gnue-schema and it uses this connection's schema-creator to create all
tables as described. But that's not all. If the gsd file contains
table-data sections, all these data rows are updated/inserted
automatically into the same connection. Of course one could choose among
the operations (schema, data or both). Additionally gnue-schema can log
the code executed to a filename given to the command-line (--output).



Well, that's all for now ... :)


After all, have a lot of fun


Best regards,

Johannes







-- 
BYTEWISE Software GmbH          Tel +43 (5577) 89877-0
i.A. Johannes Vetter            Fax +43 (5577) 89877-66
A-6890 Lustenau, Enga 2         http://www.bytewise.at
-------------------------------------------------------
Wir bieten die Installation von Debian GNU/Linux auf
Servern für kleinere Netzwerke zum Pauschalpreis an.
Mehr dazu unter http://www.bytewise.at/texte/pl-debian

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]