👋 Hello! Thank you for the very useful library. I have a bug report.
SQLite's REAL values are IEEE floating point numbers, and although they do not support NaNs, they do support infinities. An easy way to produce them is with overflowing float literals:
#!/usr/bin/env -S deno run
import { DB } from "https://deno.land/x/sqlite@v2.3.0/mod.ts";
const db = new DB();
for (const sqlValue of ['1e34567', '-1e34567']) {
const [[result]] = db.query(`SELECT ${sqlValue}`);
console.log(sqlValue, '->', result);
}
1e34567 -> Infinity
-1e34567 -> -Infinity
This library returns ±Infinity values from SQLite correctly. However, when passing them to SQLite, they are converted to the value -9223372036854775808.
for (const jsValue of [1e34567, -1e34567]) {
const [[result]] = db.query("SELECT ?", [jsValue]);
console.log(jsValue, '->', result);
}
👋 Hello! Thank you for the very useful library. I have a bug report.
SQLite's
REAL
values are IEEE floating point numbers, and although they do not supportNaN
s, they do support infinities. An easy way to produce them is with overflowing float literals:This library returns ±Infinity values from SQLite correctly. However, when passing them to SQLite, they are converted to the value
-9223372036854775808
.