Ai
8 Star 20 Fork 10

Gitee 极速下载/sqlite

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/sqlite/sqlite
克隆/下载
jsonb01.test 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
# 2023-11-15
#
# 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.
#
#***********************************************************************
# Test cases for JSONB
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_execsql_test jsonb01-1.1 {
CREATE TABLE t1(x JSON BLOB);
INSERT INTO t1 VALUES(jsonb('{a:5,b:{x:10,y:11},c:[1,2,3,4]}'));
}
foreach {id path res} {
1 {$.a} {{{"b":{"x":10,"y":11},"c":[1,2,3,4]}}}
2 {$.b} {{{"a":5,"c":[1,2,3,4]}}}
3 {$.c} {{{"a":5,"b":{"x":10,"y":11}}}}
4 {$.d} {{{"a":5,"b":{"x":10,"y":11},"c":[1,2,3,4]}}}
5 {$.b.x} {{{"a":5,"b":{"y":11},"c":[1,2,3,4]}}}
6 {$.b.y} {{{"a":5,"b":{"x":10},"c":[1,2,3,4]}}}
7 {$.c[0]} {{{"a":5,"b":{"x":10,"y":11},"c":[2,3,4]}}}
8 {$.c[1]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,3,4]}}}
9 {$.c[2]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,2,4]}}}
10 {$.c[3]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,2,3]}}}
11 {$.c[4]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,2,3,4]}}}
12 {$.c[#]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,2,3,4]}}}
13 {$.c[#-1]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,2,3]}}}
14 {$.c[#-2]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,2,4]}}}
15 {$.c[#-3]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,3,4]}}}
16 {$.c[#-4]} {{{"a":5,"b":{"x":10,"y":11},"c":[2,3,4]}}}
17 {$.c[#-5]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,2,3,4]}}}
18 {$.c[#-6]} {{{"a":5,"b":{"x":10,"y":11},"c":[1,2,3,4]}}}
} {
do_execsql_test jsonb01-1.2.$id.1 {
SELECT json(jsonb_remove(x,$path)) FROM t1;
} $res
do_execsql_test jsonb01-1.2.$id.2 {
SELECT json_remove(x,$path) FROM t1;
} $res
}
do_catchsql_test jsonb01-2.0 {
SELECT x'8ce6ffffffff171333' -> '$';
} {1 {malformed JSON}}
finish_test
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/mirrors/sqlite.git
git@gitee.com:mirrors/sqlite.git
mirrors
sqlite
sqlite
master

搜索帮助