mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-11-27 04:39:00 +00:00
9ed72eb5ae
This merges the version-3.45.1 tag from upstream SQLite git repository to libSQL with the following conflicts resolved: Conflicts: README.md ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java libsql-sqlite3/configure libsql-sqlite3/doc/jsonb.md libsql-sqlite3/ext/fts5/test/fts5faultH.test libsql-sqlite3/ext/fts5/test/fts5origintext.test libsql-sqlite3/ext/fts5/test/fts5origintext2.test libsql-sqlite3/ext/fts5/test/fts5origintext3.test libsql-sqlite3/ext/fts5/test/fts5origintext4.test libsql-sqlite3/ext/fts5/test/fts5origintext5.test libsql-sqlite3/ext/fts5/test/fts5secure8.test libsql-sqlite3/ext/fts5/test/fts5tokenizer2.test libsql-sqlite3/ext/fts5/test/fts5trigram2.test libsql-sqlite3/ext/jni/src/org/sqlite/jni/annotation/Experimental.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/capi/ConfigSqlLogCallback.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java libsql-sqlite3/ext/wasm/GNUmakefile libsql-sqlite3/ext/wasm/batch-runner-sahpool.html libsql-sqlite3/ext/wasm/batch-runner-sahpool.js libsql-sqlite3/src/pager.c libsql-sqlite3/src/shell.c.in libsql-sqlite3/src/sqliteInt.h libsql-sqlite3/src/wal.c libsql-sqlite3/test/fts3integrity.test libsql-sqlite3/test/json/jsonb-q1.txt libsql-sqlite3/test/json106.test libsql-sqlite3/test/json107.test libsql-sqlite3/test/jsonb01.test libsql-sqlite3/test/mmapcorrupt.test libsql-sqlite3/test/releasetest_data.tcl libsql-sqlite3/test/shell9.test libsql-sqlite3/test/wapp.tcl libsql-sqlite3/test/wapptest.tcl
68 lines
1.8 KiB
Plaintext
68 lines
1.8 KiB
Plaintext
# 2023-04-28
|
|
#
|
|
# 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.
|
|
#
|
|
#***********************************************************************
|
|
# This file implements tests for the JSON5 enhancements to the
|
|
# JSON SQL functions extension to the SQLite library.
|
|
#
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
set testprefix json502
|
|
|
|
ifcapable vtab {
|
|
|
|
do_execsql_test 1.1 {
|
|
CREATE TABLE t1(x JSON);
|
|
INSERT INTO t1(x) VALUES('{a:{b:{c:"hello",},},}');
|
|
SELECT fullkey FROM t1, json_tree(x);
|
|
} {{$} {$.a} {$.a.b} {$.a.b.c}}
|
|
|
|
}
|
|
|
|
do_execsql_test 2.1 {
|
|
SELECT json_error_position('{a:null,{"h":[1,[1,2,3]],"j":"abc"}:true}');
|
|
} 9
|
|
do_catchsql_test 2.2 {
|
|
SELECT json('{a:null,{"h":[1,[1,2,3]],"j":"abc"}:true}');
|
|
} {1 {malformed JSON}}
|
|
do_catchsql_test 2.3 {
|
|
SELECT '{a:null,{"h":[1,[1,2,3]],"j":"abc"}:true}'->'$h[#-1]';
|
|
} {1 {malformed JSON}}
|
|
|
|
# Verify that escaped label names are compared correctly.
|
|
#
|
|
do_execsql_test 3.1 {
|
|
SELECT '{"a\x62c":123}' ->> 'abc';
|
|
} 123
|
|
do_execsql_test 3.2 {
|
|
SELECT '{"abc":123}' ->> 'a\x62c';
|
|
} 123
|
|
|
|
db null null
|
|
do_execsql_test 3.3 {
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1(x);
|
|
INSERT INTO t1 VALUES(json_insert('{}','$.a\',111,'$."b\\"',222));
|
|
INSERT INTO t1 VALUES(jsonb_insert('{}','$.a\',111,'$."b\\"',222));
|
|
SELECT x->'$.a\', x->'$.a\\', x->'$."a\\"', x->'$."b\\"' FROM t1;
|
|
} {111 null 111 222 111 null 111 222}
|
|
|
|
do_execsql_test 3.4 {
|
|
SELECT json_patch('{"a\x62c":123}','{"ab\x63":456}') ->> 'abc';
|
|
} 456
|
|
|
|
ifcapable vtab {
|
|
do_execsql_test 4.1 {
|
|
SELECT * FROM json_tree('{"\u0017":1}','$."\x17"');
|
|
} {{\x17} 1 integer 1 1 null {$."\x17"} {$}}
|
|
}
|
|
|
|
finish_test
|