-
Notifications
You must be signed in to change notification settings - Fork 458
Open
Labels
good first issueGood for newcomersGood for newcomersplugin: sqltype: bugSomething isn't workingSomething isn't working
Description
First of all, thanks for your work on Tauri and essential plugins like this one!
I'm having trouble inserting Uint8Array data into BLOB columns in SQLite. Instead of being inserted as binary data, it's inserted as a stringified JSON object.
My main use case is a uuid column storing the 128-bit binary representation of a UUID.
CREATE TABLE node (
uuid BLOB PRIMARY KEY
-- ...
)const uuid = new Uint8Array(16) // this would be a generated 128-bit UUID
const result = await db.execute('INSERT INTO node (uuid) VALUES ($1)', [uuid])What's inserted into node.uuid:
'{"0":0,"1":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0}'If I instead save the ArrayBuffer itself, I get an empty object:
const uuid = new Uint8Array(16).buffer // its underlying ArrayBuffer
const result = await db.execute('INSERT INTO node (uuid) VALUES ($1)', [uuid])'{}'Am I doing something wrong, or does the binary data simply not survive serialization when sent from JS to Rust?
If it's the latter, maybe serde_binary can be of help?
Mondei1
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersplugin: sqltype: bugSomething isn't workingSomething isn't working
Type
Projects
Status
📬Proposal