mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Improve exception handling in OpfsDb.importDb().
FossilOrigin-Name: a4eedd63b58f5c273b671f687cb68a32259963dbb053a710770383c735fb7f26
This commit is contained in:
@@ -1176,10 +1176,10 @@ const installOpfsVfs = function callee(options){
|
|||||||
const importDbChunked = async function(filename, callback){
|
const importDbChunked = async function(filename, callback){
|
||||||
const [hDir, fnamePart] = await opfsUtil.getDirForFilename(filename, true);
|
const [hDir, fnamePart] = await opfsUtil.getDirForFilename(filename, true);
|
||||||
const hFile = await hDir.getFileHandle(fnamePart, {create:true});
|
const hFile = await hDir.getFileHandle(fnamePart, {create:true});
|
||||||
const sah = await hFile.createSyncAccessHandle();
|
let sah = await hFile.createSyncAccessHandle();
|
||||||
sah.truncate(0);
|
|
||||||
let nWrote = 0, chunk, checkedHeader = false, err = false;
|
let nWrote = 0, chunk, checkedHeader = false, err = false;
|
||||||
try{
|
try{
|
||||||
|
sah.truncate(0);
|
||||||
while( undefined !== (chunk = await callback()) ){
|
while( undefined !== (chunk = await callback()) ){
|
||||||
if(chunk instanceof ArrayBuffer) chunk = new Uint8Array(chunk);
|
if(chunk instanceof ArrayBuffer) chunk = new Uint8Array(chunk);
|
||||||
if( 0===nWrote && chunk.byteLength>=15 ){
|
if( 0===nWrote && chunk.byteLength>=15 ){
|
||||||
@@ -1200,10 +1200,12 @@ const installOpfsVfs = function callee(options){
|
|||||||
sah.write(new Uint8Array(2), {at: 18}/*force db out of WAL mode*/);
|
sah.write(new Uint8Array(2), {at: 18}/*force db out of WAL mode*/);
|
||||||
return nWrote;
|
return nWrote;
|
||||||
}catch(e){
|
}catch(e){
|
||||||
|
await sah.close();
|
||||||
|
sah = undefined;
|
||||||
await hDir.removeEntry( fnamePart ).catch(()=>{});
|
await hDir.removeEntry( fnamePart ).catch(()=>{});
|
||||||
throw e;
|
throw e;
|
||||||
}finally {
|
}finally {
|
||||||
await sah.close();
|
if( sah ) await sah.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1256,6 +1258,7 @@ const installOpfsVfs = function callee(options){
|
|||||||
sah.write(new Uint8Array(2), {at: 18}) /* force db out of WAL mode */;
|
sah.write(new Uint8Array(2), {at: 18}) /* force db out of WAL mode */;
|
||||||
return nWrote;
|
return nWrote;
|
||||||
}catch(e){
|
}catch(e){
|
||||||
|
if( sah ){ await sah.close(); sah = undefined; }
|
||||||
await hDir.removeEntry( fnamePart ).catch(()=>{});
|
await hDir.removeEntry( fnamePart ).catch(()=>{});
|
||||||
throw e;
|
throw e;
|
||||||
}finally{
|
}finally{
|
||||||
|
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Extend\sthe\simportDb()\smethod\sof\sboth\sOPFS\sVFSes\sto\s(A)\ssupport\sreading\sin\san\sasync\sstreaming\sfashion\svia\sa\scallback\sand\s(B)\sautomatically\sdisable\sWAL\smode\sin\sthe\simported\sdb.
|
C Improve\sexception\shandling\sin\sOpfsDb.importDb().
|
||||||
D 2023-08-18T14:16:26.669
|
D 2023-08-18T14:41:21.668
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@@ -549,7 +549,7 @@ F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d299
|
|||||||
F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256dfb4f96555b865dbb7a6b65e379
|
F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256dfb4f96555b865dbb7a6b65e379
|
||||||
F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25
|
F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25
|
||||||
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 561463ac5380e4ccf1839a1922e6d7a5585660f32e3b9701a270b78cd35566cf
|
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 561463ac5380e4ccf1839a1922e6d7a5585660f32e3b9701a270b78cd35566cf
|
||||||
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 656952a75c36d96e3248b03ae26d6a7f8d6ff31e66432c63e1c0bb021f1234ab
|
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js d9e62d42b86f7bb3143eb071628b24e2ba7dcc749e41a0e9d3e2451bfea1a6b6
|
||||||
F ext/wasm/api/sqlite3-wasm.c d4d4c2b349b43b7b861e6d2994299630fb79e07573ea6b61e28e8071b7d16b61
|
F ext/wasm/api/sqlite3-wasm.c d4d4c2b349b43b7b861e6d2994299630fb79e07573ea6b61e28e8071b7d16b61
|
||||||
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f
|
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f
|
||||||
F ext/wasm/api/sqlite3-worker1.c-pp.js da509469755035e919c015deea41b4514b5e84c12a1332e6cc8d42cb2cc1fb75
|
F ext/wasm/api/sqlite3-worker1.c-pp.js da509469755035e919c015deea41b4514b5e84c12a1332e6cc8d42cb2cc1fb75
|
||||||
@@ -2091,8 +2091,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 653ed92dc39185cdedfab3ea518bc7ec2d2826120e5fa4cbdee3343301396184
|
P 9b1398c96a4fd0b59e65faa8d5c98de4129f0f0357732f12cb2f5c53a08acdc2
|
||||||
R 6b40a7c1cd4b822a33b7a897821b1648
|
R db128ff4a61eed058302d85bb5b8cb1c
|
||||||
U stephan
|
U stephan
|
||||||
Z b0064c5da7f02d0dcda913e568fa1924
|
Z 10bacbfa41c608cf282110ffda9bd8fa
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
@@ -1 +1 @@
|
|||||||
9b1398c96a4fd0b59e65faa8d5c98de4129f0f0357732f12cb2f5c53a08acdc2
|
a4eedd63b58f5c273b671f687cb68a32259963dbb053a710770383c735fb7f26
|
Reference in New Issue
Block a user