Commit Graph

27718 Commits

Author SHA1 Message Date
drh
82136d90f8 Minor fix to the header comment on jsonXlateTextToBlob().
FossilOrigin-Name: c3677ba410208c07b711f5f526eb5cf039a8eee49f632c7ae04fa55cdfbb9058
2023-12-02 14:55:46 +00:00
drh
f0b8b16317 Performance optimization in jsonAppendString().
FossilOrigin-Name: fdf00e96239c73fb67e2acecc5b95f55a1fc51c3deed4512613c0d6070ce5805
2023-12-02 14:16:47 +00:00
drh
679c90850c Simplification and optimization of the JSON parser.
FossilOrigin-Name: f5ec9485119a2a6cb33eb864c7ca9b41d4a2ed08ab6ad9a6b0dd9358ab253576
2023-12-02 13:36:52 +00:00
drh
768b6e32f6 Remove a NEVER that can be true if a virtual table column is declared to have
a DEFAULT.  See
[forum:/forumpost/3d4de8917627d058|forum post 3d4de8917627d058].

FossilOrigin-Name: 8abc2ccaf8106f20243568cd7fa74174386eb85d7ea381201e97e2fd527033e0
2023-12-02 12:23:34 +00:00
drh
6df61985d4 Unroll a loop in the parser for a performance increase.
FossilOrigin-Name: a6dc29e4d5e13949e0fcd9d5dde575c2670eb10a230ab9df3806fc8c3016c540
2023-12-02 01:38:53 +00:00
drh
5ec9c916ad Fix harmless compiler warnings and enhance performance the parser.
FossilOrigin-Name: 285633da6d188547e52f07779e209c9e5f3dc33ce0668e14858f3337889ef4b8
2023-12-02 01:06:33 +00:00
drh
3af20cf3a0 Performance optimization in the JSON parser.
FossilOrigin-Name: 68d191f40e708962ec88e0c245b4496bc4a671300484b1cc0f3fc7e6d199a6e6
2023-12-01 22:01:26 +00:00
dan
f4c2962558 Remove old code for tokendata=1 queries.
FossilOrigin-Name: b0a489e8e1bf0290c2117ab32d78b1cc7d67bcb226b55ec044c8367ebde3815b
2023-12-01 20:37:11 +00:00
dan
ebd173a79f Merge latest trunk with this branch.
FossilOrigin-Name: 8258967411d3ff212424b25fec79ded0d8ae83e773cd35a0bbf300c94923f25b
2023-12-01 20:10:20 +00:00
dan
b5effc0605 Different approach to querying a tokendata=1 table. Saves cpu and memory.
FossilOrigin-Name: c523f40895866e6fc979a26483dbea8206126b4bbdf4b73b77263c09e13c855e
2023-12-01 20:09:59 +00:00
drh
03075fa868 JSON cache is now more effective.
FossilOrigin-Name: 443a3f3a8e64d81cad8300a30e2cc57c4e39f69b5669ac8b550c590ae9f1134a
2023-12-01 18:49:02 +00:00
drh
063d0d4c3a Fix up the JSON cache to work better.
FossilOrigin-Name: 1fdbc39521f63aedc6f08ecaafa54ea467b8c6316a692a18ad01eecbf22a0977
2023-12-01 18:46:14 +00:00
drh
5bfa7e65d1 Cache is working better, but does not preserve the hasJson5 flag.
FossilOrigin-Name: a12add7ab9f5aee5bb2ede0c4d22e599dd28f7a107dce72b2ea48ef92d233e8a
2023-12-01 13:28:13 +00:00
drh
ca1ce7773c First attempt to get the JSON text-to-binary cache working. All test cases
pass, but the cache seems not to help much.

FossilOrigin-Name: 25ed295f300fea6185104a73721076bccd2b2a6e411c78564266fa6dca4ff70c
2023-12-01 12:57:12 +00:00
drh
4b9ed1b256 Remove all trace of JsonNode from the JSON implementation. The JSONB format
is used as the internal binary encoding for searching and editing.

FossilOrigin-Name: 11ebb5f712cc7a515e2e0f2be8c1d71de20c97fe5b74c4f4d72c84fd21182d35
2023-11-30 23:36:14 +00:00
drh
38aeb97f27 Convert json_valid() over to using only JSONB as its internal format.
FossilOrigin-Name: 7b5756fa6d00b093bf083a8d7a5ef5485f7a09e4eac473785c8380688f861a1b
2023-11-30 20:57:48 +00:00
stephan
68003d9f18 Add a basic batch-mode SQL runner for the SAH Pool VFS, for use in comparing it against WebSQL. Bring the WebSQL batch runner up to date, noting that it cannot run without addition of an "origin trial" activation key from Google because that's now the only way to enable WebSQL in Chrome (that part is not checked in because that key is private). Minor code-adjacent cleanups.
FossilOrigin-Name: 883990e7938c1f63906300a6113f0fadce143913b7c384e8aeb5f886f0be7c62
2023-11-30 20:34:24 +00:00
drh
276042bd23 Convert json_type() to use JSONB internally.
FossilOrigin-Name: 83074835b900ce85cf67059e674ce959801505c37592671af25ca0af7ed483f1
2023-11-30 19:29:56 +00:00
drh
0ab1e25468 Convert json_insert(), json_replace(), and json_set() over to using only
JSONB internally.

