Re: First impressions/problems (was [gnome-db] libgda and application development )



<SNIP>

> well, if you call gnome_db_init, you don't need to call neither
> gnome_init, nor gconf_init, nor oaf_init, nor bonobo_init nor gda_init.
> That is, it is just a wrapper for all these _init functions. If you need
> to do some special initialization, just don't call gnome_db_init and be
> sure to initialize OAF (oaf_init) Bonobo (bonobo_init). Also, don't call
> gtk_main, but bonobo_main, or gnome_db_main

ah, okay this i was misinformed of then. :)

<SNIP>

> specified, which is usually not needed at all for "normal" uses. The
> easiest way for executing commands is either by using
> gda_connection_execute, or by using the GdaCommand class:
> 
> cmd = gda_command_new ();
> gda_command_set_connection (cmd, cnc);
> gda_command_set_text (cmd, "SELECT * FROM my_table");
> recset = gda_command_execute (cmd, &reccount, NULL);

Hrmm okay well.. I guess i can understand why. It does seem like though,
that it would be nice to have a recordset be able to function without a
command object, or perhaps an implicit instantiation of one so that developers
wouldn't have to mess with it.

ie.

gda_recordset_sql_open ( rs, "select foo from bar", cnc )

but I dunno. I'm just thinking out loud..

<SNIP>

> to get the fields:
> 
> for (cnt = 0; cnt < gda_recordset_rowsize (recset); cnt++) {
> 	GdaField *field = gda_recordset_field_idx (recset, cnt);
> 	...
> }
> 
> you've got also gda_recordset_field_name, to retrieve a field by its
> name. Once you get a valid GdaField from a GdaRecordset, this GdaField
> represents a given field in the current row. To access the contents of
> the field, just use the #define's in gda-field.h, which allow you to get
> it in different data types. Also, you can get the contents as a string,
> by calling gda_field_stringify
> 
> I've cleaned up the API for GdaField's a lot for GNOME 2, so the
> ugliness of that code will disappear shortly.

Hrmmm.. I need to play with this more, now that I see it, but my first initial
reaction is fear and horror. This actually appears to be the first thing that
ADO does a lot nicer than gnome-db. ie,  recordset.fields.value("field_name") 
is much easier to code than 

gda_field_stringify( gda_recordset_field_name( rs, "field_name ") 
I'm not sure this even will work does it?  Also, gda_field_stringify 
wasn't in the online docs, did you mean gda_stringify_value ? or?

--
Will





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