mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
SAHPoolUtil.importDb() now accepts either a byte array or ArrayBuffer.
FossilOrigin-Name: 3848f04e542e2f0f8975e82632af598aac3b60312bd244b0472f7ddf1dda77df
This commit is contained in:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user