-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support 64bit numbers #139
Comments
Have you tried the int64 option? https://github.com/denodrivers/sqlite3/blob/main/doc.md#options |
Sorry about that! I had been switching between different drivers without looking at their individual options. Seems like the others must've had that on by default. This actually makes me curious though - why not have int64 enabled by default? |
Previously it was slow to return bigints from Deno FFI but now it’s fast. But I’m still not sure what to do in this case: SQLite3 tells us there is a column value of int type, we don’t know if it’s 32 bit or 64 bit so we always assume 32 bit unless int64 option is specified, in which case a bigint is returned only when a value is too big to fit in JS number. So the value becomes a union number | bigint - which is not exactly ideal because bigints are not compatible with numbers and would need special handling like checking the type before it’s used with something. We have three options to default to:
Another option would be to maybe always get a 64 bit value and truncate it to 52 bits for JS number, which is certainly better than 32 bit and will support majority use cases. BigInts are not a performance issue in recent Deno FFI update anymore so it won’t have any negative impacts. |
Or at least provide a warning somewhere I lost some time on this.
The text was updated successfully, but these errors were encountered: