Ok, we see here that the SQLite insert statement returns something called row id.
When inserting, we know that SQLite likes a primary key column called ID and will auto-generate an appropriate value if the ID value being inserted is null.
The glue that’s missing is confirmation that the row id returned by the SQLiteDatabase.insert() method is in fact the value that was auto-generated for the row’s primary key. (This is not the case for Oracle…)
Will someone confirm or deny, please?
Resolution
Ok, so from the link posted by @sixfeetsix:
Each entry in an SQLite table has a unique 64-bit signed integer key called the “rowid”. The rowid is always available as an undeclared column… If the table has a column of type INTEGER PRIMARY KEY then that column is another alias for the rowid.
Then his auto-increment link verifies that the row_id and the auto-increment value will be the same value.
That’s a wrap, thanks, folks!
The Android insert(…) method returns:
This can be confusing to the uninitiated, but the row id in sqlite is either the
integer primary keyfield, or, in its absence, a 64-bit undeclared column named ROWID.So when you insert either NULL or no value in an auto-increment field, the generated value is returned.