[gnome-db] gda_xml_database
- From: Rui Barreiros <ruiba mail telepac pt>
- To: gnome-db-list gnome org
- Subject: [gnome-db] gda_xml_database
- Date: 23 Dec 2002 20:41:53 +0000
Hi there,
i've downloaded gnomedb and gda, and i'm trying to create a xml db using
default provider, here is the code:
GdaXmlDatabase *db;
GdaTable *table;
GdaFieldAttributes *fa;
db = gda_xml_database_new();
gda_xml_database_set_name(db, "ngCatalog");
gda_xml_database_set_uri(db, "URI=/tmp/catalogDB.db2");
table = gda_xml_database_new_table(db, "teste");
fa = gda_field_attributes_new();
gda_field_attributes_set_name(fa, "id");
gda_field_attributes_set_gdatype(fa, GDA_VALUE_TYPE_INTEGER);
gda_field_attributes_set_caption(fa, "Id");
gda_field_attributes_set_defined_size(fa, 30);
gda_field_attributes_set_allow_null(fa, 0);
gda_field_attributes_set_primary_key(fa, 1);
gda_field_attributes_set_unique_key(fa, 1);
gda_field_attributes_set_auto_increment(fa, 1);
gda_table_add_field(table, (const GdaFieldAttributes *)fa);
gda_field_attributes_free(fa);
gda_xml_database_save(db, "/tmp/catalogDB.db2");
as there is no documentation (examples and such) about xml db, i tried
using the api documentation, and it seem's to work well this way but
when i run my app it send this errors:
(ngcataloghome:7758): GLib-GObject-WARNING **: invalid cast from
`GdaTable' to `GdaDataModelArray'
** (ngcataloghome:7758): CRITICAL **: file gda-data-model-array.c: line
236 (gda_data_model_array_set_n_columns): assertion
`GDA_IS_DATA_MODEL_ARRAY (model)' failed
** (ngcataloghome:7758): CRITICAL **: file gda-data-model.c: line 259
(gda_data_model_get_n_columns): assertion `CLASS (model)->get_n_columns
!= NULL' failed
and it just creates a filename with the database and table definition
without any column. it seems it won't cast the GdaTable to
GdaDataModelArray in gda-table.c on gda_table_add_field function thus
not adding the field, and gives the error of the no columns.
Another doubt, wy is the file created with the following perms?
--wxrwx--T 1 brandon brandon 82 Dec 23 20:40
/tmp/catalogDB.db2
this way, not even the owner (in this case the user brandon) can't read
the file.
Best wishes,
Rui Barreiros
--
Rui Barreiros <ruiba mail telepac pt>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]