Re: [gnome-db] database xml - add data from model



Le jeu 21/08/2003 à 18:26, Rodrigo Moya a écrit :
> On Thu, 2003-08-21 at 17:20 +0200, Philippe CHARLIER wrote:
> > Hi,
> > 
> > I am still trying to use an XmlDatabase, I am able to create a file and
> > define tables.
> > I just need to do two more things to start using libgda in an
> > application :
> > 
> > - to insert datas in the tables and
> > - to query those data in the created database.
> > 
> > Concerning the insertion of data in the tables, it seems that the
> > function "gda_table_add_data_from_model()" does nothing and so that for
> > the moment it is not yet possible to populate an Xml Database with
> > libgda.
> > 
> right, it's empty :-( File a bug to bugzilla please

I will do that as soon as I find the time to understand how to fill
correctly a bug with bugzilla ;-)

> > Could you confirm this ?
> > If yes, I would be pleased to code that part ... but I have no idea of
> > the way to do that ;-(
> > 
> GdaTable's are just GdaDataModel's, so to add data just use the
> gda_data_model_append_row function.

I tried, but it seems I do not understand how those data models are
working.
Here is what I did :

---------------------------------------------------------------

void create_tables(GdaXmlDatabase *database) {
  GdaTable *airport;
  GdaTable *runway;

  GdaFieldAttributes *fieldAttributes;

  GList *airportRow = NULL;
  GList *runwayRow = NULL;

  airport = gda_xml_database_new_table(database, "airport");
  runway = gda_xml_database_new_table(database, "runway");

  /* 2 columns for table airport : ICAO and IATA          */
  fieldAttributes = gda_field_attributes_new();
    /* all attributes set here using a serie of functions */
    /* gda_field_attributes_set_xxxx()                    */
  gda_table_add_field(airport, fieldAttributes);
  fieldAttributes = gda_field_attributes_new();
    /* all attributes set here using a serie of functions */
    /* gda_field_attributes_set_xxxx()                    */
  gda_table_add_field(airport, fieldAttributes);

  /* 1 column for table runway : DESIGNATOR               */
  fieldAttributes = gda_field_attributes_new();
    /* all attributes set here using a serie of functions */
    /* gda_field_attributes_set_xxxx()                    */
  gda_table_add_field(runway, fieldAttributes);

  airportRow = g_list_append(airportRow, "EBBR");
  airportRow = g_list_append(airportRow, "BRU");
  runwayRow = g_list_append(runwayRow, "25R");

  gda_data_model_append_row(GDA_DATA_MODEL(airport), airportRow);
  gda_data_model_append_row(GDA_DATA_MODEL(runway), runwayRow);
}

---------------------------------------------------------------

The tables with requested attributes are created, so everything is fine
on that side.
But the data are NULL :

<data>
 <row position="0">
  <field position="0">NULL</field>
  <field position="1">NULL</field>
 </row>
</data>

and should be :

<data>
 <row position="0">
  <field position="0">EBBR</field>
  <field position="1">BRU</field>
 </row>
</data>

What did I miss ???

Tkx in advance.

Phil

PS. : I keep track of all my wandering, so I suppose a tutorial
"gda-xml-database for idiots" is on the launching pad ;-)  

> cheers
> 
> _______________________________________________
> gnome-db-list mailing list
> gnome-db-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-db-list




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