dan [Tue, 13 Dec 2022 19:40:56 +0000 (19:40 +0000)]
Prevent the sessions rebaser from generating changesets containing UPDATE records for which non-PK fields are present in the old.* but not the new.* record. Also update the changeset iterator to work around such changesets.
stephan [Tue, 13 Dec 2022 08:25:28 +0000 (08:25 +0000)]
Extend the sqlite3.wasm function pointer argument converter to be able to handle the "two-layered context" of sqlite3_create_collation() and friends and make use of FuncPtrAdapter to perform JS-to-WASM function conversion for them.
drh [Mon, 12 Dec 2022 21:22:23 +0000 (21:22 +0000)]
Further fix for ticket [57c47526c34f01e8]. If a subquery has a result set
column of the form "CAST(expr AS NUMERIC)" do not give that column NUMERIC
affinity. NUMERIC affinity always goes to an integer if able, but a CAST
to numeric is a no-op if the input is a number. So the two are not equivalent.
drh [Mon, 12 Dec 2022 18:58:53 +0000 (18:58 +0000)]
If a subquery has a result column of the form "CAST(... AS NUMERIC)" then
give that column no affinity rather than NUMERIC affinity. This is because
casting to numeric preserves real values that could be integers but numeric
affinity does not. By using no affinity on the column, we make the behavior
consistent if the subquery is implemented as a co-routine or is materialized.
stephan [Mon, 12 Dec 2022 18:42:39 +0000 (18:42 +0000)]
Revert part of [9386d6f63468] because the new automatic function pointer binding cannot properly track per-context function mappings when the context is more complex than a single context-type pointer. e.g. it is fine for sqlite3_trace_v2() but it breaks down with sqlite3_create_collation() because that one needs to use the collation name as part of the context key and we cannot sensibly do so with the current code.
stephan [Mon, 12 Dec 2022 14:31:38 +0000 (14:31 +0000)]
Move JS-to-C binding signatures from sqlite3-api-prologue.js to sqlite3-api-glue.js to allow for use of the new/experimental sqlite3.wasm.xWrap() feature which automatically binds JS functions to WASM/C as needed, which simplifies creation of bindings which take C function pointers. Reimplement sqlite3_exec(), sqlite3_create_collation(), sqlite3_progress_handler() to use this new feature.
stephan [Mon, 12 Dec 2022 08:16:47 +0000 (08:16 +0000)]
Rework the internals of how argument/result types are converted to/from wasm in prep for attempting to support automated conversions of function pointer argument types.
dan [Sat, 10 Dec 2022 19:22:39 +0000 (19:22 +0000)]
Ensure that the types and collation sequences of a view are taken from the leftmost component of compound SELECTs, even when column names are explicitly provided for the view.
dan [Sat, 10 Dec 2022 17:54:55 +0000 (17:54 +0000)]
Ensure that the types and collation sequences of a view are taken from the leftmost component of compound SELECTs, even when column names are explicitly provided for the view. Possible fix for [679ed6a2].
stephan [Fri, 9 Dec 2022 15:12:07 +0000 (15:12 +0000)]
Expose sqlite3_value_frombind/nochange/numeric_type() to WASM. Add a flag to sqlite3_value_to_js() to cause it to return undefined, instead of throwing, if no conversion can be found.
stephan [Fri, 9 Dec 2022 14:46:24 +0000 (14:46 +0000)]
Refactor the sqlite3_value-to-JS conversion from an internal detail to sqlite3.capi.sqlite3_value_to_js() for use with routines like sqlite3_module::xFilter().
stephan [Fri, 9 Dec 2022 12:12:49 +0000 (12:12 +0000)]
Remove some unused sqlite3_status() codes from the JS API. Add custom JS wrappers for sqlite3_create_collation/_v2() which accept JS functions (plus tests). Expand the argument options for sqlite3_wasm_db_error() to enable it to translate exception objects to C-level errors.
stephan [Fri, 9 Dec 2022 09:23:27 +0000 (09:23 +0000)]
Rename the oft-used, verbose sqlite3.wasm.get/setMemValue() and get/setPtrValue() to peek/poke() and peek/pokePtr(). The old names are retained as aliases just in case any client code actually uses them, but they are now deprecated.
stephan [Fri, 9 Dec 2022 05:47:42 +0000 (05:47 +0000)]
Export sqlite3_status() and sqlite3_stmt_status() to wasm. Expand the arg/return semantics of wasm.get/setPtrValue() and get/setMemValue() to simplify handling of multiple pointers.
stephan [Fri, 9 Dec 2022 01:49:17 +0000 (01:49 +0000)]
Expose sqlite3_db_status() and sqlite3_db_config() to wasm, noting that the latter requires several internal wrappers to account for the various varidic forms (C varargs cannot be bound to wasm).
drh [Wed, 7 Dec 2022 00:14:25 +0000 (00:14 +0000)]
Fix a (harmless) off-by-one error in code generation that comes up when
doing a DISTINCT query against a virtual table with an OR term in the
WHERE clause and where the ORDER BY clause has 64 or more references to
the result set. [forum:/forumpost/dfe8084751|Forum post dfe8084751].
dan [Tue, 6 Dec 2022 18:48:06 +0000 (18:48 +0000)]
Have sqlite3_stmt_scanstatus_v2() return an NCYCLE value for all loops, not just virtual tables ones. The value returned is the sum of the NCYCLE counts for the various opcodes that move or read data from the table or index cursor associated with the loop.
drh [Tue, 6 Dec 2022 13:12:33 +0000 (13:12 +0000)]
In the unix backend, when implementing the defenses against small file
descriptors, delete a file just created if it was opened with
O_EXCL|O_CREAT so that it can be created again the next time through the
loop. Fix for the problem described by
[forum:/forumpost/699af709ab3a8ccf|forum post 699af709ab3a8ccf].
stephan [Mon, 5 Dec 2022 15:05:46 +0000 (15:05 +0000)]
Remove two features of jaccwabyt which were fundamentally flawed, along with approx. 250 lines of unit tests which heavily relied on them. Thankfully, none of the sqlite3.js-level code used those bits.
stephan [Mon, 5 Dec 2022 11:54:13 +0000 (11:54 +0000)]
Rename 'static-string' argument adapter to 'string:static'. Replace JS unit tests which were lost via editing a generated copy of tester1.js instead of the original tester1.c-pp.js input file.
stephan [Mon, 5 Dec 2022 11:30:39 +0000 (11:30 +0000)]
Export sqlite3_bind/value/result_pointer() to wasm. Add 'static-string' argument converter to support the lifetime requirements of bind/result_pointer()'s string argument. Correct an endless loop in wasm.cstrlen() when passed a non-C-string argument.
drh [Mon, 5 Dec 2022 02:42:30 +0000 (02:42 +0000)]
Use the smaller estimated row size for searching IPK tables, but use the
original larger row size estimate for scanning, since the leaves can have large
rows.