Ofek Ron
Ofek Ron

Reputation: 8588

Using insert return value to retrieve that same row later

I'm adding rows using database.insertOrThrow(), how do I use the returned value, which is documented to be the row id, to retrieve that same row later?

If there is no way to do that, will insertOrThrow return an AutoIncrement key field value if I define one? If not, what is the simplest way to insert data to sqlite database and get an handle to it for later use?

Upvotes: 0

Views: 94

Answers (1)

CL.
CL.

Reputation: 180280

The rowid is the INTEGER PRIMARY KEY column, if you have defined any. If not, you can access it with the special column name rowid:

SELECT ... FROM MyTable WHERE rowid = ?

Upvotes: 1

Related Questions