Vmeda.Online/patches/@sqlite.org+sqlite-wasm+3.4...

58 lines
2.4 KiB
Diff

diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs
index b86a0aa..1be2b82 100644
--- a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs
+++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs
@@ -533,7 +533,7 @@ var sqlite3InitModule = (() => {
wasmBinaryFile = locateFile(wasmBinaryFile);
}
} else {
- wasmBinaryFile = new URL('sqlite3.wasm', import.meta.url).href;
+ wasmBinaryFile = '/assets/lib/sqlite3/sqlite3.wasm';
}
function getBinary(file) {
@@ -10913,6 +10913,10 @@ var sqlite3InitModule = (() => {
}
},
+ lastInsertRowId: function () {
+ return capi.sqlite3_last_insert_rowid(affirmDbOpen(this).pointer);
+ },
+
dbFilename: function (dbName = 'main') {
return capi.sqlite3_db_filename(affirmDbOpen(this).pointer, dbName);
},
@@ -11877,12 +11881,14 @@ var sqlite3InitModule = (() => {
if (!hadColNames) rc.columnNames = [];
rc.callback = function (row, stmt) {
+ const rowId = rc.sql.includes('INSERT') ? db.lastInsertRowId() : undefined;
wState.post(
{
type: theCallback,
columnNames: rc.columnNames,
rowNumber: ++rowNumber,
row: row,
+ rowId,
},
wState.xfer,
);
@@ -12522,7 +12528,7 @@ var sqlite3InitModule = (() => {
return promiseResolve_(sqlite3);
};
const W = new Worker(
- new URL('sqlite3-opfs-async-proxy.js', import.meta.url),
+ '/assets/lib/sqlite3/sqlite3-opfs-async-proxy.js',
);
setTimeout(() => {
if (undefined === promiseWasRejected) {
@@ -13445,7 +13451,7 @@ var sqlite3InitModule = (() => {
});
return thePromise;
};
- installOpfsVfs.defaultProxyUri = 'sqlite3-opfs-async-proxy.js';
+ installOpfsVfs.defaultProxyUri = '/assets/lib/sqlite3/sqlite3-opfs-async-proxy.js';
globalThis.sqlite3ApiBootstrap.initializersAsync.push(
async (sqlite3) => {
try {