Re: [gnome-db] Access to last auto_increment value (mysql_insert_id)

On Thu, 2004-03-04 at 23:56 +0000, Nigel Titley wrote:

> Gentlefolk,
> I'm building an application using libgda as an abstraction layer over a
> mysql database. I am using the auto_increment column type to generate
> unique ids for each row in a table. My question is: is it possible to
> access the generated id after executing the INSERT. If I was using the
> mysql API directly, I would use the mysql_insert_id() function, but
> despite a diligent search of the documentation, the archives of this
> list, and the gda-mysql source code, I can't seem to see a way of doing
> this. Without this functionality, the auto_increment facilty is of
> limited usefulness.
> Can someone point me in the direction of documentation that could help
> me? 
there is no direct way to get it. I guess the best thing would be, in
libgda 1.2, to set the ID on the field on insertion, and have the data
model's new added row have that value in the corresponding field. Thus,
you'll have just to read the field in the new row.

I'll add it to the 1.2 code soon.


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