aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2023-07-29 15:53:53 +0000
committerstephan <stephan@noemail.net>2023-07-29 15:53:53 +0000
commit5d800cdb6eb8aa078bd865b33fe5ec1e279d0abd (patch)
tree4372748a6f8c0436f55470ca5f7871e9e40e96df /ext/wasm/api
parent0c6b869263a0eb3514438328dcf989c3bd1f1821 (diff)
downloadsqlite-5d800cdb6eb8aa078bd865b33fe5ec1e279d0abd.tar.gz
sqlite-5d800cdb6eb8aa078bd865b33fe5ec1e279d0abd.zip
SAHPoolUtil.importDb() now accepts either a byte array or ArrayBuffer.
FossilOrigin-Name: 3848f04e542e2f0f8975e82632af598aac3b60312bd244b0472f7ddf1dda77df
Diffstat (limited to 'ext/wasm/api')
-rw-r--r--ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js
index ee8d1a5d6..3ba889c39 100644
--- a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js
+++ b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js
@@ -865,6 +865,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
//! Documented elsewhere in this file.
importDb(name, bytes){
+ if(bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes);
const n = bytes.byteLength;
if(n<512 || n%512!=0){
toss("Byte array size is invalid for an SQLite db.");
@@ -1074,16 +1075,17 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
Returns an array of the names of the files currently allocated to
slots. This list is the same length as getFileCount().
- - void importDb(name, byteArray)
+ - void importDb(name, bytes)
Imports the contents of an SQLite database, provided as a byte
- array, under the given name, overwriting any existing
- content. Throws if the pool has no available file slots, on I/O
- error, or if the input does not appear to be a database. In the
- latter case, only a cursory examination is made. Note that this
- routine is _only_ for importing database files, not arbitrary files,
- the reason being that this VFS will automatically clean up any
- non-database files so importing them is pointless.
+ array or ArrayBuffer, under the given name, overwriting any
+ existing content. Throws if the pool has no available file slots,
+ on I/O error, or if the input does not appear to be a
+ database. In the latter case, only a cursory examination is made.
+ Note that this routine is _only_ for importing database files,
+ not arbitrary files, the reason being that this VFS will
+ automatically clean up any non-database files so importing them
+ is pointless.
- [async] number reduceCapacity(n)