mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Merge trunk enhancements into index-expr-opt branch.
FossilOrigin-Name: 56ef97e64efb84176df570819474901d492209ff80ce4355ff896dea9d2b8a51
This commit is contained in:
@@ -49,6 +49,7 @@ dir.fiddle := fiddle
|
|||||||
CLEAN_FILES := *~ $(dir.jacc)/*~ $(dir.api)/*~ $(dir.common)/*~
|
CLEAN_FILES := *~ $(dir.jacc)/*~ $(dir.api)/*~ $(dir.common)/*~
|
||||||
emcc_enable_bigint ?= 1
|
emcc_enable_bigint ?= 1
|
||||||
sqlite3.c := $(dir.top)/sqlite3.c
|
sqlite3.c := $(dir.top)/sqlite3.c
|
||||||
|
sqlite3.h := $(dir.top)/sqlite3.h
|
||||||
SQLITE_OPT = \
|
SQLITE_OPT = \
|
||||||
-DSQLITE_ENABLE_FTS4 \
|
-DSQLITE_ENABLE_FTS4 \
|
||||||
-DSQLITE_ENABLE_RTREE \
|
-DSQLITE_ENABLE_RTREE \
|
||||||
@@ -109,7 +110,7 @@ emcc_opt_full := $(emcc_opt) -g3
|
|||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
|
|
||||||
$(sqlite3.c):
|
$(sqlite3.c) $(sqlite3.h):
|
||||||
$(MAKE) -C $(dir.top) sqlite3.c
|
$(MAKE) -C $(dir.top) sqlite3.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@@ -124,16 +125,25 @@ else
|
|||||||
$(info Development build. Use '$(MAKE) release' for a smaller release build.)
|
$(info Development build. Use '$(MAKE) release' for a smaller release build.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
version-json: version-json.c $(sqlite3.c) $(MAKEFILE)
|
||||||
|
$(CC) -O0 -I$(dir.top) -o $@ $(SQLITE_OPT) -DHAVE_MREMAP=0 $< $(sqlite3.c)
|
||||||
|
CLEAN_FILES := version-json
|
||||||
|
|
||||||
EXPORTED_FUNCTIONS.api.in := $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api
|
EXPORTED_FUNCTIONS.api.in := $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api
|
||||||
|
|
||||||
EXPORTED_FUNCTIONS.api: $(EXPORTED_FUNCTIONS.api.in) $(MAKEFILE)
|
EXPORTED_FUNCTIONS.api: $(EXPORTED_FUNCTIONS.api.in) $(MAKEFILE)
|
||||||
cat $(EXPORTED_FUNCTIONS.api.in) > $@
|
cat $(EXPORTED_FUNCTIONS.api.in) > $@
|
||||||
CLEAN_FILES += EXPORTED_FUNCTIONS.api
|
CLEAN_FILES += EXPORTED_FUNCTIONS.api
|
||||||
|
|
||||||
sqlite3-api.jses := $(dir.api)/sqlite3-api-prologue.js
|
sqlite3-license-version.js := sqlite3-license-version.js
|
||||||
|
sqlite3-license-version-header.js := $(dir.api)/sqlite3-license-version-header.js
|
||||||
|
sqlite3-api-build-version.js := $(dir.api)/sqlite3-api-build-version.js
|
||||||
|
sqlite3-api.jses := $(sqlite3-license-version.js)
|
||||||
|
sqlite3-api.jses += $(dir.api)/sqlite3-api-prologue.js
|
||||||
sqlite3-api.jses += $(dir.common)/whwasmutil.js
|
sqlite3-api.jses += $(dir.common)/whwasmutil.js
|
||||||
sqlite3-api.jses += $(dir.jacc)/jaccwabyt.js
|
sqlite3-api.jses += $(dir.jacc)/jaccwabyt.js
|
||||||
sqlite3-api.jses += $(dir.api)/sqlite3-api-glue.js
|
sqlite3-api.jses += $(dir.api)/sqlite3-api-glue.js
|
||||||
|
sqlite3-api.jses += $(sqlite3-api-build-version.js)
|
||||||
sqlite3-api.jses += $(dir.api)/sqlite3-api-oo1.js
|
sqlite3-api.jses += $(dir.api)/sqlite3-api-oo1.js
|
||||||
sqlite3-api.jses += $(dir.api)/sqlite3-api-worker1.js
|
sqlite3-api.jses += $(dir.api)/sqlite3-api-worker1.js
|
||||||
sqlite3-api.jses += $(dir.api)/sqlite3-api-opfs.js
|
sqlite3-api.jses += $(dir.api)/sqlite3-api-opfs.js
|
||||||
@@ -141,6 +151,8 @@ sqlite3-api.jses += $(dir.api)/sqlite3-api-cleanup.js
|
|||||||
|
|
||||||
sqlite3-api.js := sqlite3-api.js
|
sqlite3-api.js := sqlite3-api.js
|
||||||
CLEAN_FILES += $(sqlite3-api.js)
|
CLEAN_FILES += $(sqlite3-api.js)
|
||||||
|
CLEAN_FILES += $(sqlite3-license-version.js)
|
||||||
|
CLEAN_FILES += $(sqlite3-api-build-version.js)
|
||||||
$(sqlite3-api.js): $(sqlite3-api.jses) $(MAKEFILE)
|
$(sqlite3-api.js): $(sqlite3-api.jses) $(MAKEFILE)
|
||||||
@echo "Making $@..."
|
@echo "Making $@..."
|
||||||
@for i in $(sqlite3-api.jses); do \
|
@for i in $(sqlite3-api.jses); do \
|
||||||
@@ -149,6 +161,16 @@ $(sqlite3-api.js): $(sqlite3-api.jses) $(MAKEFILE)
|
|||||||
echo "/* END FILE: $$i */"; \
|
echo "/* END FILE: $$i */"; \
|
||||||
done > $@
|
done > $@
|
||||||
|
|
||||||
|
$(sqlite3-api-build-version.js): version-json
|
||||||
|
@echo "Making $@..."
|
||||||
|
@{ \
|
||||||
|
echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \
|
||||||
|
echo -n ' sqlite3.version = '; \
|
||||||
|
./version-json; \
|
||||||
|
echo ';'; \
|
||||||
|
echo '});'; \
|
||||||
|
} > $@
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# --post-js and --pre-js are emcc flags we use to append/prepend JS to
|
# --post-js and --pre-js are emcc flags we use to append/prepend JS to
|
||||||
# the generated emscripten module file.
|
# the generated emscripten module file.
|
||||||
@@ -171,9 +193,20 @@ extern-pre-js.js := $(dir.api)/extern-pre-js.js
|
|||||||
pre-post-common.flags := \
|
pre-post-common.flags := \
|
||||||
--post-js=$(post-js.js) \
|
--post-js=$(post-js.js) \
|
||||||
--extern-post-js=$(extern-post-js.js) \
|
--extern-post-js=$(extern-post-js.js) \
|
||||||
--extern-pre-js=$(extern-pre-js.js)
|
--extern-pre-js=$(dir.wasm)/$(sqlite3-license-version.js)
|
||||||
pre-post-jses.deps := $(post-js.js) \
|
pre-post-jses.deps := $(post-js.js) \
|
||||||
$(extern-post-js.js) $(extern-pre-js.js)
|
$(extern-post-js.js) $(extern-pre-js.js) $(sqlite3-license-version.js)
|
||||||
|
$(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) $(MAKEFILE)
|
||||||
|
@echo "Making $@..."; { \
|
||||||
|
cat $(sqlite3-license-version-header.js); \
|
||||||
|
echo '/*'; \
|
||||||
|
echo '** This code was built from sqlite3 version...'; \
|
||||||
|
echo "** "; \
|
||||||
|
awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \
|
||||||
|
-e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \
|
||||||
|
echo '*/'; \
|
||||||
|
} > $@
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# call-make-pre-js creates rules for pre-js-$(1).js. $1 = the base
|
# call-make-pre-js creates rules for pre-js-$(1).js. $1 = the base
|
||||||
# name of the JS file on whose behalf this pre-js is for.
|
# name of the JS file on whose behalf this pre-js is for.
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ browser client:
|
|||||||
Invokes functionality exposed by the previous two files to
|
Invokes functionality exposed by the previous two files to
|
||||||
flesh out low-level parts of `sqlite3-api-prologue.js`. Most of
|
flesh out low-level parts of `sqlite3-api-prologue.js`. Most of
|
||||||
these pieces related to the `sqlite3.capi.wasm` object.
|
these pieces related to the `sqlite3.capi.wasm` object.
|
||||||
|
- `sqlite3-api-build-version.js`\
|
||||||
|
Gets created by the build process and populates the
|
||||||
|
`sqlite3.version` object. This part is not critical, but records the
|
||||||
|
version of the library against which this module was built.
|
||||||
- `sqlite3-api-oo1.js`\
|
- `sqlite3-api-oo1.js`\
|
||||||
Provides a high-level object-oriented wrapper to the lower-level C
|
Provides a high-level object-oriented wrapper to the lower-level C
|
||||||
API, colloquially known as OO API #1. Its API is similar to other
|
API, colloquially known as OO API #1. Its API is similar to other
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/* extern-post-js.js must be appended to the resulting sqlite3.js
|
/* extern-post-js.js must be appended to the resulting sqlite3.js
|
||||||
file. */
|
file. It gets its name from being used as the value for
|
||||||
|
the --extern-post-js=... Emscripten flag. */
|
||||||
(function(){
|
(function(){
|
||||||
/**
|
/**
|
||||||
In order to hide the sqlite3InitModule()'s resulting Emscripten
|
In order to hide the sqlite3InitModule()'s resulting Emscripten
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
/* extern-pre-js.js must be prepended to the resulting sqlite3.js
|
/* extern-pre-js.js must be prepended to the resulting sqlite3.js
|
||||||
file. This file is currently only used for holding snippets during
|
file. This file is currently only used for holding snippets during
|
||||||
test and development.
|
test and development.
|
||||||
|
|
||||||
|
It gets its name from being used as the value for the
|
||||||
|
--extern-pre-js=... Emscripten flag.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
/* The current function scope was opened via post-js-header.js, which
|
/* The current function scope was opened via post-js-header.js, which
|
||||||
gets prepended to this at build-time. */
|
gets prepended to this at build-time. This file closes that
|
||||||
|
scope. */
|
||||||
})/*postRun.push(...)*/;
|
})/*postRun.push(...)*/;
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
BEGIN FILE: api/pre-js.js
|
||||||
|
|
||||||
|
This file is intended to be prepended to the sqlite3.js build using
|
||||||
|
Emscripten's --pre-js=THIS_FILE flag (or equivalent).
|
||||||
|
*/
|
||||||
Module['locateFile'] = function(path, prefix) {
|
Module['locateFile'] = function(path, prefix) {
|
||||||
return prefix + path;
|
return prefix + path;
|
||||||
};
|
};
|
||||||
@@ -39,3 +45,4 @@ Module[xInstantiateWasm] = function callee(imports,onSuccess){
|
|||||||
scripts.
|
scripts.
|
||||||
*/
|
*/
|
||||||
Module[xInstantiateWasm].uri = 'sqlite3.wasm';
|
Module[xInstantiateWasm].uri = 'sqlite3.wasm';
|
||||||
|
/* END FILE: api/pre-js.js */
|
||||||
|
|||||||
@@ -20,17 +20,15 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build
|
|||||||
/**
|
/**
|
||||||
Install a suitable default configuration for sqlite3ApiBootstrap().
|
Install a suitable default configuration for sqlite3ApiBootstrap().
|
||||||
*/
|
*/
|
||||||
const SABC = self.sqlite3ApiConfig || Object.create(null);
|
const SABC = Object.assign(
|
||||||
if(undefined===SABC.Module){
|
Object.create(null), {
|
||||||
SABC.Module = Module /* ==> Currently needs to be exposed here for
|
Module: Module /* ==> Currently needs to be exposed here for
|
||||||
test code. NOT part of the public API. */;
|
test code. NOT part of the public API. */,
|
||||||
}
|
exports: Module['asm'],
|
||||||
if(undefined===SABC.exports){
|
memory: Module.wasmMemory /* gets set if built with -sIMPORT_MEMORY */
|
||||||
SABC.exports = Module['asm'];
|
},
|
||||||
}
|
self.sqlite3ApiConfig || Object.create(null)
|
||||||
if(undefined===SABC.memory){
|
);
|
||||||
SABC.memory = Module.wasmMemory /* gets set if built with -sIMPORT_MEMORY */;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
For current (2022-08-22) purposes, automatically call
|
For current (2022-08-22) purposes, automatically call
|
||||||
@@ -38,10 +36,11 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build
|
|||||||
point, as we really want client code to be able to call this to
|
point, as we really want client code to be able to call this to
|
||||||
configure certain parts. Clients may modify
|
configure certain parts. Clients may modify
|
||||||
self.sqlite3ApiBootstrap.defaultConfig to tweak the default
|
self.sqlite3ApiBootstrap.defaultConfig to tweak the default
|
||||||
configuration used by a no-args call to sqlite3ApiBootstrap().
|
configuration used by a no-args call to sqlite3ApiBootstrap(),
|
||||||
|
but must have first loaded their WASM module in order to be
|
||||||
|
able to provide the necessary configuration state.
|
||||||
*/
|
*/
|
||||||
//console.warn("self.sqlite3ApiConfig = ",self.sqlite3ApiConfig);
|
//console.warn("self.sqlite3ApiConfig = ",self.sqlite3ApiConfig);
|
||||||
const rmApiConfig = (SABC !== self.sqlite3ApiConfig);
|
|
||||||
self.sqlite3ApiConfig = SABC;
|
self.sqlite3ApiConfig = SABC;
|
||||||
let sqlite3;
|
let sqlite3;
|
||||||
try{
|
try{
|
||||||
@@ -51,7 +50,7 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build
|
|||||||
throw e;
|
throw e;
|
||||||
}finally{
|
}finally{
|
||||||
delete self.sqlite3ApiBootstrap;
|
delete self.sqlite3ApiBootstrap;
|
||||||
if(rmApiConfig) delete self.sqlite3ApiConfig;
|
delete self.sqlite3ApiConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(self.location && +self.location.port > 1024){
|
if(self.location && +self.location.port > 1024){
|
||||||
|
|||||||
@@ -688,9 +688,4 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
}
|
}
|
||||||
}/*kvvfs*/
|
}/*kvvfs*/
|
||||||
|
|
||||||
sqlite3.version = Object.assign(Object.create(null),{
|
|
||||||
library: sqlite3.capi.sqlite3_libversion(),
|
|
||||||
sourceId: sqlite3.capi.sqlite3_sourceid()
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,10 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
|
|
||||||
/** If object opts has _its own_ property named p then that
|
/** If object opts has _its own_ property named p then that
|
||||||
property's value is returned, else dflt is returned. */
|
property's value is returned, else dflt is returned. */
|
||||||
const getOwnOption = (opts, p, dflt)=>
|
const getOwnOption = (opts, p, dflt)=>{
|
||||||
opts.hasOwnProperty(p) ? opts[p] : dflt;
|
const d = Object.getOwnPropertyDescriptor(opts,p);
|
||||||
|
return d ? d.value : dflt;
|
||||||
|
};
|
||||||
|
|
||||||
// Documented in DB.checkRc()
|
// Documented in DB.checkRc()
|
||||||
const checkSqlite3Rc = function(dbPtr, sqliteResultCode){
|
const checkSqlite3Rc = function(dbPtr, sqliteResultCode){
|
||||||
@@ -810,12 +812,14 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
`xFunc` to align with the C API documentation). In the final
|
`xFunc` to align with the C API documentation). In the final
|
||||||
case, the function's name must be the 'name' property.
|
case, the function's name must be the 'name' property.
|
||||||
|
|
||||||
This can currently only be used to create scalar functions, not
|
The first two call forms can only be used for creating scalar
|
||||||
aggregate or window functions (requires only a bit of
|
functions. Creating an aggregate function requires the
|
||||||
refactoring to support aggregates and window functions).
|
options-object form (see below for details).
|
||||||
|
|
||||||
UDFs cannot currently be removed from a DB handle after they're
|
UDFs cannot currently be removed from a DB handle after they're
|
||||||
added.
|
added. More correctly, they can be removed as documented for
|
||||||
|
sqlite3_create_function_v2(), but doing so will "leak" the
|
||||||
|
JS-created WASM binding of those functions.
|
||||||
|
|
||||||
On success, returns this object. Throws on error.
|
On success, returns this object. Throws on error.
|
||||||
|
|
||||||
@@ -825,18 +829,35 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
cannot be determined. The docs for sqlite3_create_function_v2()
|
cannot be determined. The docs for sqlite3_create_function_v2()
|
||||||
describe the conversions in more detail.
|
describe the conversions in more detail.
|
||||||
|
|
||||||
|
The values set in the options object differ for scalar and
|
||||||
|
aggregate functions:
|
||||||
|
|
||||||
|
- Scalar: set the `xFunc` function-type property to the UDF
|
||||||
|
function.
|
||||||
|
|
||||||
|
- Aggregate: set the `xStep` and `xFinal` function-type
|
||||||
|
properties to the "step" and "final" callbacks for the
|
||||||
|
aggregate. Do not set the `xFunc` property.
|
||||||
|
|
||||||
|
The options object may optionally have an `xDestroy`
|
||||||
|
function-type property, as per
|
||||||
|
sqlite3_create_function_v2(). Its argument will be the
|
||||||
|
WASM-pointer-type value of the `pApp` property, and this
|
||||||
|
function will throw if `pApp` is defined but is not null,
|
||||||
|
undefined, or a numeric (WASM pointer) value.
|
||||||
|
|
||||||
The optional options object may contain flags to modify how
|
The optional options object may contain flags to modify how
|
||||||
the function is defined:
|
the function is defined:
|
||||||
|
|
||||||
- .arity: the number of arguments which SQL calls to this
|
- `arity`: the number of arguments which SQL calls to this
|
||||||
function expect or require. The default value is
|
function expect or require. The default value is `xFunc.length`
|
||||||
`callback.length` (i.e. the number of declared parameters it
|
or `xStep.length` (i.e. the number of declared parameters it
|
||||||
has) **MINUS 1** (see below for why). As a special case, if
|
has) **MINUS 1** (see below for why). As a special case, if the
|
||||||
callback.length is 0, its arity is also 0 instead of -1. A
|
`length` is 0, its arity is also 0 instead of -1. A negative
|
||||||
negative arity value means that the function is variadic and
|
arity value means that the function is variadic and may accept
|
||||||
may accept any number of arguments, up to sqlite3's
|
any number of arguments, up to sqlite3's compile-time
|
||||||
compile-time limits. sqlite3 will enforce the argument count if
|
limits. sqlite3 will enforce the argument count if is zero or
|
||||||
is zero or greater.
|
greater.
|
||||||
|
|
||||||
The callback always receives a pointer to an `sqlite3_context`
|
The callback always receives a pointer to an `sqlite3_context`
|
||||||
object as its first argument. Any arguments after that are from
|
object as its first argument. Any arguments after that are from
|
||||||
@@ -852,44 +873,71 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
- .deterministic = SQLITE_DETERMINISTIC
|
- .deterministic = SQLITE_DETERMINISTIC
|
||||||
- .directOnly = SQLITE_DIRECTONLY
|
- .directOnly = SQLITE_DIRECTONLY
|
||||||
- .innocuous = SQLITE_INNOCUOUS
|
- .innocuous = SQLITE_INNOCUOUS
|
||||||
|
|
||||||
TODO: for the (optionsObject) form, accept callbacks for
|
|
||||||
aggregate and window functions.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
createFunction: function f(name, callback, opt){
|
createFunction: function f(name, xFunc, opt){
|
||||||
|
let xStep, xFinal;
|
||||||
|
const isFunc = (f)=>(f instanceof Function);
|
||||||
switch(arguments.length){
|
switch(arguments.length){
|
||||||
case 1: /* (optionsObject) */
|
case 1: /* (optionsObject) */
|
||||||
opt = name;
|
opt = name;
|
||||||
name = opt.name;
|
name = opt.name;
|
||||||
callback = opt.xFunc || opt.callback;
|
xFunc = opt.xFunc;
|
||||||
break;
|
break;
|
||||||
case 2: /* (name, callback|optionsObject) */
|
case 2: /* (name, callback|optionsObject) */
|
||||||
if(!(callback instanceof Function)){
|
if(!isFunc(xFunc)){
|
||||||
opt = callback;
|
opt = xFunc;
|
||||||
callback = opt.xFunc || opt.callback;
|
xFunc = opt.xFunc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 3: /* name, xFunc, opt */
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
if(!opt) opt = {};
|
if(!opt) opt = {};
|
||||||
if(!(callback instanceof Function)){
|
if('string' !== typeof name){
|
||||||
toss3("Invalid arguments: expecting a callback function.");
|
|
||||||
}else if('string' !== typeof name){
|
|
||||||
toss3("Invalid arguments: missing function name.");
|
toss3("Invalid arguments: missing function name.");
|
||||||
}
|
}
|
||||||
|
xStep = opt.xStep;
|
||||||
|
xFinal = opt.xFinal;
|
||||||
|
if(isFunc(xFunc)){
|
||||||
|
if(isFunc(xStep) || isFunc(xFinal)){
|
||||||
|
toss3("Ambiguous arguments: scalar or aggregate?");
|
||||||
|
}
|
||||||
|
xStep = xFinal = null;
|
||||||
|
}else if(isFunc(xStep)){
|
||||||
|
if(!isFunc(xFinal)){
|
||||||
|
toss3("Missing xFinal() callback for aggregate UDF.");
|
||||||
|
}
|
||||||
|
xFunc = null;
|
||||||
|
}else if(isFunc(xFinal)){
|
||||||
|
toss3("Missing xStep() callback for aggregate UDF.");
|
||||||
|
}else{
|
||||||
|
toss3("Missing function-type properties.");
|
||||||
|
}
|
||||||
|
const pApp = opt.pApp;
|
||||||
|
if(undefined!==pApp &&
|
||||||
|
null!==pApp &&
|
||||||
|
(('number'!==typeof pApp) || !capi.util.isInt32(pApp))){
|
||||||
|
toss3("Invalid value for pApp property. Must be a legal WASM pointer value.");
|
||||||
|
}
|
||||||
|
const xDestroy = opt.xDestroy;
|
||||||
|
if(xDestroy && !isFunc(xDestroy)){
|
||||||
|
toss3("xDestroy property must be a function.");
|
||||||
|
}
|
||||||
let fFlags = 0 /*flags for sqlite3_create_function_v2()*/;
|
let fFlags = 0 /*flags for sqlite3_create_function_v2()*/;
|
||||||
if(getOwnOption(opt, 'deterministic')) fFlags |= capi.SQLITE_DETERMINISTIC;
|
if(getOwnOption(opt, 'deterministic')) fFlags |= capi.SQLITE_DETERMINISTIC;
|
||||||
if(getOwnOption(opt, 'directOnly')) fFlags |= capi.SQLITE_DIRECTONLY;
|
if(getOwnOption(opt, 'directOnly')) fFlags |= capi.SQLITE_DIRECTONLY;
|
||||||
if(getOwnOption(opt, 'innocuous')) fFlags |= capi.SQLITE_INNOCUOUS;
|
if(getOwnOption(opt, 'innocuous')) fFlags |= capi.SQLITE_INNOCUOUS;
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase();
|
||||||
|
const xArity = xFunc || xStep;
|
||||||
|
const arity = getOwnOption(opt, 'arity');
|
||||||
DB.checkRc(this, capi.sqlite3_create_function_v2(
|
DB.checkRc(this, capi.sqlite3_create_function_v2(
|
||||||
this.pointer, name,
|
this.pointer, name,
|
||||||
(opt.hasOwnProperty('arity')
|
('number'===typeof arity
|
||||||
? +opt.arity
|
? arity
|
||||||
: (callback.length ? callback.length-1/*for pCtx arg*/ : 0)),
|
: (xArity.length ? xArity.length-1/*for pCtx arg*/ : 0)),
|
||||||
capi.SQLITE_UTF8 | fFlags, null/*pApp*/, callback,
|
capi.SQLITE_UTF8 | fFlags, pApp,
|
||||||
null/*xStep*/, null/*xFinal*/, null/*xDestroy*/));
|
xFunc, xStep, xFinal, xDestroy));
|
||||||
return this;
|
return this;
|
||||||
}/*createFunction()*/,
|
}/*createFunction()*/,
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1281,6 +1281,17 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
|||||||
SQLite3Error: SQLite3Error,
|
SQLite3Error: SQLite3Error,
|
||||||
capi,
|
capi,
|
||||||
config,
|
config,
|
||||||
|
/**
|
||||||
|
Holds the version info of the sqlite3 source tree from which
|
||||||
|
the generated sqlite3-api.js gets built. Note that its version
|
||||||
|
may well differ from that reported by sqlite3_libversion(), but
|
||||||
|
that should be considered a source file mismatch, as the JS and
|
||||||
|
WASM files are intended to be built and distributed together.
|
||||||
|
|
||||||
|
This object is initially a placeholder which gets replaced by a
|
||||||
|
build-generated object.
|
||||||
|
*/
|
||||||
|
version: Object.create(null),
|
||||||
/**
|
/**
|
||||||
Performs any optional asynchronous library-level initialization
|
Performs any optional asynchronous library-level initialization
|
||||||
which might be required. This function returns a Promise which
|
which might be required. This function returns a Promise which
|
||||||
|
|||||||
25
ext/wasm/api/sqlite3-license-version-header.js
Normal file
25
ext/wasm/api/sqlite3-license-version-header.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
** LICENSE for the sqlite3 WebAssembly/JavaScript APIs.
|
||||||
|
**
|
||||||
|
** This bundle (typically released as sqlite3.js or sqlite3-wasmfs.js)
|
||||||
|
** is an amalgamation of JavaScript source code from two projects:
|
||||||
|
**
|
||||||
|
** 1) https://emscripten.org: the Emscripten "glue code" is covered by
|
||||||
|
** the terms of the MIT license and University of Illinois/NCSA
|
||||||
|
** Open Source License, as described at:
|
||||||
|
**
|
||||||
|
** https://emscripten.org/docs/introducing_emscripten/emscripten_license.html
|
||||||
|
**
|
||||||
|
** 2) https://sqlite.org: all code and documentation labeled as being
|
||||||
|
** from this source are released under the same terms as the sqlite3
|
||||||
|
** C library:
|
||||||
|
**
|
||||||
|
** 2022-10-16
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
*/
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
log("Create a scalar UDF...");
|
log("Create a scalar UDF...");
|
||||||
db.createFunction({
|
db.createFunction({
|
||||||
name: 'twice',
|
name: 'twice',
|
||||||
callback: function(pCx, arg){ // note the call arg count
|
xFunc: function(pCx, arg){ // note the call arg count
|
||||||
return arg + arg;
|
return arg + arg;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
<li><a href='tester1.html'>tester1</a>: Core unit and
|
<li><a href='tester1.html'>tester1</a>: Core unit and
|
||||||
regression tests for the various APIs and surrounding
|
regression tests for the various APIs and surrounding
|
||||||
utility code.</li>
|
utility code.</li>
|
||||||
<li><a href='tester1.html'>tester1-worker</a>: same thing
|
<li><a href='tester1-worker.html'>tester1-worker</a>: same thing
|
||||||
but running in a Worker.</li>
|
but running in a Worker.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@@ -87,12 +87,11 @@
|
|||||||
worker due to an Emscripten limitation.</li>
|
worker due to an Emscripten limitation.</li>
|
||||||
<li><a href='test-opfs-vfs.html'>test-opfs-vfs</a>
|
<li><a href='test-opfs-vfs.html'>test-opfs-vfs</a>
|
||||||
(<a href='test-opfs-vfs.html?opfs-sanity-check&opfs-verbose'>same
|
(<a href='test-opfs-vfs.html?opfs-sanity-check&opfs-verbose'>same
|
||||||
with verbose output and sanity-checking tests</a>) is an
|
with verbose output and sanity-checking tests</a>) is an
|
||||||
experiment in implementing a syncronous sqlite3 VFS proxy
|
sqlite3_vfs OPFS proxy using SharedArrayBuffer and the
|
||||||
for a fully asynchronous backend interface (namely OPFS),
|
Atomics APIs to regulate communication between the
|
||||||
using SharedArrayBuffer and the Atomics APIs to regulate
|
synchronous sqlite3_vfs interface and the async OPFS
|
||||||
communication between the synchronous interface and the
|
impl.
|
||||||
async impl.
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -696,10 +696,10 @@
|
|||||||
if(autoResolvePtr){
|
if(autoResolvePtr){
|
||||||
wts.$ppV = 0;
|
wts.$ppV = 0;
|
||||||
T.assert(!wts.$ppV);
|
T.assert(!wts.$ppV);
|
||||||
WTStruct.debugFlags(0x03);
|
//WTStruct.debugFlags(0x03);
|
||||||
wts.$ppV = wts;
|
wts.$ppV = wts;
|
||||||
T.assert(wts === wts.$ppV)
|
T.assert(wts === wts.$ppV)
|
||||||
WTStruct.debugFlags(0);
|
//WTStruct.debugFlags(0);
|
||||||
}
|
}
|
||||||
wts.setMemberCString('cstr', "A C-string.");
|
wts.setMemberCString('cstr', "A C-string.");
|
||||||
T.assert(Array.isArray(wts.ondispose)).
|
T.assert(Array.isArray(wts.ondispose)).
|
||||||
@@ -1022,7 +1022,7 @@
|
|||||||
;/*end of C/WASM utils checks*/
|
;/*end of C/WASM utils checks*/
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
T.g('sqlite3.oo1 sanity checks')
|
T.g('sqlite3.oo1')
|
||||||
.t('Create db', function(sqlite3){
|
.t('Create db', function(sqlite3){
|
||||||
const db = this.db = new sqlite3.oo1.DB();
|
const db = this.db = new sqlite3.oo1.DB();
|
||||||
T.assert(Number.isInteger(db.pointer)).
|
T.assert(Number.isInteger(db.pointer)).
|
||||||
@@ -1037,8 +1037,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
.t('DB.Stmt sanity checks', function(S){
|
.t('DB.Stmt', function(S){
|
||||||
let pId;
|
|
||||||
let st = this.db.prepare(
|
let st = this.db.prepare(
|
||||||
new TextEncoder('utf-8').encode("select 3 as a")
|
new TextEncoder('utf-8').encode("select 3 as a")
|
||||||
);
|
);
|
||||||
@@ -1073,7 +1072,6 @@
|
|||||||
.assert(false===st.step())
|
.assert(false===st.step())
|
||||||
.assert(!st._mayGet)
|
.assert(!st._mayGet)
|
||||||
;
|
;
|
||||||
pId = st.pointer;
|
|
||||||
T.assert(0===capi.sqlite3_strglob("*.txt", "foo.txt")).
|
T.assert(0===capi.sqlite3_strglob("*.txt", "foo.txt")).
|
||||||
assert(0!==capi.sqlite3_strglob("*.txt", "foo.xtx")).
|
assert(0!==capi.sqlite3_strglob("*.txt", "foo.xtx")).
|
||||||
assert(0===capi.sqlite3_strlike("%.txt", "foo.txt", 0)).
|
assert(0===capi.sqlite3_strlike("%.txt", "foo.txt", 0)).
|
||||||
@@ -1181,14 +1179,14 @@
|
|||||||
assert(5===db.selectValue("select foo($a,$b)",{$a:0,$b:5}));
|
assert(5===db.selectValue("select foo($a,$b)",{$a:0,$b:5}));
|
||||||
db.createFunction("bar", {
|
db.createFunction("bar", {
|
||||||
arity: -1,
|
arity: -1,
|
||||||
callback: function(pCx){
|
xFunc: (pCx,...args)=>{
|
||||||
var rc = 0;
|
let rc = 0;
|
||||||
for(let i = 1; i < arguments.length; ++i) rc += arguments[i];
|
for(const v of args) rc += v;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}).createFunction({
|
}).createFunction({
|
||||||
name: "asis",
|
name: "asis",
|
||||||
callback: (pCx,arg)=>arg
|
xFunc: (pCx,arg)=>arg
|
||||||
});
|
});
|
||||||
T.assert(0===db.selectValue("select bar()")).
|
T.assert(0===db.selectValue("select bar()")).
|
||||||
assert(1===db.selectValue("select bar(1)")).
|
assert(1===db.selectValue("select bar(1)")).
|
||||||
@@ -1227,9 +1225,64 @@
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
.t({
|
.t({
|
||||||
name: 'Aggregate UDFs (tests are TODO)',
|
name: 'Aggregate UDFs',
|
||||||
predicate: testIsTodo
|
test: function(sqlite3){
|
||||||
})
|
const db = this.db;
|
||||||
|
const aggState = {summer: 0, summerN: 0};
|
||||||
|
db.createFunction({
|
||||||
|
name: 'summer',
|
||||||
|
xStep: function(pCtx, n){
|
||||||
|
aggState.summer += n;
|
||||||
|
},
|
||||||
|
xFinal: function(pCtx){
|
||||||
|
const rc = aggState.summer;
|
||||||
|
aggState.summer = 0;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let v = db.selectValue([
|
||||||
|
"with cte(v) as (",
|
||||||
|
"select 3 union all select 5 union all select 7",
|
||||||
|
") select summer(v) from cte"
|
||||||
|
]);
|
||||||
|
T.assert(15===v);
|
||||||
|
T.mustThrowMatching(()=>db.selectValue("select summer(1,2)"),
|
||||||
|
/wrong number of arguments/);
|
||||||
|
db.createFunction({
|
||||||
|
name: 'summerN',
|
||||||
|
arity: -1,
|
||||||
|
xStep: function(pCtx, ...args){
|
||||||
|
for(const v of args) aggState.summerN += v;
|
||||||
|
},
|
||||||
|
xFinal: function(pCtx){
|
||||||
|
const rc = aggState.summerN;
|
||||||
|
aggState.summerN = 0;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
T.assert(18===db.selectValue('select summerN(1,8,9)'));
|
||||||
|
T.mustThrowMatching(()=>{
|
||||||
|
db.createFunction('nope',{
|
||||||
|
xFunc: ()=>{}, xStep: ()=>{}
|
||||||
|
});
|
||||||
|
}, /scalar or aggregate\?/);
|
||||||
|
T.mustThrowMatching(()=>{
|
||||||
|
db.createFunction('nope',{xStep: ()=>{}});
|
||||||
|
}, /Missing xFinal/);
|
||||||
|
T.mustThrowMatching(()=>{
|
||||||
|
db.createFunction('nope',{xFinal: ()=>{}});
|
||||||
|
}, /Missing xStep/);
|
||||||
|
T.mustThrowMatching(()=>{
|
||||||
|
db.createFunction('nope',{});
|
||||||
|
}, /Missing function-type properties/);
|
||||||
|
T.mustThrowMatching(()=>{
|
||||||
|
db.createFunction('nope',{xFunc:()=>{}, xDestroy:'nope'});
|
||||||
|
}, /xDestroy property must be a function/);
|
||||||
|
T.mustThrowMatching(()=>{
|
||||||
|
db.createFunction('nope',{xFunc:()=>{}, pApp:'nope'});
|
||||||
|
}, /Invalid value for pApp/);
|
||||||
|
}
|
||||||
|
}/*aggregate UDFs*/)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
.t({
|
.t({
|
||||||
|
|||||||
26
ext/wasm/version-json.c
Normal file
26
ext/wasm/version-json.c
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
** 2022-10-16
|
||||||
|
**
|
||||||
|
** 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 file simply outputs sqlite3 version information in JSON form,
|
||||||
|
** intended for embedding in the sqlite3 JS API build.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "sqlite3.h"
|
||||||
|
int main(int argc, char const * const * argv){
|
||||||
|
if(argc || argv){/*unused*/}
|
||||||
|
printf("{\"libVersion\": \"%s\", "
|
||||||
|
"\"libVersionNumber\": %d, "
|
||||||
|
"\"sourceId\": \"%s\"}"/*missing newline is intentional*/,
|
||||||
|
SQLITE_VERSION,
|
||||||
|
SQLITE_VERSION_NUMBER,
|
||||||
|
SQLITE_SOURCE_ID);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
44
manifest
44
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Enable\sthe\sindex-on-expression\soptimization\seven\swhen\sthe\sexpression\sis\nused\sas\san\sargument\sto\san\saggregate\sfunction.
|
C Merge\strunk\senhancements\sinto\sindex-expr-opt\sbranch.
|
||||||
D 2022-10-15T12:01:40.334
|
D 2022-10-17T14:29:04.031
|
||||||
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
|
||||||
@@ -473,22 +473,23 @@ F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
|
|||||||
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
|
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
|
||||||
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
|
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
|
||||||
F ext/wasm/EXPORTED_RUNTIME_METHODS.fiddle 0e88c8cfc3719e4b7e74980d9da664c709e68acf863e48386cda376edfd3bfb0
|
F ext/wasm/EXPORTED_RUNTIME_METHODS.fiddle 0e88c8cfc3719e4b7e74980d9da664c709e68acf863e48386cda376edfd3bfb0
|
||||||
F ext/wasm/GNUmakefile 4ec270532b921c7c4b437fbdb06f6a0ce41f3bd874395ce70dbc933c8553efa9
|
F ext/wasm/GNUmakefile ce1eb95ca32b23ce3400b26e99c23f6b2737a5356cb4eff2b8b364d7630a8cc9
|
||||||
F ext/wasm/README.md 1e5b28158b74ab3ffc9d54fcbc020f0bbeb82c2ff8bbd904214c86c70e8a3066
|
F ext/wasm/README.md 1e5b28158b74ab3ffc9d54fcbc020f0bbeb82c2ff8bbd904214c86c70e8a3066
|
||||||
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 89983a8d122c35a90c65ec667844b95a78bcd04f3198a99c1e0c8368c1a0b03a
|
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 89983a8d122c35a90c65ec667844b95a78bcd04f3198a99c1e0c8368c1a0b03a
|
||||||
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
|
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
|
||||||
F ext/wasm/api/README.md 62758e8dd98741d41505f69130cc767013d2e871ebb9e4313d8f8b97d95071d8
|
F ext/wasm/api/README.md 946398dd80bfd673f098b9d6ca3564e1fc77b03e660274d132f267c407b8703c
|
||||||
F ext/wasm/api/extern-post-js.js dc68cbf552d8ea085181400a6963907c32e0b088b03ffd8969b1869fea246629
|
F ext/wasm/api/extern-post-js.js dfae3a5f621ae94f1fae671f8013ed6464355f11e2adda38ed8b10bf1929f337
|
||||||
F ext/wasm/api/extern-pre-js.js 20143b16b672d0a576fbf768a786d12ee1f84e222126477072389b992542a5b2
|
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
|
||||||
F ext/wasm/api/post-js-footer.js b64319261d920211b8700004d08b956a6c285f3b0bba81456260a713ed04900c
|
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
|
||||||
F ext/wasm/api/post-js-header.js 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1ecc5ba9e64ef90a8b
|
F ext/wasm/api/post-js-header.js 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1ecc5ba9e64ef90a8b
|
||||||
F ext/wasm/api/pre-js.js 2db711eb637991b383fc6b5c0f3df65ec48a7201e5730e304beba8de2d3f9b0b
|
F ext/wasm/api/pre-js.js 5b550904322d73127badd4347ca967ea525b901573559736f92d326ad9b7bb76
|
||||||
F ext/wasm/api/sqlite3-api-cleanup.js 5d22d1d3818ecacb23bfa223d5970cd0617d8cdbb48c8bc4bbd463f05b021a99
|
F ext/wasm/api/sqlite3-api-cleanup.js 4d07a7524dc9b7b050acfde57163e839243ad2383bd7ee0de0178b1b3e988588
|
||||||
F ext/wasm/api/sqlite3-api-glue.js 842dc03783aecc951a543a209523343a6fda9af258fb0bee08e8cc2dc3c4d8ae
|
F ext/wasm/api/sqlite3-api-glue.js 05eb701460bb72edbe3bf923bd51262551614612c37802fc597eabb4c6b83232
|
||||||
F ext/wasm/api/sqlite3-api-oo1.js 00f5cfce0989d2e08d7b21765d703c69234245d03a0cce8fcb32ccfcd53ffdbb
|
F ext/wasm/api/sqlite3-api-oo1.js 9a5f0c00d476c504f16dcd456e1743dbc2826ca3d10645dfa62663a39e3ed0d8
|
||||||
F ext/wasm/api/sqlite3-api-opfs.js 5a8ab3b76880c8ada8710ca9ba1ca5b160872edfd8bd5322e4f179a7f41cc616
|
F ext/wasm/api/sqlite3-api-opfs.js 5a8ab3b76880c8ada8710ca9ba1ca5b160872edfd8bd5322e4f179a7f41cc616
|
||||||
F ext/wasm/api/sqlite3-api-prologue.js b7c82a22d50658a48463fa646a23135273bc2cfa843aedda32627ff281c12e4d
|
F ext/wasm/api/sqlite3-api-prologue.js a17b35814c6399a2e69c7836e5fd2eaa71f755ee51f96cb69d68cbf99985d45b
|
||||||
F ext/wasm/api/sqlite3-api-worker1.js 7f4f46cb6b512a48572d7567233896e6a9c46570c44bdc3d13419730c7c221c8
|
F ext/wasm/api/sqlite3-api-worker1.js 7f4f46cb6b512a48572d7567233896e6a9c46570c44bdc3d13419730c7c221c8
|
||||||
|
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
|
||||||
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
|
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
|
||||||
F ext/wasm/api/sqlite3-wasm.c 4c131945ced4b08a694d287abcdb066b896d961ef79ee5241805ecc37e83d63a
|
F ext/wasm/api/sqlite3-wasm.c 4c131945ced4b08a694d287abcdb066b896d961ef79ee5241805ecc37e83d63a
|
||||||
F ext/wasm/batch-runner.html cf1a410c92bad50fcec2ddc71390b4e9df63a6ea1bef12a5163a66a0af4d78d9
|
F ext/wasm/batch-runner.html cf1a410c92bad50fcec2ddc71390b4e9df63a6ea1bef12a5163a66a0af4d78d9
|
||||||
@@ -499,7 +500,7 @@ F ext/wasm/common/testing.css 53394885077edd3db22d2a0896192334dfc06fb3d1da0b646e
|
|||||||
F ext/wasm/common/whwasmutil.js 50d2ede0b0fa01c1d467e1801fab79f5e46bb02bcbd2b0232e4fdc6090a47818
|
F ext/wasm/common/whwasmutil.js 50d2ede0b0fa01c1d467e1801fab79f5e46bb02bcbd2b0232e4fdc6090a47818
|
||||||
F ext/wasm/demo-123-worker.html e50b51dc7271b9d3cc830cb7c2fba294d622f56b7acb199f7257d11195a63d49
|
F ext/wasm/demo-123-worker.html e50b51dc7271b9d3cc830cb7c2fba294d622f56b7acb199f7257d11195a63d49
|
||||||
F ext/wasm/demo-123.html 7c239c9951d1b113f9f532969ac039294cf1dcfee2b3ae0a2c1ed2b3d59f8dfa
|
F ext/wasm/demo-123.html 7c239c9951d1b113f9f532969ac039294cf1dcfee2b3ae0a2c1ed2b3d59f8dfa
|
||||||
F ext/wasm/demo-123.js d563cf9d725692ccd940c46df1c026d87863e0544942a2ba2015f17fba3f6f74
|
F ext/wasm/demo-123.js e0cbeb3495e14103763d5c49794a24d67cf3d78e0ed5b82843be70c0c2ee4b3b
|
||||||
F ext/wasm/demo-kvvfs1.html 7d4f28873de67f51ac18c584b7d920825139866a96049a49c424d6f5a0ea5e7f
|
F ext/wasm/demo-kvvfs1.html 7d4f28873de67f51ac18c584b7d920825139866a96049a49c424d6f5a0ea5e7f
|
||||||
F ext/wasm/demo-kvvfs1.js 105596bd2ccd0b1deb5fde8e99b536e8242d4bb5932fac0c8403ff3a6bc547e8
|
F ext/wasm/demo-kvvfs1.js 105596bd2ccd0b1deb5fde8e99b536e8242d4bb5932fac0c8403ff3a6bc547e8
|
||||||
F ext/wasm/fiddle.make 3f4efd62bc2a9c883bfcea52ae2755114a62d444d6d042df287f4aef301d6c6c
|
F ext/wasm/fiddle.make 3f4efd62bc2a9c883bfcea52ae2755114a62d444d6d042df287f4aef301d6c6c
|
||||||
@@ -507,7 +508,7 @@ F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d695
|
|||||||
F ext/wasm/fiddle/fiddle-worker.js 531859a471924a0ea48afa218e6877f0c164ca324d51e15843ed6ecc1c65c7ee
|
F ext/wasm/fiddle/fiddle-worker.js 531859a471924a0ea48afa218e6877f0c164ca324d51e15843ed6ecc1c65c7ee
|
||||||
F ext/wasm/fiddle/fiddle.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2
|
F ext/wasm/fiddle/fiddle.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2
|
||||||
F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715
|
F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715
|
||||||
F ext/wasm/index.html 9ae9f9629310ed3ee88901aa14e20195815583806af245da08c2ecb43ced2243
|
F ext/wasm/index.html d75b516236c6869568ff691b9b7ff61307d6436e059b5657dadc473b6f41e581
|
||||||
F ext/wasm/jaccwabyt/jaccwabyt.js 0d7f32817456a0f3937fcfd934afeb32154ca33580ab264dab6c285e6dbbd215
|
F ext/wasm/jaccwabyt/jaccwabyt.js 0d7f32817456a0f3937fcfd934afeb32154ca33580ab264dab6c285e6dbbd215
|
||||||
F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e
|
F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e
|
||||||
F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06
|
F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06
|
||||||
@@ -526,12 +527,13 @@ F ext/wasm/test-opfs-vfs.html eb69dda21eb414b8f5e3f7c1cc0f774103cc9c0f87b2d28a33
|
|||||||
F ext/wasm/test-opfs-vfs.js 56c3d725044c668fa7910451e96c1195d25ad95825f9ac79f747a7759d1973d0
|
F ext/wasm/test-opfs-vfs.js 56c3d725044c668fa7910451e96c1195d25ad95825f9ac79f747a7759d1973d0
|
||||||
F ext/wasm/tester1-worker.html 0af7a22025ff1da72a84765d64f8f221844a57c6e6e314acf3a30f176101fd3f
|
F ext/wasm/tester1-worker.html 0af7a22025ff1da72a84765d64f8f221844a57c6e6e314acf3a30f176101fd3f
|
||||||
F ext/wasm/tester1.html fde0e0bdeaaa2c39877c749dc86a8c1c306f771c3d75b89a6289a5ed11243e9d
|
F ext/wasm/tester1.html fde0e0bdeaaa2c39877c749dc86a8c1c306f771c3d75b89a6289a5ed11243e9d
|
||||||
F ext/wasm/tester1.js d6a66fc36c7571b8050314b6d0e93e69cd6def88df14fb3ef2403e7aa244ec36
|
F ext/wasm/tester1.js 8161dcc4b21902dadec2d3a5dc5700cab9c1641db0603e2ea56ea2a8de6cbab3
|
||||||
F ext/wasm/testing-worker1-promiser.html 6eaec6e04a56cf24cf4fa8ef49d78ce8905dde1354235c9125dca6885f7ce893
|
F ext/wasm/testing-worker1-promiser.html 6eaec6e04a56cf24cf4fa8ef49d78ce8905dde1354235c9125dca6885f7ce893
|
||||||
F ext/wasm/testing-worker1-promiser.js bd788e33c1807e0a6dda9c9a9d784bd3350ca49c9dd8ae2cc8719b506b6e013e
|
F ext/wasm/testing-worker1-promiser.js bd788e33c1807e0a6dda9c9a9d784bd3350ca49c9dd8ae2cc8719b506b6e013e
|
||||||
F ext/wasm/testing1.html 50575755e43232dbe4c2f97c9086b3118eb91ec2ee1fae931e6d7669fb17fcae
|
F ext/wasm/testing1.html 50575755e43232dbe4c2f97c9086b3118eb91ec2ee1fae931e6d7669fb17fcae
|
||||||
F ext/wasm/testing2.html a66951c38137ff1d687df79466351f3c734fa9c6d9cce71d3cf97c291b2167e3
|
F ext/wasm/testing2.html a66951c38137ff1d687df79466351f3c734fa9c6d9cce71d3cf97c291b2167e3
|
||||||
F ext/wasm/testing2.js 88f40ef3cd8201bdadd120a711c36bbf0ce56cc0eab1d5e7debb71fed7822494
|
F ext/wasm/testing2.js 88f40ef3cd8201bdadd120a711c36bbf0ce56cc0eab1d5e7debb71fed7822494
|
||||||
|
F ext/wasm/version-json.c 03c6fb4efefd7c5b14f618b36648e71da741e39059ea5059c39495fdceaed144
|
||||||
F ext/wasm/wasmfs.make 3cce1820006196de140f90f2da4b4ea657083fb5bfee7d125be43f7a85748c8f
|
F ext/wasm/wasmfs.make 3cce1820006196de140f90f2da4b4ea657083fb5bfee7d125be43f7a85748c8f
|
||||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||||
@@ -622,7 +624,7 @@ F src/shell.c.in 2915eaf22bda89ad6533851a051de4773c249185360fe1fc7b4477b8f9063b2
|
|||||||
F src/sqlite.h.in d9c8a6243fc0a1c270d69db33758e34b810af3462f9bc5b4af113b347e07c69d
|
F src/sqlite.h.in d9c8a6243fc0a1c270d69db33758e34b810af3462f9bc5b4af113b347e07c69d
|
||||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||||
F src/sqlite3ext.h 5336beea1868d99d2f62e628dbea55e97267dbff8193291ab175e960c5df9141
|
F src/sqlite3ext.h 5336beea1868d99d2f62e628dbea55e97267dbff8193291ab175e960c5df9141
|
||||||
F src/sqliteInt.h 30e6fdc957f09dbdbe1bcf73874263427bbd9a321cd2a583de74bdb030c9fa78
|
F src/sqliteInt.h 2a182a906ac614eb240a68abba8eaf4b018693fd2410ddaa133c08de00507e0a
|
||||||
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
|
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
|
||||||
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
|
F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
|
||||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||||
@@ -704,9 +706,9 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
|||||||
F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d
|
F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d
|
||||||
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
|
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
|
||||||
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
|
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
|
||||||
F src/where.c 8517a0ee4a3169368176fda649e2693ee013d7bdca72d485050e91cd640735f7
|
F src/where.c a1c42bab8e840fa2cc90f6caf0f7133c35972e2f93b5899a90036d85e665c107
|
||||||
F src/whereInt.h 70cd30de9ed784aa33fa6bd1245f060617de7a00d992469b6d8e419eed915743
|
F src/whereInt.h 70cd30de9ed784aa33fa6bd1245f060617de7a00d992469b6d8e419eed915743
|
||||||
F src/wherecode.c bb88be457df3a6a01c844074ab79a9ba74279e73185f1362383aa697e3cae5dc
|
F src/wherecode.c 8ec5a413f12af06638dcca36d0954be2151eea6f293d3c67397cef6a90d6adf1
|
||||||
F src/whereexpr.c bf8c155212c886621d71c951053660de6fcc4ee907b17aa02da0a96a39aa9405
|
F src/whereexpr.c bf8c155212c886621d71c951053660de6fcc4ee907b17aa02da0a96a39aa9405
|
||||||
F src/window.c 928e215840e2f2d9a2746e018c9643ef42c66c4ab6630ef0df7fa388fa145e86
|
F src/window.c 928e215840e2f2d9a2746e018c9643ef42c66c4ab6630ef0df7fa388fa145e86
|
||||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||||
@@ -2031,8 +2033,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 08b033c737d1a84859291f50e2985c9dad8d660a50185d55d3171165a8e08d4c
|
P 462b3c7f39724dc814f55e7a225e7d0c48f81c524cdda797a66e9e198c35ce58 45752471521f8d4a6cad4bce40f907018acd403ffd3b8170020c34e4e0b6b91b
|
||||||
R a01b27e71bf0d1c060a37cd77d73f0f5
|
R 6f3970b0a66900429c4532002ac9cf64
|
||||||
U drh
|
U drh
|
||||||
Z 807c2ee5a3bf759378437d2cb1bbfe03
|
Z f2ec0a1b95a0b19c496d987488a36bd5
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
462b3c7f39724dc814f55e7a225e7d0c48f81c524cdda797a66e9e198c35ce58
|
56ef97e64efb84176df570819474901d492209ff80ce4355ff896dea9d2b8a51
|
||||||
@@ -4412,12 +4412,16 @@ int sqlite3HeapNearlyFull(void);
|
|||||||
*/
|
*/
|
||||||
#ifdef SQLITE_USE_ALLOCA
|
#ifdef SQLITE_USE_ALLOCA
|
||||||
# define sqlite3StackAllocRaw(D,N) alloca(N)
|
# define sqlite3StackAllocRaw(D,N) alloca(N)
|
||||||
|
# define sqlite3StackAllocRawNN(D,N) alloca(N)
|
||||||
# define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N)
|
# define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N)
|
||||||
# define sqlite3StackFree(D,P)
|
# define sqlite3StackFree(D,P)
|
||||||
|
# define sqlite3StackFreeNN(D,P)
|
||||||
#else
|
#else
|
||||||
# define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N)
|
# define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N)
|
||||||
|
# define sqlite3StackAllocRawNN(D,N) sqlite3DbMallocRawNN(D,N)
|
||||||
# define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N)
|
# define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N)
|
||||||
# define sqlite3StackFree(D,P) sqlite3DbFree(D,P)
|
# define sqlite3StackFree(D,P) sqlite3DbFree(D,P)
|
||||||
|
# define sqlite3StackFreeNN(D,P) sqlite3DbFreeNN(D,P)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Do not allow both MEMSYS5 and MEMSYS3 to be defined together. If they
|
/* Do not allow both MEMSYS5 and MEMSYS3 to be defined together. If they
|
||||||
|
|||||||
@@ -4701,7 +4701,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
|||||||
int mxChoice; /* Maximum number of simultaneous paths tracked */
|
int mxChoice; /* Maximum number of simultaneous paths tracked */
|
||||||
int nLoop; /* Number of terms in the join */
|
int nLoop; /* Number of terms in the join */
|
||||||
Parse *pParse; /* Parsing context */
|
Parse *pParse; /* Parsing context */
|
||||||
sqlite3 *db; /* The database connection */
|
|
||||||
int iLoop; /* Loop counter over the terms of the join */
|
int iLoop; /* Loop counter over the terms of the join */
|
||||||
int ii, jj; /* Loop counters */
|
int ii, jj; /* Loop counters */
|
||||||
int mxI = 0; /* Index of next entry to replace */
|
int mxI = 0; /* Index of next entry to replace */
|
||||||
@@ -4720,7 +4719,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
|||||||
int nSpace; /* Bytes of space allocated at pSpace */
|
int nSpace; /* Bytes of space allocated at pSpace */
|
||||||
|
|
||||||
pParse = pWInfo->pParse;
|
pParse = pWInfo->pParse;
|
||||||
db = pParse->db;
|
|
||||||
nLoop = pWInfo->nLevel;
|
nLoop = pWInfo->nLevel;
|
||||||
/* TUNING: For simple queries, only the best path is tracked.
|
/* TUNING: For simple queries, only the best path is tracked.
|
||||||
** For 2-way joins, the 5 best paths are followed.
|
** For 2-way joins, the 5 best paths are followed.
|
||||||
@@ -4743,7 +4741,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
|||||||
/* Allocate and initialize space for aTo, aFrom and aSortCost[] */
|
/* Allocate and initialize space for aTo, aFrom and aSortCost[] */
|
||||||
nSpace = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2;
|
nSpace = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2;
|
||||||
nSpace += sizeof(LogEst) * nOrderBy;
|
nSpace += sizeof(LogEst) * nOrderBy;
|
||||||
pSpace = sqlite3DbMallocRawNN(db, nSpace);
|
pSpace = sqlite3StackAllocRawNN(pParse->db, nSpace);
|
||||||
if( pSpace==0 ) return SQLITE_NOMEM_BKPT;
|
if( pSpace==0 ) return SQLITE_NOMEM_BKPT;
|
||||||
aTo = (WherePath*)pSpace;
|
aTo = (WherePath*)pSpace;
|
||||||
aFrom = aTo+mxChoice;
|
aFrom = aTo+mxChoice;
|
||||||
@@ -5001,7 +4999,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
|||||||
|
|
||||||
if( nFrom==0 ){
|
if( nFrom==0 ){
|
||||||
sqlite3ErrorMsg(pParse, "no query solution");
|
sqlite3ErrorMsg(pParse, "no query solution");
|
||||||
sqlite3DbFreeNN(db, pSpace);
|
sqlite3StackFreeNN(pParse->db, pSpace);
|
||||||
return SQLITE_ERROR;
|
return SQLITE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5083,8 +5081,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
|
|||||||
pWInfo->nRowOut = pFrom->nRow;
|
pWInfo->nRowOut = pFrom->nRow;
|
||||||
|
|
||||||
/* Free temporary memory and return success */
|
/* Free temporary memory and return success */
|
||||||
assert( db!=0 );
|
sqlite3StackFreeNN(pParse->db, pSpace);
|
||||||
sqlite3DbNNFreeNN(db, pSpace);
|
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2314,7 +2314,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
|
|||||||
int nNotReady; /* The number of notReady tables */
|
int nNotReady; /* The number of notReady tables */
|
||||||
SrcItem *origSrc; /* Original list of tables */
|
SrcItem *origSrc; /* Original list of tables */
|
||||||
nNotReady = pWInfo->nLevel - iLevel - 1;
|
nNotReady = pWInfo->nLevel - iLevel - 1;
|
||||||
pOrTab = sqlite3StackAllocRaw(db,
|
pOrTab = sqlite3DbMallocRawNN(db,
|
||||||
sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0]));
|
sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0]));
|
||||||
if( pOrTab==0 ) return notReady;
|
if( pOrTab==0 ) return notReady;
|
||||||
pOrTab->nAlloc = (u8)(nNotReady + 1);
|
pOrTab->nAlloc = (u8)(nNotReady + 1);
|
||||||
@@ -2567,7 +2567,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
|
|||||||
assert( pLevel->op==OP_Return );
|
assert( pLevel->op==OP_Return );
|
||||||
pLevel->p2 = sqlite3VdbeCurrentAddr(v);
|
pLevel->p2 = sqlite3VdbeCurrentAddr(v);
|
||||||
|
|
||||||
if( pWInfo->nLevel>1 ){ sqlite3StackFree(db, pOrTab); }
|
if( pWInfo->nLevel>1 ){ sqlite3DbFreeNN(db, pOrTab); }
|
||||||
if( !untestedTerms ) disableTerm(pLevel, pTerm);
|
if( !untestedTerms ) disableTerm(pLevel, pTerm);
|
||||||
}else
|
}else
|
||||||
#endif /* SQLITE_OMIT_OR_OPTIMIZATION */
|
#endif /* SQLITE_OMIT_OR_OPTIMIZATION */
|
||||||
|
|||||||
Reference in New Issue
Block a user