aboutsummaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authordrh <>2023-11-28 20:33:20 +0000
committerdrh <>2023-11-28 20:33:20 +0000
commit1ef232c0e1e10d17f58bfea678c0c2774e7f29ab (patch)
tree688a3d95a3f4ffeb9a9b9270e5c2579678197c17 /src/json.c
parent1cab41e2906130ec64af0381d5a31f017133b248 (diff)
downloadsqlite-1ef232c0e1e10d17f58bfea678c0c2774e7f29ab.tar.gz
sqlite-1ef232c0e1e10d17f58bfea678c0c2774e7f29ab.zip
Preserve flexibility in the format of the RHS of -> and ->> operators found
in legacy. FossilOrigin-Name: 6231ec43adb7436195eb1497de39a6c13c6b4f1c5032e6ea52515d214e61fdbc
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c
index c259ae1d8..6d1cf0e40 100644
--- a/src/json.c
+++ b/src/json.c
@@ -4701,6 +4701,7 @@ static void jsonExtractFunc(
for(i=1; i<argc; i++){
/* With a single PATH argument */
const char *zPath = (const char*)sqlite3_value_text(argv[i]);
+ int nPath = sqlite3_value_bytes(argv[i]);
u32 j;
if( zPath==0 ) goto json_extract_error;
if( zPath[0]=='$' ){
@@ -4717,12 +4718,14 @@ static void jsonExtractFunc(
jsonStringInit(&jx, ctx);
if( sqlite3Isdigit(zPath[0]) ){
jsonAppendRawNZ(&jx, "[", 1);
- jsonAppendRaw(&jx, zPath, (int)strlen(zPath));
+ jsonAppendRaw(&jx, zPath, nPath);
jsonAppendRawNZ(&jx, "]", 2);
}else if( zPath[0]!='[' ){
jsonAppendRawNZ(&jx, ".", 1);
- jsonAppendRaw(&jx, zPath, (int)strlen(zPath));
+ jsonAppendRaw(&jx, zPath, nPath);
jsonAppendChar(&jx, 0);
+ }else{
+ jsonAppendRaw(&jx, zPath, nPath);
}
jsonStringTerminate(&jx);
j = jsonLookupBlobStep(p, 0, jx.zBuf, 0);