Re: [gnome-db] Re: libgda .... Re: GnuCash page on GO site

Laurent Sansonetti wrote:
On Sun, 2004-03-07 at 21:47, Dru wrote:

libdbi is missing same features as libgda. ie. getting last id of inserted record and been able to get detailed field attributes.

gda_connection_execute_non_query (which should be used to execute
non-query commands, like insertions in this case) returns the number of
rows affected by the command.  So even if there is apparently no direct
way to get the last ID, it is possible by using some additional magic
after the call.

Hmm. postgresql has a the oid field, which value is returned every time you do an insert. I currently use to to do a select of a record once i insert it. Its so i know it was inserted correctly and that all teh functions were excuted by the database durining insertion, and then i can have it back in memory again as teh results after all the server side processing. if i know the default values and the primary keys in a record i can get around this because i can execute the default on the fields before i run the insert, which would hopefully give it a unique primary key which i would know then do a select on those primary keys.

gda_data_model_describe_column can be used to describe a specific column
on a specific datamodel (`SELECT * FROM foo' as an example).

Can this way indicate if a field is a primary key, what default values it has assigned, and if it has any forign relationships? Default values one is needed so you can see what a field will default when you fill in a new form. Primary key one is needed so i can tell how i can uniquly select that record again. And forign relatships is needed for joins, but not essential. Its for when the user requests to view a table from another table and i gotta work out how to do the joins in the sql.

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