The last inserted rowid is returned from Hrana and HTTP APIs. Let's expose it in the client, too.
The only possible issue is the type of the lastInsertRowid field. There are three options:
bigint: this is the best way to represent a 64-bit integer in JavaScript, but we don't use bigints anywhere else in the API
string: we convert JavaScript bigint to SQLite string when storing data into the database
number: we convert SQLite integers to JavaScript number-s (doubles) when loading data from database, but a number cannot represent all ROWIDs
I decided to go for bigint, because it seems to be least likely to give trouble: it can represent all ROWIDs, and when passed back to SQLite, the client converts it to a string, which SQLite converts back to an integer. (Perhaps it would be better to convert JavaScript bigint to a SQLite integer (and throw an exception if it overflows), but this would break backwards compatibility, so let's do it in the next major release.)
The last inserted rowid is returned from Hrana and HTTP APIs. Let's expose it in the client, too.
The only possible issue is the type of the
lastInsertRowid
field. There are three options:bigint
: this is the best way to represent a 64-bit integer in JavaScript, but we don't use bigints anywhere else in the APIstring
: we convert JavaScript bigint to SQLite string when storing data into the databasenumber
: we convert SQLite integers to JavaScriptnumber
-s (doubles) when loading data from database, but anumber
cannot represent all ROWIDsI decided to go for
bigint
, because it seems to be least likely to give trouble: it can represent all ROWIDs, and when passed back to SQLite, the client converts it to a string, which SQLite converts back to an integer. (Perhaps it would be better to convert JavaScriptbigint
to a SQLite integer (and throw an exception if it overflows), but this would break backwards compatibility, so let's do it in the next major release.)