Open
Description
Hello,
There does not seem to be documentation on which Javascript datatypes node-sqlite3 supports sorting in a database, nor on the details of data conversion between JS and Sqlite3.
I was able to find this block of code, which seems to be where the JS -> Sqlite3 conversions happen. As far as I can tell:
- JS
string
becomes Sqlite3TEXT
- JS
RegExp
is converted to a string via.toString()
and becomes Sqlite3TEXT
- JS
number
becomes Sqlite3INTEGER
andFLOAT
- JS
boolean
becomes Sqlite3INTEGER
, restricted to0
and1
- JS
null
becomes Sqlite3NULL
- JS
Buffer
becomes Sqlite3BLOB
- JS
Date
becomes Sqlite3FLOAT
- JS
object
is converted to a string via.toString()
and becomes Sqlite3TEXT
. If.toString()
does not return astring
, the code throws. - No other datatypes are supported
I did not find the Sqlite3 -> JS conversion code, but I assume that the rules are as would be expected.
Anyway, I am dropping by just to (1) suggest that this information be documented somewhere, and (2) document it here for anyone in the future who has the same question as me.
I'd be willing to take a shot at doing the documentation myself, if you'd like.
Cheers