Comments (8)
Fix released in 0.2.5
from sqlite3.
Legend! Thank you 🙏🏾
from sqlite3.
I think that's because it's parsing all integer type columns as 32-bit integers. I will fix this asap
from sqlite3.
This problem seem to be back in 0.8.2
CLI:
SELECT MAX(period) FROM spotprice
1678572000000
Deno sqlite3 0.8.3
prepare('SELECT MAX(period) FROM spotprice').values() // also tested with .all(), also tested with <number> and <bigint> like in the test cases, to no avail
[ [ -760212736 ] ]
from sqlite3.
@Hexagon See doc.md. It's a performance optimization to always prefer 32-bit integers over 64-bit. SQLite API does not differentiate between both in value type, hence the preference.
If you want to serialize as 64 bit either set int64: true in DB options or temporarily set it in DB's property to avoid performance deopt.
Performance issue is because the FFI API cannot use BigInts in fast path, but this may change in future, so both options will become performant.
from sqlite3.
@DjDeveloperr Sorry about that! I searched the docs and googled and somehow missed that the option were listed at top of documentation 😅
However, this got me thinking. Is there really any performance gain from having this error prone option defaulted to int32?
Afaik both sqlite and javascript handle 64bit integers (and nothing above that) ootb. Wouldn't it be possible to change
Line 74 in 33946c2
to
if (ty === SQLITE_INTEGER) return sqlite3_column_int64(handle, i);
and drop this clause (containing a possibly slow bignum check) altogether
Line 83 in 33946c2
from sqlite3.
sqlite3_column_int is faster than sqlite3_column_int64 because the latter makes a heap allocation to store the result value as 64 bit integers are not directly supported by V8 Fast API yet. It's just an implementation detail behind the FFI API, which is likely going to change in future as returning 64 bit numbers as BigInts may become possible via Fast API, at least that's the plan.
from sqlite3.
I see, thanks for taking time to answer 👍
from sqlite3.
Related Issues (20)
- Unsafe pointer create exception HOT 4
- Bug in Reading Integers HOT 1
- `Failed to load SQLite3 Dynamic Library` – example code not working HOT 6
- Getting this error for some reason HOT 8
- Error: Native SQLite3 library not found, try installing SQLite3 HOT 3
- not working inside docker HOT 4
- Support user-defined functions HOT 3
- Insertions in prepared statements need to be finalized to persist HOT 2
- empty string and NOT NULL constraint
- Segfault after close() (regression from 0.6.1) HOT 2
- Error running the example HOT 10
- Support extensions HOT 1
- Breaks with Deno v1.30 HOT 2
- TS Error when running the vendored code HOT 2
- `ext/` folder containing import helpers for common extensions HOT 1
- `ext/` folder containing import helpers for common extensions
- Segfault on debian aarch64 (raspberry pi) HOT 13
- Use tagged releases of SQLite HOT 3
- Open database readOnly not working HOT 3
- Fts5 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlite3.