FossilOrigin-Name: 4e2083e86f19ef7634f0b253fb924e52014b43ed0ce8acc51c36f3c5682180a6
2023-11-30 19:11:14 +00:00
drh
66795962b5 Enhance json_set() and json_insert() so that they create missing
substructure.

FossilOrigin-Name: cc7a641ab5ae739d31c24f0ad0caeb15a481a63fa8f13720718ea922c25862ff
2023-11-30 19:06:27 +00:00
drh
7394a6ef57 Simplification of the new JSON insert/set test cases.
FossilOrigin-Name: 04c0d5644372446c924a2e31a26edf51ddc563a1990d170b0ed4739e3e8b239b
2023-11-30 16:17:09 +00:00
drh
48222bef66 New JSON test cases showing insert or set with missing substructure.
FossilOrigin-Name: 6802b6459d0d16c961ff41d240a6c88287f197d8f609090f79308707490a49c2
2023-11-30 16:16:10 +00:00
drh
ad27c437ff New test cases for insert/set/replace with paths that indicate substructure
that does not yet exist.

FossilOrigin-Name: 146c717c51940b2139befc45ac74e7a1c36ef3c32fd3cfe35b334488eebe6298
2023-11-30 12:04:14 +00:00
stephan
bac2fe9f44 Update some OPFS-related help text in WASM tests. Minor cleanups in speedtest1-worker.js.
FossilOrigin-Name: 263f6d3a7784ef7d032dbf7a3265aca8dd70bf50797f28f6b2e8ddb6a301f83a
2023-11-30 10:00:25 +00:00
drh
bfc7e62be4 Convert json_insert(), json_replace(), json_set() to use JSONB internally.
Mostly working, but some corner cases are still not quite right.

FossilOrigin-Name: 99c8f6bd5c9a31b6d00f92e383bec8a8235ed553916ad59adbb1b7663f6ebff1
2023-11-30 00:52:33 +00:00
drh
694beecf2b Convert the json_error_position() routine to use only JSONB internally.
FossilOrigin-Name: e7a8ba35bff6fde55827f978de5b343b6c134c7fa53827f5c63915a9dc2598ad
2023-11-29 20:06:49 +00:00
drh
da2578391d The json_patch() function now operates exclusively on JSONB. This patch
also includes improvements to JSONB debug printing routines.

FossilOrigin-Name: fee19d0098242110d2c44ec7b9620c1210ef3f87913305f66ec85d277dd96ab6
2023-11-29 17:36:54 +00:00
dan
89fcfbb424 Fix signed integer overflow in fts5.
FossilOrigin-Name: 60e46c7ec68fd8caaed960ca06d98fb06855b2d0bb860dd2fb7b5e89a5e9c7b4
2023-11-29 16:22:39 +00:00
drh
ed088f5f8d In the recovery extension, if a payload size is unreasonably large, it is
probably corrupt, so truncate it.

FossilOrigin-Name: 988c3179e978a3a6d42541e9c7a2ab98150383671810926503376ed808f150ff
2023-11-29 13:47:46 +00:00
drh
6d7afd8ba8 Merge all the latest trunk enhancements into the jsonb branch.
FossilOrigin-Name: 1a59fcab2179cc3b52ecd3de7d2018db96ac149aaff521959773a517b8d9ac3e
2023-11-29 12:18:02 +00:00
drh
2ba5534101 The assertion change at check-in [7946c79567b0ccd3] is insufficient to fix
the problem of a Table object being deleted out from under the OP_VCheck
opcode.  We need to reference count the Table, which is accomplished here.

FossilOrigin-Name: cad269d5e274443c39203a56603b991accc0399135d436996fc039d1d28ec9db
2023-11-29 02:45:09 +00:00
drh
4b54d6cdaf Convert the json_array_length() function to use JSONB instead of JsonNodes.
FossilOrigin-Name: 5ab790736d943e08f097efcee5cfbf0d83c65b0a53f273060330ba719affa5e5
2023-11-29 01:38:15 +00:00
drh
748178a9fb Fix all known problems with JSONB json_extract().
FossilOrigin-Name: d5f48c57e975ac468cf29a43a5d0b56ef6d06cf35a8b0bddf87ec1c0fc7ae028
2023-11-28 23:26:55 +00:00
drh
1f8c7c7053 Do not set the J subtype when the output is JSONB.
FossilOrigin-Name: 4f106b64fe8988435872806bd0a6c223b61f53af0dd1c47c847bb4eec4e03e27
2023-11-28 23:18:04 +00:00
drh
1ef232c0e1 Preserve flexibility in the format of the RHS of -> and ->> operators found
in legacy.

