Reputation: 4287
I have a "logic" problem when making "inserts" on the SQLite database of my app.
These are my tables.
How should I manage the "need" of retrieving contact_id and photos_id in order to make the insert into the table contact_photo?
I know that I can get the last _id generated by SQLite with SELECT seq from sqlite_sequence where ...
, but this doesn't seem a "professional" solution.
Is there a better way to achieve my goal?
Thank you in advance
Upvotes: 1
Views: 66
Reputation: 1041
have a look to this document
long insertOrThrow (String table,
String nullColumnHack,
ContentValues values)
will returns row ID of the newly inserted row, or -1 if an error occurred
Upvotes: 1