views:

21

answers:

1

What's the best way to do this?

Note that this is the sqlite version packaged with Google Gears, also.

A: 

This post has details of getting the value of the auto increment key in sqlite. Is that what you are after?

Andy Robinson
Close, but this is Javascript running Google Gears. Is this what I need:http://code.google.com/apis/gears/api_database.html#Database-lastInsertRowId ?
Hamster
Yeah that looks like it will work. Here's a post, http://blog.brianflove.com/articles/2008/07/14/google-gears-presentation/, with some example code running with gears, doing and insert and getting the id using lastInsertRowId.db.execute('insert into Users (firstname, lastname, Description, Timestamp) values (?, ?, ?, ?)', [$F('firstname'), $F('lastname'), $F('Description'), new Date().getTime()]); lastid = db.lastInsertRowId;
Andy Robinson