FossilOrigin-Name: 6231ec43adb7436195eb1497de39a6c13c6b4f1c5032e6ea52515d214e61fdbc
2023-11-28 20:33:20 +00:00
drh
1cab41e290 Attempt to get json_extract() working with pure JSONB only, and without
the use of JsonNode.  Mostly working, but there are some differences from
legacy in corner cases.

FossilOrigin-Name: 8c324af1eca27e86adc45622af4f3b06a67a3f968596ac58aa7434b1f6f05f3c
2023-11-28 20:25:23 +00:00
dan
0d4a888485 Merge latest trunk updates into this branch.
FossilOrigin-Name: 554fc13f2ca5f2ebd9ad0206034c25b556ff40db3106051c5e539f2e142e88ea
2023-11-28 19:43:08 +00:00
drh
ef97f8360a The json_remove() function now uses only JSONB, never JsonNodes, internally.
FossilOrigin-Name: b69786e746ae2b927b64d9871fd120b7f8f06cc53739fd46a4da51aa16cf8576
2023-11-28 18:16:02 +00:00
dan
940b23bc3a In SQLITE_ENABLE_SETLK_TIMEOUT builds, use blocking locks in place of sleep() calls when opening a read-transaction.
FossilOrigin-Name: 4c055b7a6e4533e1e571773456226ca7038ce372df3eedbbbcd9a81e8652a6cf
2023-11-28 17:12:42 +00:00
dan
b8950e0f45 Handle an SQLITE_BUSY_TIMEOUT error if one occurs while attempting a shared lock on a read-lock slot.
FossilOrigin-Name: 5fbf3906d272df3eb981f67455eb35f649ad2774cba9fc3f077b28d9bef3f0cb
2023-11-28 15:29:04 +00:00
drh
26cd4b57df Activate the ability of json_patch() to work on JSONB.
FossilOrigin-Name: 11aba347ff7c639500eec904e212eabe889b077351b946cfeac2b74b9703672a
2023-11-28 13:38:22 +00:00
drh
ec1f59f0cd All legacy tests are passing.
FossilOrigin-Name: 2c436806b8d5f57de99c00f6154b038454fb9ae427d00d7b4a46ab9c7c69bcb9
2023-11-28 13:35:53 +00:00
drh
5026ddb83d The json_patch() code for JSONB compiles and works sometimes, but there are
still issues.  Incremental check-in.

FossilOrigin-Name: e0099464a0045a04f4ccf29bc2b8325fc8c7f39ccf4847e74818f928c9153588
2023-11-28 12:28:28 +00:00
drh
f46f89df97 More aggressive use of jsonBlobEdit(). Improvements to the MergePatch
implementation sketch.

FossilOrigin-Name: fbca9570fd2e1465739e4d3a8d9bb40fad594fd78ab49b2cb34efa27ebdd8361
2023-11-28 00:27:58 +00:00
drh
eb04a0bb7b Add untested (#ifdefed-out) code for the MergePatch algorithm against JSONB.
Add (and test) the jsonBlobEdit() routine that is needed by the new MergePatch.

FossilOrigin-Name: 4d353387fc10e1038cfdd86e66007bf728c231a928e588897bbee0fbfe76f225
2023-11-27 23:46:12 +00:00
dan
bae2d0f2eb Have SQLITE_ENABLE_SETLK_TIMEOUT builds block when locking a read-lock slot.
FossilOrigin-Name: f797baf47cf7859cfd8ce248f4f3087af4551a7040af990333426e5a7c269504
2023-11-27 20:37:03 +00:00
dan
e52854a9e6 In SQLITE_ENABLE_SETLK_TIMEOUT builds, use blocking locks in place of sleep() when opening a read-transaction.
FossilOrigin-Name: a51ef39998e25e86bd0600e71d15011b12e05f4319608018293bdaecb09e8c97
2023-11-27 19:22:50 +00:00
drh
8a3034add8 Enhance the (SQLITE_DEBUG-only) json_parse() routine so that it shows a
decoding of JSONB when given a BLOB argument.

FossilOrigin-Name: af267868562e0799ad691dccad05f17afbc34d609eede8c55f57d209290246ef
2023-11-27 17:13:18 +00:00
drh
821a4c9f8c Give the json_valid() function an optional second argument that determines
what is meant by "valid".

FossilOrigin-Name: a4e19ad43dac81e7655ec03ff69bb99d1d02b0c227034c90fb41415fd4793fe3
2023-11-27 15:57:11 +00:00
drh
85eafe6f3b Convert the json_tree() and json_each() virtual tables over to use JSONB has
their internal representation.

FossilOrigin-Name: ec18caa3f7790b780dde66c1ccbb6eb09d2f1507629cc45955fc1b08380b4017
2023-11-27 12:36:29 +00:00