1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Extend oo1.Stmt.bind() to accept ArrayBuffer instances to bind as blobs.

FossilOrigin-Name: f76bd30137fbff981625ffcb28cddd5e8651803dfc3f2d8d7801ead33496311d
This commit is contained in:
stephan
2022-12-24 14:16:02 +00:00
parent 0db1c90137
commit cede6384fd
4 changed files with 35 additions and 28 deletions

View File

@@ -1648,7 +1648,10 @@ self.sqlite3InitModule = sqlite3InitModule;
assert(T.eqApprox(1.3,db.selectValue("select asis(1 + 0.3)")));
let blobArg = new Uint8Array([0x68, 0x69]);
let blobRc = db.selectValue("select asis(?1)", blobArg);
let blobRc = db.selectValue(
"select asis(?1)",
blobArg.buffer/*confirm that ArrayBuffer is handled as a Uint8Array*/
);
T.assert(blobRc instanceof Uint8Array).
assert(2 === blobRc.length).
assert(0x68==blobRc[0] && 0x69==blobRc[1]);