[Gambas-user] gb.db autoincrement ?
Doriano Blengino
doriano.blengino at ...1909...
Mon Oct 20 09:54:18 CEST 2008
Doriano Blengino ha scritto:
> admin at ...1080... ha scritto:
>
>> But in case you are using mySQL there is the function LAST_INSERT_ID (),
>> see:
>> http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_last-insert-id.
>>
>>
> About the Last_insert_ID(), I read about this function, but it seems it
> is not implemented in gambas.
> May be I can import it using "EXTERNAL sub (...) ..."; or perhaps is
> more simple to do a query, once a lock is in place.
>
I correct myself - probably I doesn't need to be implemented in gambas,
because one can use it in a simple sql request. I will try it:
db.exec("insert data in master table 'invoices'")
lastinserted=db.exec("select last_insert_id() as last")
Perhaps locks are still needed (or this last_insert_id() is "cached" in
the client library? It would be good...)
Thanks for your information, and cheers,
Doriano
More information about the User
mailing list