Re: First impressions/problems (was [gnome-db] libgda and application development )
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: will lashell net
- Cc: GDA <gnome-db-list gnome org>
- Subject: Re: First impressions/problems (was [gnome-db] libgda and application development )
- Date: 03 Sep 2001 13:40:42 +0200
On Mon, 2001-09-03 at 06:16, will lashell net wrote:
> Okay well here we go.. :)
>
> These are comments purely from an app developers point of view,
> and me knowing absolutely nothing about the internals of the libarary.
> So please don't flame me too much :)
>
ok, I won't :-)
> gnome_db_init() is this function really necessary? When do we call it?
> if we have to call it, when do we need to call it? before gnome_init, after?
>
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
> gda_corga_get_org()
>
> why can't gda_connection_new() call this implicitly if its not specified?
>
yes, the CORBA_ORB parameter is planned to be removed, which should be
really easy, since it means just grepping for gda_connection_new and
remove all parameters. There's even a bug for it:
http://bugzilla.gnome.org/show_bug.cgi?id=57304
> okay.. now this one is harsh for new developers
>
> gint gda_recordset_open (GdaRecordset *rs,
> GdaCommand *cmd,
> GDA_CursorType cursor_type,
> GDA_LockType lock_type,
> gulong options);
>
>
> in the documentation you tell us that you only support forward only cursors, and read only locks
>
> soooo umm, what do we use? do you specify a string, do you put in an int, I didn't see anywhere
> what we should actually put in there.
>
this is a self-contained function that allows extra stuff to be
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);
>
> why is there no gda_recordset_num_rows() function? Where/how can i see how many rows
> a recordset contains? Should I pull this out of the struct( gads i hope not )
> I see there is a gda_recordset_affected_rows() but this should only be for queries that
> change rows.
>
in theory, gda_command_execute should return, in '&reccount', the number
of affected rows. For postgres, it works, since it knows how many rows
were returned, but for other providers, it does not.
So yes, we should fix this. I'll add items to bugzilla about this.
>
> Hrmm okay i've got my recordset, now... how to get the value of a field. I looked at the
> field object, but ... wow.... there's a whole lot more there than I would have
> expected. How/what do I do now?
>
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.
>
> Please don't think i'm completely dissatisfied, because there is a striking similarity between this
> and ADO, which is actually really nice and meaningful :)
>
great, I'm glad to hear this. Please continue sharing all your
impressions: they would be really useful for us.
cheers
--
Rodrigo Moya <rodrigo gnome-db org> - <rodrigo ximian com>
http://www.gnome-db.org/ - http://www.ximian.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]