You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am new to JS so it is possible I am missing something.
I am using the RANDOM ROWID feature with libsql. When this is enabled I cannot retrieve items using the lastInsertRowid property from stmt.run() commands after insertion. The lastInsertRowid is slightly off from the actual rowid. However using stmt.all() after a select * ... statement I can get the correct rowids.
Looking at the tests they do not seem to cover the BigInt/SafeIntegers use case.
Here is example code to reproduce the issue:
importDatabasefrom'libsql';constdb=newDatabase(':memory:');db.defaultSafeIntegers(true);db.exec(` DROP TABLE IF EXISTS users; CREATE TABLE users (rowid INTEGER PRIMARY KEY, name TEXT) RANDOM ROWID;`);conststmt_insert=db.prepare("INSERT INTO users(name) VALUES (?)");constinfo_insert=stmt_insert.run('alma');console.log([typeofinfo_insert.lastInsertRowid,info_insert.lastInsertRowid]);conststmt_list=db.prepare("SELECT * from users");constinfo_list=stmt_list.all()console.log([typeofinfo_list[0].rowid,info_list]);
The text was updated successfully, but these errors were encountered:
ykuksenko
changed the title
stmt.run() lastInsertRowid seems to produce only number type, not BigInt
stmt.run().lastInsertRowid is wrong with RANDOM ROWID
Apr 2, 2024
Hi, I am new to JS so it is possible I am missing something.
RANDOM ROWID
feature with libsql. When this is enabled I cannot retrieve items using thelastInsertRowid
property fromstmt.run()
commands after insertion. The lastInsertRowid is slightly off from the actual rowid. However usingstmt.all()
after aselect * ...
statement I can get the correct rowids.BigInt
/SafeIntegers
use case.Here is example code to reproduce the issue:
and sample output:
The text was updated successfully, but these errors were encountered: