if(!Module.postRun) Module.postRun = [];
/* ^^^^ the name Module is, in this setup, scope-local in the generated
file sqlite3.js, with which this file gets combined at build-time. */
-Module.postRun.push(function(namespace){
+Module.postRun.push(function(namespace/*the module object, the target for
+ installed features*/){
'use strict';
/* For reference: sql.js does essentially everything we want and
it solves much of the wasm-related voodoo, but we'll need a
execMulti():
- .multi: if true, this function acts as a proxy for
- execMulti().
+ execMulti() and behaves identically to that function.
*/
exec: function(/*(sql [,optionsObj]) or (optionsObj)*/){
affirmDbOpen(this);
ACHTUNG #1: The callback MUST NOT modify the Stmt
object. Calling any of the Stmt.get() variants,
- Stmt.getColumnName(), or simililar, is legal, but calling
+ Stmt.getColumnName(), or similar, is legal, but calling
step() or finalize() is not. Routines which are illegal
in this context will trigger an exception.
ACHTUNG #2: The semantics of the `bind` and `callback`
options may well change or those options may be removed
altogether for this function (but retained for exec()).
+ Generally speaking, neither bind parameters nor a callback
+ are generically useful when executing multi-statement SQL.
*/
execMulti: function(/*(sql [,obj]) || (obj)*/){
affirmDbOpen(this);
DB,
Stmt,
/**
- Reports whether a given compile-time option, named by the
- given argument. It has several distinct uses:
+ Reports info about compile-time options. It has several
+ distinct uses:
If optName is an array then it is expected to be a list of
compilation options and this function returns an object
'string'===typeof optName
) ? !!api.sqlite3_compileoption_used(optName) : false;
}
- };
+ }/*SQLite3 object*/;
namespace.sqlite3 = {
api: api,
SQLite3
};
+
+ if(self === self.window){
+ /* This is running in the main window thread, so we're done. */
+ return;
+ }
+ /******************************************************************
+ End of main window thread. What follows is only intended for use
+ in Worker threads.
+ ******************************************************************/
+
+ /*
+ TODO: we need an API which can proxy the DB API via a Worker
+ message interface. The primary quirky factor in such an API is
+ that clients cannot pass callback functions to it, so have to receive
+ all query results via asynchronous message-passing.
+
+ Certain important considerations here include:
+
+ - Support only one db connectior or multiple? The former is far
+ easier, but there's always going to be a user out there who
+ wants to juggle six database handles at once.
+
+ - Fetching multiple results: do we pass them on as a series of
+ messages, with start/end messages on either end, or do we
+ collect all results and bundle them back in a single message?
+ The former is, generically speaking, more memory-efficient but
+ the latter far easier to implement in this environment.
+ */
+
+
+ setTimeout(()=>postMessage({type:'sqlite3-api',data:'loaded'}), 0);
});
--- /dev/null
+/*
+ 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.
+
+ ***********************************************************************
+
+ UNDER CONSTRUCTION
+
+ This is a JS Worker file for the main sqlite3 api. It loads
+ sqlite3.js and offers access to the db via the Worker
+ message-passing interface.
+*/
+
+"use strict";
+(function(){
+ /** Posts a worker message as {type:type, data:data}. */
+ const wMsg = (type,data)=>self.postMessage({type, data});
+ self.onmessage = function(ev){
+ /*ev = ev.data;
+ switch(ev.type){
+ default: break;
+ };*/
+ console.warn("Unknown sqlite3-worker message type:",ev);
+ };
+ importScripts('sqlite3.js');
+ initSqlite3Module().then(function(){
+ wMsg('sqlite3-api','ready');
+ });
+})();
***********************************************************************
- A basic test script for sqlite3-api.js.
+ A basic test script for sqlite3-api.js. This file must be run in
+ main JS thread and sqlite3.js must have been loaded before it.
*/
(function(){
const T = self.SqliteTestUtil;
--- /dev/null
+<!doctype html>
+<html lang="en-us">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
+ <link rel="stylesheet" href="emscripten.css"/>
+ <link rel="stylesheet" href="testing.css"/>
+ <title>sqlite3-worker.js tests</title>
+ <style></style>
+ </head>
+ <body>
+ <header id='titlebar'><span>sqlite3-worker.js tests</span></header>
+ <!-- emscripten bits -->
+ <figure id="module-spinner">
+ <div class="spinner"></div>
+ <div class='center'><strong>Initializing app...</strong></div>
+ <div class='center'>
+ On a slow internet connection this may take a moment. If this
+ message displays for "a long time", intialization may have
+ failed and the JavaScript console may contain clues as to why.
+ </div>
+ </figure>
+ <div class="emscripten" id="module-status">Downloading...</div>
+ <div class="emscripten">
+ <progress value="0" max="100" id="module-progress" hidden='1'></progress>
+ </div><!-- /emscripten bits -->
+ <div>Everything on this page happens in the dev console.</div>
+ <script src="testing-common.js"></script>
+ <script src="testing2.js"></script>
+ </body>
+</html>
--- /dev/null
+/*
+ 2022-05-22
+
+ 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.
+
+ ***********************************************************************
+
+ A basic test script for sqlite3-worker.js.
+*/
+(function(){
+ /** Posts a worker message as {type:type, data:data}. */
+ const SW = new Worker("sqlite3-worker.js");
+ const wMsg = (type,data)=>SW.postMessage({type, data});
+ const log = console.log.bind(console);
+ const warn = console.warn.bind(console);
+ SW.onmessage = function(ev){
+ if(!ev.data || 'object'!==typeof ev.data){
+ warn("Unknown sqlite3-worker message type:",ev);
+ return;
+ }
+ ev = ev.data/*expecting a nested object*/;
+ switch(ev.type){
+ case 'sqlite3-api':
+ switch(ev.data){
+ case 'loaded':
+ log("Message:",ev); return;
+ case 'ready':
+ log("Message:",ev);
+ self.sqlite3TestModule.setStatus(null);
+ return;
+ default: break;
+ }
+ break;
+ }
+ warn("Unknown sqlite3-api message type:",ev);
+ };
+ log("Init complete, but async bits may still be running.");
+})();
-C New\sFULL\sJOIN\stest\scases.\s\sNo\schanges\sto\scode.
-D 2022-05-31T18:18:09.648
+C Initial\sbits\sfor\sa\sJS\sAPI\svariant\sin\swhich\sthe\sclient\soperates\sin\sthe\smain\sthread\sand\ssqlite3\sin\sa\sWorker.\sThis\sis\sfar\sfrom\scomplete.
+D 2022-06-01T00:00:59.491
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F ext/fiddle/fiddle.html 724f1cd4126616bc87f5871f78d3f7aaaf41e45c9728724627baab87e6af35f0
F ext/fiddle/fiddle.js 5b456ed7085830cda2fc75a0801476174a978521949335f24bc4154d076dcd4d
F ext/fiddle/index.md d9c1c308d8074341bc3b11d1d39073cd77754cb3ca9aeb949f23fdd8323d81cf
-F ext/fiddle/sqlite3-api.js 8500698d2163f4a25f8e5e6810ad826487342579d6a321d82b244dbc8e6f6db6
+F ext/fiddle/sqlite3-api.js ff9580cf075c08bd124ad057079bd32fd121f1e122c8c40e3a836466c1fe1197
+F ext/fiddle/sqlite3-worker.js c137daed6529b5f527ed61eb358cb0d23f90e04784442479cd15ac684eccdf7a
F ext/fiddle/testing.css 750572dded671d2cf142bbcb27af5542522ac08db128245d0b9fe410aa1d7f2a
F ext/fiddle/testing1.html ea1f3be727f78e420007f823912c1a03b337ecbb8e79449abc2244ad4fe15d9a
-F ext/fiddle/testing1.js 94a7597955c8fdbd15839a70d9b8279bc690205dda65ff175f688f13bf315745
+F ext/fiddle/testing1.js e09c224da12b34bd90a1128d4a9cfc546ccca00074d00571977eb44746bf487d
+F ext/fiddle/testing2.html 9063b2430ade2fe9da4e711addd1b51a2741cf0c7ebf6926472a5e5dd63c0bc4
+F ext/fiddle/testing2.js 0382f20c6c5e1b2a034240a29d627f0e6ccb9c3be50d7dd1627b04ad5f92b787
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
F ext/fts1/ft_hash.h 06df7bba40dadd19597aa400a875dbc2fed705ea
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P f2d224c5fa06de70f6f22e159a3b7065d4c6b004f9accc13004b9ac1f2fd5549
-R 5689511af50987f5a7f98a74e3792280
-U drh
-Z cf62f2b6249a650ef9ed77273d324cc2
+P 13e89ef6649475815d3f4e4aef73a4be1157dd388e55c7f856faeb4b7387774b
+R 1d9b814402b0908178d5c21bd5502d71
+U stephan
+Z f7d167c241a574fa46d16e96c1270f84
# Remove this line to create a well-formed Fossil manifest.
-13e89ef6649475815d3f4e4aef73a4be1157dd388e55c7f856faeb4b7387774b
\ No newline at end of file
+f6d6f969791f0d2367ae5418623b4794f6df657d9d7d9002fb5aec4206dcfd4c
\ No newline at end of file