mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-11-23 19:06:15 +00:00
9ed72eb5ae
This merges the version-3.45.1 tag from upstream SQLite git repository to libSQL with the following conflicts resolved: Conflicts: README.md ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java libsql-sqlite3/configure libsql-sqlite3/doc/jsonb.md libsql-sqlite3/ext/fts5/test/fts5faultH.test libsql-sqlite3/ext/fts5/test/fts5origintext.test libsql-sqlite3/ext/fts5/test/fts5origintext2.test libsql-sqlite3/ext/fts5/test/fts5origintext3.test libsql-sqlite3/ext/fts5/test/fts5origintext4.test libsql-sqlite3/ext/fts5/test/fts5origintext5.test libsql-sqlite3/ext/fts5/test/fts5secure8.test libsql-sqlite3/ext/fts5/test/fts5tokenizer2.test libsql-sqlite3/ext/fts5/test/fts5trigram2.test libsql-sqlite3/ext/jni/src/org/sqlite/jni/annotation/Experimental.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/capi/ConfigSqlLogCallback.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java libsql-sqlite3/ext/wasm/GNUmakefile libsql-sqlite3/ext/wasm/batch-runner-sahpool.html libsql-sqlite3/ext/wasm/batch-runner-sahpool.js libsql-sqlite3/src/pager.c libsql-sqlite3/src/shell.c.in libsql-sqlite3/src/sqliteInt.h libsql-sqlite3/src/wal.c libsql-sqlite3/test/fts3integrity.test libsql-sqlite3/test/json/jsonb-q1.txt libsql-sqlite3/test/json106.test libsql-sqlite3/test/json107.test libsql-sqlite3/test/jsonb01.test libsql-sqlite3/test/mmapcorrupt.test libsql-sqlite3/test/releasetest_data.tcl libsql-sqlite3/test/shell9.test libsql-sqlite3/test/wapp.tcl libsql-sqlite3/test/wapptest.tcl
55 lines
2.0 KiB
JavaScript
55 lines
2.0 KiB
JavaScript
//#ifnot omit-oo1
|
|
/*
|
|
2022-05-23
|
|
|
|
The author disclaims copyright to this source code. In place of a
|
|
legal notice, here is a blessing:
|
|
|
|
* May you do good and not evil.
|
|
* May you find forgiveness for yourself and forgive others.
|
|
* May you share freely, never taking more than you give.
|
|
|
|
***********************************************************************
|
|
|
|
This is a JS Worker file for the main sqlite3 api. It loads
|
|
sqlite3.js, initializes the module, and postMessage()'s a message
|
|
after the module is initialized:
|
|
|
|
{type: 'sqlite3-api', result: 'worker1-ready'}
|
|
|
|
This seemingly superfluous level of indirection is necessary when
|
|
loading sqlite3.js via a Worker. Instantiating a worker with new
|
|
Worker("sqlite.js") will not (cannot) call sqlite3InitModule() to
|
|
initialize the module due to a timing/order-of-operations conflict
|
|
(and that symbol is not exported in a way that a Worker loading it
|
|
that way can see it). Thus JS code wanting to load the sqlite3
|
|
Worker-specific API needs to pass _this_ file (or equivalent) to the
|
|
Worker constructor and then listen for an event in the form shown
|
|
above in order to know when the module has completed initialization.
|
|
|
|
This file accepts a URL arguments to adjust how it loads sqlite3.js:
|
|
|
|
- `sqlite3.dir`, if set, treats the given directory name as the
|
|
directory from which `sqlite3.js` will be loaded.
|
|
*/
|
|
//#if target=es6-bundler-friendly
|
|
import {default as sqlite3InitModule} from './sqlite3-bundler-friendly.mjs';
|
|
//#else
|
|
"use strict";
|
|
{
|
|
const urlParams = globalThis.location
|
|
? new URL(globalThis.location.href).searchParams
|
|
: new URLSearchParams();
|
|
let theJs = 'sqlite3.js';
|
|
if(urlParams.has('sqlite3.dir')){
|
|
theJs = urlParams.get('sqlite3.dir') + '/' + theJs;
|
|
}
|
|
//console.warn("worker1 theJs =",theJs);
|
|
importScripts(theJs);
|
|
}
|
|
//#endif
|
|
sqlite3InitModule().then(sqlite3 => sqlite3.initWorker1API());
|
|
//#else
|
|
/* Built with the omit-oo1 flag. */
|
|
//#endif ifnot omit-oo1
|