Slaftos
Slaftos

Reputation: 316

Retrieve rowid for a row in an sqlite result set

Utilizing the sqlite c interface I need a way to find the rowid for a row in a result set. The select statement that created the result set does not include the rowid column in the result set.

Assume that I have a successful SQLITE_ROW return from sqlite3_step(stmt). How can I retrieve the rowid for the current row?

I have no control over the select statement that returned the results. Please don't suggest SELECT rowid, ....

thanks

Upvotes: 0

Views: 1243

Answers (1)

Michael Low
Michael Low

Reputation: 24506

Best case would be if the result set you get includes an integer primary key value, in which case that's the same as the rowid. Or if you've got a non-integer primary key you could use that to issue another SELECT query, but if neither of those are possible I think you're out-of-luck I'm afraid.

Upvotes: 1

Related Questions