sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / test / json / json-q1.txt
| 1 | .mode qbox |
| 2 | .timer on |
| 3 | .param set $label 'q87' |
| 4 | SELECT rowid, x->>$label FROM data1 WHERE x->>$label IS NOT NULL; |
| 5 | |
| 6 | CREATE TEMP TABLE t2(x JSON TEXT); |
| 7 | WITH RECURSIVE |
| 8 | c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<25000), |
| 9 | array1(y) AS ( |
| 10 | SELECT json_group_array( |
| 11 | json_object('x',x,'y',random(),'z',hex(randomblob(50))) |
| 12 | ) |
| 13 | FROM c |
| 14 | ), |
| 15 | c2(n) AS (VALUES(1) UNION ALL SELECT n+1 FROM c2 WHERE n<5) |
| 16 | INSERT INTO t2(x) |
| 17 | SELECT json_object('a',n,'b',n*2,'c',y,'d',3,'e',5,'f',6) FROM array1, c2; |
| 18 | CREATE INDEX t2x1 ON t2(x->>'a'); |
| 19 | CREATE INDEX t2x2 ON t2(x->>'b'); |
| 20 | CREATE INDEX t2x3 ON t2(x->>'e'); |
| 21 | CREATE INDEX t2x4 ON t2(x->>'f'); |
| 22 | UPDATE t2 SET x=json_replace(x,'$.f',(x->>'f')+1); |
| 23 | UPDATE t2 SET x=json_set(x,'$.e',(x->>'f')-1); |
| 24 | UPDATE t2 SET x=json_remove(x,'$.d'); |