1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add the json_ntype() SQL function. Works like the 1-argument json_type()

except that it returns NULL if the argument is not well-formed JSON, rather
than raising an error.

FossilOrigin-Name: ed9956f5ddca68141eded81d5362847db603257329801622c4eb3b0732112f14
This commit is contained in:
drh
2022-01-07 16:03:00 +00:00
parent 12b9fa979c
commit a4e4e18494
4 changed files with 24 additions and 11 deletions

View File

@@ -176,6 +176,9 @@ do_execsql_test json102-500 {
do_execsql_test json102-510 {
SELECT json_type('{"a":[2,3.5,true,false,null,"x"]}');
} {{object}}
do_execsql_test json102-511 {
SELECT json_ntype('{"a":[2,3.5,true,false,null,"x"]}');
} {{object}}
do_execsql_test json102-520 {
SELECT json_type('{"a":[2,3.5,true,false,null,"x"]}','$');
} {{object}}
@@ -209,6 +212,12 @@ do_execsql_test json102-610 {
do_execsql_test json102-620 {
SELECT json_valid(char(123)||'"x":35');
} {{0}}
do_catchsql_test json102-630 {
SELECT json_type('["a",');
} {1 {malformed JSON}}
do_catchsql_test json102-631 {
SELECT json_ntype('["a",');
} {0 {{}}}
ifcapable vtab {
do_execsql_test json102-1000 {