json_error_position() now uses jsonValidityCheck() to find the approximate
position of an error in a JSONB blob. FossilOrigin-Name: c3d60cf7028a333b825d5b89516945a73e0c158ac81d8bcc117d21bfd98602c8
This commit is contained in:
parent
001caa714f
commit
5a890b4ed2
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C json_valid(*,8)\sallows\sminus-signs\son\shexadecimal\sliterals.
|
||||
D 2023-12-11T20:19:10.982
|
||||
C json_error_position()\snow\suses\sjsonValidityCheck()\sto\sfind\sthe\sapproximate\nposition\sof\san\serror\sin\sa\sJSONB\sblob.
|
||||
D 2023-12-11T20:44:21.543
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -696,7 +696,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
|
||||
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
|
||||
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||
F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276
|
||||
F src/json.c d0c018e1d9dba58c09518b15b4d0a1847bc8be7f7f050524618b486c8e286db8
|
||||
F src/json.c 191626c46afe3325a01c1a77b7aef6b10b8dc8a76c38757adeca89e51a4248db
|
||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||
F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36
|
||||
F src/main.c ce714ee501122c76eb2e69b292bebe443aba611fc3b88e6786eb910285515fe4
|
||||
@ -2153,8 +2153,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 4d14e733bb521aed65e98533969d2303738232ae87dab70fdf7962e6513195f5
|
||||
R a882161352f3e912beb8ce222b601993
|
||||
P c0d7f4520d839a268b3fd2474d0897a9832aa608bd6238b3e287fabecf07a350
|
||||
R 3b1676d0420fc714545bd48a8af4a295
|
||||
U drh
|
||||
Z 09da734bc01fda75ed726fff4da7e465
|
||||
Z 901bf4bbda4e9c3a1530e623c45e3a19
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
c0d7f4520d839a268b3fd2474d0897a9832aa608bd6238b3e287fabecf07a350
|
||||
c3d60cf7028a333b825d5b89516945a73e0c158ac81d8bcc117d21bfd98602c8
|
14
src/json.c
14
src/json.c
@ -4170,9 +4170,9 @@ static void jsonValidFunc(
|
||||
**
|
||||
** If the argument is NULL, return NULL
|
||||
**
|
||||
** If the argument is BLOB, do a fast validity check and return non-zero
|
||||
** if the check fails. The returned value does not indicate where in the
|
||||
** BLOB the error occurs.
|
||||
** If the argument is BLOB, do a full validity check and return non-zero
|
||||
** if the check fails. The return value is the approximate 1-based offset
|
||||
** to the byte of the element that contains the first error.
|
||||
**
|
||||
** Otherwise interpret the argument is TEXT (even if it is numeric) and
|
||||
** return the 1-based character position for where the parser first recognized
|
||||
@ -4191,15 +4191,9 @@ static void jsonErrorFunc(
|
||||
UNUSED_PARAMETER(argc);
|
||||
memset(&s, 0, sizeof(s));
|
||||
if( jsonFuncArgMightBeBinary(argv[0]) ){
|
||||
JsonString out;
|
||||
jsonStringInit(&out, 0);
|
||||
s.aBlob = (u8*)sqlite3_value_blob(argv[0]);
|
||||
s.nBlob = sqlite3_value_bytes(argv[0]);
|
||||
jsonXlateBlobToText(&s, 0, &out);
|
||||
if( out.eErr ){
|
||||
iErrPos = (out.eErr & JSTRING_MALFORMED)!=0 ? 1 : -1;
|
||||
}
|
||||
jsonStringReset(&out);
|
||||
iErrPos = (i64)jsonbValidityCheck(&s, 0, s.nBlob, 0);
|
||||
}else{
|
||||
s.zJson = (char*)sqlite3_value_text(argv[0]);
|
||||
if( s.zJson==0 ) return; /* NULL input or OOM */
|
||||
|
Loading…
x
Reference in New Issue
Block a user