When I attempt to SELECT data from my sqlite3 database and get the value with the node.js module better-sqlite3, I run into issues where the last two digits of the integer I am getting are rounded.
For example, when I get the value
123412341234123412
it is returned as
123412341234123400
I have used the exact same SQL I am using to select the value in DB Browser and it works as I'd expect (without rounding the number), however when I do this in better-sqlite3 it always rounds these.
Here's the code I'm using in better-sqlite:
let getClocked = db.prepare("SELECT messageID FROM clocked WHERE clockedUID = ?").get(id)
console.log(getClocked)
The returned value in the console:
{ messageID: 643562287101116400 }
The value in my database (the same value that was inserted, viewed with DB Browser for SQLite):
643562287101116427
I have also tried using .all(), .iterate(), .pluck() and .raw() instead of/alongside .get() which gave me the same result. Happens with other values in the table as well.
(Here is the SQL I used to create the table):
CREATE TABLE IF NOT EXISTS "clocked" (
"clockedUID" INTEGER NOT NULL UNIQUE,
"time" TEXT NOT NULL,
"messageID" INTEGER,
PRIMARY KEY("clockedUID")
);
New to SQLite and better-sqlite3, so any help is appreciated! Thanks!