mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Preserve flexibility in the format of the RHS of -> and ->> operators found
in legacy. FossilOrigin-Name: 6231ec43adb7436195eb1497de39a6c13c6b4f1c5032e6ea52515d214e61fdbc
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user