[gnome-db] Database Objects
- From: Cleber Rodrigues Rosa Junior <cleberrrjr bol com br>
- To: gnome-db-list gnome org
- Subject: [gnome-db] Database Objects
- Date: 26 Dec 2001 09:40:01 -0200
Hi all,
(This mail is intended to generate some brainstorm, besides of keeping
you guys update with what I might come up with, to make GDA/GNOME-DB
even better)
In my quest of developing a real world application using GNOME-DB, I
found myself in need of:
* Presenting the user with dozens of "dialogs" for editing database
data:
I've tried a handful of techniques, ranging from using raw Gtk widgets
(validating user input on these and issuing commands to the underlying
database == TROUBLESOME), to creating GObject classes for each recordset
the user will be editing and then GUI dialogs that call these object's
functions (clean code, very very slow development). This leads us to the
next topics, read on...
* Directly manipulating database "objects":
It would be great, at least for me, to be able to manipulate database
objects (databases, tables, fields, maybe views, maybe stored
procedures) in a object oriented fashion, similar to the way we deal
with just about everything in the GDA world. Something like this:
GdaDboDatabase *db = gda_dbo_database_new_from_file (connection,
"/path/to/enhanced_xmldb_file");
gda_dbo_database_drop (db);
or:
GdaDboDatabase *db = gda_dbo_database_new (connection);
gda_dbo_database_set_name (db, "my_new_db");
/* *_update syncs the Gda Database Objects with the underlying database
*/
gda_dbo_database_update (db);
or maybe:
GdaDboDatabase *db = gda_dbo_database_new_from_file (connection,
"path/to/enhanced_xmldb_file");
if (gda_dbo_database_validate (db)) {
/* keep going, our underlying db is just the way we want it
}
The GdaDbo prefix stands for "Gda Database Objects" and I chose this
"namespace" so that it doesn't collide with regular Gda classes. If we
feel it should collide (integrate, I mean) with gda, I can move them to
Gda "namespace".
* Enhanced XML Database format:
The Gda XML Database format is a very powerful tool in database
application development. It could become even more powerful if it
contained more metadata.
For example, consider a imaginary 'gda-xmldb-install' tool, that could
be implemented, in terms of GdaDbo, something like this:
/* let the user choose the what provider to use, defaulting with the
"favorite_provider" */
/* set up connection, then... */
GdaDboDatabase *db;
db = gda_dbo_database_new_from_file (connection, "/path/to/xmldb")
gda_dbo_database_update (db);
gda-xmldb-install could be called at application install time, setting
up a gda datasource, AND the underlying database. Mininum trouble and
fuss to the end user.
The xmldb format also lacks descriptive information on database, tables,
and even fields. This metadata being present and with I18N support would
ease the development of data editing GUI. Take a look at the attached
xmldb file. A GnomeDb class could read this this info and present a nice
GUI.
I guess that's a lot to talk about for now. I'm back to coding, thanks
for your time reading this bull..., hey I think it's not that bad.
Cheers.
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<!DOCTYPE database [
<!ELEMENT database ((short_description | long_description)*, datasource?, tables)>
<!ATTLIST database name CDATA #REQUIRED>
<!ATTLIST database date CDATA #REQUIRED>
<!ELEMENT datasource EMPTY>
<!ATTLIST datasource name CDATA #REQUIRED>
<!ATTLIST datasource favorite_provider CDATA #IMPLIED>
<!ELEMENT tables (table+)>
<!ELEMENT table ((short_description | long_description)*, field+)>
<!ATTLIST table name CDATA #REQUIRED>
<!ELEMENT field ((short_description | long_description)*)>
<!ATTLIST field name CDATA #REQUIRED>
<!ATTLIST field size CDATA #REQUIRED>
<!ATTLIST field scale CDATA #REQUIRED>
<!ATTLIST field gdatype (GDA_TypeNull | GDA_TypeBigint | GDA_TypeBinary |
GDA_TypeBoolean | GDA_TypeBstr | GDA_TypeChar | GDA_TypeCurrency |
GDA_TypeDate | GDA_TypeDbDate | GDA_TypeDbTime | GDA_TypeDbTimestamp |
GDA_TypeDecimal| GDA_TypeDouble | GDA_TypeError | GDA_TypeInteger |
GDA_TypeLongvarbin | GDA_TypeLongvarchar | GDA_TypeLongvarwchar |
GDA_TypeNumeric | GDA_TypeSingle | GDA_TypeSmallint | GDA_TypeTinyint |
GDA_TypeUBigint | GDA_TypeUSmallint |GDA_TypeVarchar | GDA_TypeVarbin |
GDA_TypeVarwchar | GDA_TypeFixchar | GDA_TypeFixbin | GDA_TypeFixwchar |
GDA_TypeUnknown | GDA_TypeLastValue) #REQUIRED>
<!ELEMENT short_description (#PCDATA)>
<!-- xml:lang server two purposes here:
- Helps the parser understand the language of the text that follows
- I18N support -->
<!ATTLIST short_description xml:lang NMTOKEN #REQUIRED>
<!ELEMENT long_description (#PCDATA)>
<!ATTLIST long_description xml:lang NMTOKEN #REQUIRED>
]>
<database name="sample_database" date="Wed Dec 22 13:19:07 1999">
<short_description xml:lang="en">Main Database</short_description>
<long_description xml:lang="en">The Main (and only) Database Used In This Application</long_description>
<datasource name="sample_db" favorite_provider="OAFIID:GNOME_Database_MySQL_Provider"></datasource>
<tables>
<table name="person">
<short_description xml:lang="en">People</short_description>
<long_description xml:lang="en">People (Customers, Suppliers, Employees, Contacts)</long_description>
<field name="id" size="64" scale="0" gdatype="GDA_TypeInteger">
<short_description xml:lang="en">ID</short_description>
<long_description xml:lang="en">Sequential ID Number</long_description>
<short_description xml:lang="pt">Código</short_description>
<long_description xml:lang="pt">Código numérico seqÜencial</long_description>
</field>
<field name="treatment" size="" scale="" gdatype="GDA_TypeVarchar">
<short_description xml:lang="en">Treatment</short_description>
<short_description xml:lang="pt">Tratamento</short_description>
<long_description xml:lang="pt">Exemplo: Senhor, Senhora, Senhorita</long_description>
</field>
<field name="name_first" size="" scale="" gdatype="GDA_TypeVarchar">
<short_description xml:lang="en">First Name</short_description>
<short_description xml:lang="pt">Primeiro Nome</short_description>
</field>
<field name="name_middle" size="" scale="" gdatype="GDA_TypeVarchar">
<short_description xml:lang="en">Middle Name</short_description>
<short_description xml:lang="pt">Nome do Meio</short_description>
</field>
<field name="name_last" size="" scale="" gdatype="GDA_TypeVarchar">
<short_description xml:lang="en">Last Name</short_description>
<short_description xml:lang="pt">Último Nome</short_description>
</field>
</table>
</tables>
</database>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]