1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-24 14:17:58 +03:00

New test cases for insert/set/replace with paths that indicate substructure

that does not yet exist.

FossilOrigin-Name: 146c717c51940b2139befc45ac74e7a1c36ef3c32fd3cfe35b334488eebe6298
This commit is contained in:
drh
2023-11-30 12:04:14 +00:00
parent bfc7e62be4
commit ad27c437ff
3 changed files with 32 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
C Convert\sjson_insert(),\sjson_replace(),\sjson_set()\sto\suse\sJSONB\sinternally.\nMostly\sworking,\sbut\ssome\scorner\scases\sare\sstill\snot\squite\sright.
D 2023-11-30T00:52:33.320
C New\stest\scases\sfor\sinsert/set/replace\swith\spaths\sthat\sindicate\ssubstructure\nthat\sdoes\snot\syet\sexist.
D 2023-11-30T12:04:14.610
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1325,7 +1325,7 @@ F test/json/json-generator.tcl dc0dd0f393800c98658fc4c47eaa6af29d4e17527380cd286
F test/json/json-q1-b.txt 606818a5fba6d9e418c9f4ea7d8418af026775042dad81439b72447a147a462c
F test/json/json-q1.txt 65f9d1cdcc4cffa9823fb73ed936aae5658700cd001fde448f68bfb91c807307
F test/json/json-speed-check.sh b060a9a6c696c0a807d8929400fa11bd7113edc58b0d66b9795f424f8d0db326 x
F test/json101.test 8f5d1a3350c36945c8b58f538e1c92cfd87fd50ab6f5e3d5f4cf3cdb03b9546d
F test/json101.test 861a5d75c296709471e88aa48d82095ed600dedd23ba29b904b91e64d319b7c3
F test/json102.test 557a46e16df1aa9bdbc4076a71a45814ea0e7503d6621d87d42a8c04cbc2b0ef
F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe
F test/json104.test 1b844a70cddcfa2e4cd81a5db0657b2e61e7f00868310f24f56a9ba0114348c1
@@ -2145,11 +2145,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P e7a8ba35bff6fde55827f978de5b343b6c134c7fa53827f5c63915a9dc2598ad
R 4c74c3d174d84fc0b9e05e4cabac42e8
T *branch * jsonb-insert
T *sym-jsonb-insert *
T -sym-jsonb *
P 99c8f6bd5c9a31b6d00f92e383bec8a8235ed553916ad59adbb1b7663f6ebff1
R 757617988b02e4847aadc75efb2ede4b
U drh
Z 396365e2a8dc6b109097922e3ec543f6
Z 50c123f2db65971d190ff942903bde3b
# Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
99c8f6bd5c9a31b6d00f92e383bec8a8235ed553916ad59adbb1b7663f6ebff1
146c717c51940b2139befc45ac74e7a1c36ef3c32fd3cfe35b334488eebe6298

View File

@@ -1139,4 +1139,29 @@ do_execsql_test json101-23.2 {
FROM (SELECT json_set('[]','$[#]',0,'$[#]',1) AS j);
} {{[0,1]} 0 1}
# Insert/Set/Replace where the path specifies substructure that
# does not yet exist
#
proc tx x {return [string map [list ( \173 ) \175 ' \042 < \133 > \135] $x]}
foreach {id start path ins set repl} {
1 {{}} {$.a.b.c} ('a':('b':('c':'NEW'))) ('a':('b':('c':'NEW'))) ()
2 {{a:4}} {$.a.b.c} ('a':4) ('a':4) ('a':4)
3 {{a:{}}} {$.a.b.c} ('a':('b':('c':'NEW'))) ('a':('b':('c':'NEW'))) ('a':())
4 {[0,1,2]} {$[3].a[0].b} <0,1,2,('a':<('b':'NEW')>)> <0,1,2,('a':<('b':'NEW')>)> <0,1,2>
5 {[0,1,2]} {$[1].a[0].b} <0,1,2> <0,1,2> <0,1,2>
6 {[0,{},2]} {$[1].a[0].b} <0,('a':<('b':'NEW')>),2> <0,('a':<('b':'NEW')>),2> <0,(),2>
7 {[0,1,2]} {$[3][0].b} <0,1,2,<('b':'NEW')> <0,1,2,<('b':'NEW')> <0,1,2>
8 {[0,1,2]} {$[1][0].b} <0,1,2> <0,1,2> <0,1,2>
} {
do_execsql_test json101-24.$id.insert {
SELECT json_insert($start,$path,'NEW');
} [list [tx $ins]]
do_execsql_test json101-24.$id.set {
SELECT json_set($start,$path,'NEW');
} [list [tx $set]]
do_execsql_test json101-24.$id.replace {
SELECT json_replace($start,$path,'NEW');
} [list [tx $repl]]
}
finish_test