get value autoincrement into db sqlite

Bob Sneidar bobs at twft.com
Mon Oct 24 12:28:36 EDT 2011


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
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list