WiseLibs / better-sqlite3

The fastest and simplest library for SQLite3 in Node.js.
MIT License
5.44k stars 394 forks source link

BigInt values is queries incorrectly #1170

Closed Volland closed 6 months ago

Volland commented 6 months ago

I have an issue working with Bigint Let's Create a simple table

const  Database = require("better-sqlite3");
const  db = new Database('m.sqlite')
db.exec('create table sq (name varchar primary key , seq integer ); ')

Now Let's insert BigInt that feet 64 bit

db.exec(`insert into sq (name , seq ) values ('p', 1152921504606846977)`)

Now Lets query data

db.prepare('select * from sq ').all()

Result [ { name: 'v', seq: 1152921504606847000 }, { name: 'p', seq: 1152921504606847000 } ] I can query tables with SQLite cli and see valid data in a table. Unfortunately I could add a SQLite file but here console dump sqlite3 /Users/volodymyrpavlyshyn/Documents/work/hyphen/cr-sql-playground/vector-test/m.sqlite SQLite version 3.43.2 2023-10-10 13:08:14 Enter ".help" for usage hints. sqlite> .tables sq sqlite> select * from sq; v|1152921504606846977 p|1152921504606846977 sqlite>

JoshuaWise commented 6 months ago

See this