The LAST_INSERT_ROWID() function returns the last inserted id for the current connection, so any other users on at the same time will not interfere with the value you require :)

On 24/10/2011 17:28, Bob Sneidar wrote:
Being that sqLite is typically a single user system this works fine. How about 
in a multiuser database? Can you trust that no one is going to do an insert 
just before you check? Does transactional processing accommodate this? That is, 
if I have started a transaction, will I get the next increment value without 
committing first? What happens if I rollback the transaction? Will the value I 
rolled back be reused next insert? Or maybe a transaction locks the database 
and prevents inserts/updates... I have always wondered about how transactions 
affect things like this.

Bob


On Oct 24, 2011, at 8:37 AM, John Craig wrote:

Hi, Alessandro.

put revDataFromQuery(,, gDB, "SELECT LAST_INSERT_ROWID()") into tId

will do the trick.



On 24/10/2011 16:03, Alessandro Pisoni wrote:
how do I get the value of an autoincrement field in a table sqlite after I 
inserted a record with INSERT ect ect



thanks


Alessandro Pisoni






_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to