mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Correct handling of "raw" strings in JSON. This requires three test-case
changes in TH3 to add double-quotes to the path outputs from json_tree(). The new behavior is correct, I believe. FossilOrigin-Name: ab2bf3e3596dfa7566f4a130adeccbef4056c7321181112a875477193583f30c
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Improved\serror\sdetection\sfor\sJSONB\sinputs.
|
C Correct\shandling\sof\s"raw"\sstrings\sin\sJSON.\s\sThis\srequires\sthree\stest-case\nchanges\sin\sTH3\sto\sadd\sdouble-quotes\sto\sthe\spath\soutputs\sfrom\sjson_tree().\nThe\snew\sbehavior\sis\scorrect,\sI\sbelieve.
|
||||||
D 2023-10-06T22:16:09.559
|
D 2023-10-06T23:02:06.178
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@@ -670,7 +670,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
|
|||||||
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
|
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
|
||||||
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||||
F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276
|
F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276
|
||||||
F src/json.c b806a942b8abe97c95eef416fe6b467687e3b6452db35bf53746b19bd6800d5f
|
F src/json.c 4d2527a8f01797bc4a83ca282f4ea82a5e4a1fdbb05260df241a4a76d2e610b9
|
||||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||||
F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0
|
F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0
|
||||||
F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40
|
F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40
|
||||||
@@ -2124,8 +2124,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P fe326829c27715e249f727ba797c7df6491e874ec205a0a82ee09c78d61c6e1f
|
P 6945e11aa441ace52b93cdbb81ac45b6f809987f3dbc522251e63f8cb948fddd
|
||||||
R 37a35a123339c5edc35b6af8c811707d
|
R 9a8ad0594c72d0104c485b0093cb4da0
|
||||||
U drh
|
U drh
|
||||||
Z 5c69847c848dbc8186c5994996d772c2
|
Z 53c0ada212c66efecbd15c380158c623
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
6945e11aa441ace52b93cdbb81ac45b6f809987f3dbc522251e63f8cb948fddd
|
ab2bf3e3596dfa7566f4a130adeccbef4056c7321181112a875477193583f30c
|
||||||
28
src/json.c
28
src/json.c
@@ -910,13 +910,7 @@ static void jsonRenderNodeAsText(
|
|||||||
case JSON_STRING: {
|
case JSON_STRING: {
|
||||||
assert( pNode->eU==1 );
|
assert( pNode->eU==1 );
|
||||||
if( pNode->jnFlags & JNODE_RAW ){
|
if( pNode->jnFlags & JNODE_RAW ){
|
||||||
if( pNode->jnFlags & JNODE_LABEL ){
|
jsonAppendString(pOut, pNode->u.zJContent, pNode->n);
|
||||||
jsonAppendChar(pOut, '"');
|
|
||||||
jsonAppendRaw(pOut, pNode->u.zJContent, pNode->n);
|
|
||||||
jsonAppendChar(pOut, '"');
|
|
||||||
}else{
|
|
||||||
jsonAppendString(pOut, pNode->u.zJContent, pNode->n);
|
|
||||||
}
|
|
||||||
}else if( pNode->jnFlags & JNODE_JSON5 ){
|
}else if( pNode->jnFlags & JNODE_JSON5 ){
|
||||||
jsonAppendNormalizedString(pOut, pNode->u.zJContent, pNode->n);
|
jsonAppendNormalizedString(pOut, pNode->u.zJContent, pNode->n);
|
||||||
}else{
|
}else{
|
||||||
@@ -1564,7 +1558,7 @@ json_parse_restart:
|
|||||||
){
|
){
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
jsonParseAddNode(pParse, JSON_STRING | (JNODE_RAW<<8), k-j, &z[j]);
|
jsonParseAddNode(pParse, JSON_STRING, k-j, &z[j]);
|
||||||
pParse->hasNonstd = 1;
|
pParse->hasNonstd = 1;
|
||||||
x = k;
|
x = k;
|
||||||
}else{
|
}else{
|
||||||
@@ -3373,6 +3367,10 @@ static u32 jsonRenderBlob(
|
|||||||
jsonAppendChar(pOut, '"');
|
jsonAppendChar(pOut, '"');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case JSONB_TEXTRAW: {
|
||||||
|
jsonAppendString(pOut, (const char*)&pParse->aBlob[i+n], sz);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case JSONB_ARRAY: {
|
case JSONB_ARRAY: {
|
||||||
jsonAppendChar(pOut, '[');
|
jsonAppendChar(pOut, '[');
|
||||||
j = i+n;
|
j = i+n;
|
||||||
@@ -3481,10 +3479,14 @@ static int jsonParseValueFromBlob(JsonParse *pParse, u32 i){
|
|||||||
jsonParseAddNode(pParse, JSON_REAL | (JNODE_JSON5<<8), sz, zPayload);
|
jsonParseAddNode(pParse, JSON_REAL | (JNODE_JSON5<<8), sz, zPayload);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JSONB_TEXT: {
|
case JSONB_TEXTRAW: {
|
||||||
jsonParseAddNode(pParse, JSON_STRING | (JNODE_RAW<<8), sz, zPayload);
|
jsonParseAddNode(pParse, JSON_STRING | (JNODE_RAW<<8), sz, zPayload);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case JSONB_TEXT: {
|
||||||
|
jsonParseAddNode(pParse, JSON_STRING, sz, zPayload);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case JSONB_TEXTJ: {
|
case JSONB_TEXTJ: {
|
||||||
jsonParseAddNode(pParse, JSON_STRING | (JNODE_ESCAPE<<8), sz, zPayload);
|
jsonParseAddNode(pParse, JSON_STRING | (JNODE_ESCAPE<<8), sz, zPayload);
|
||||||
break;
|
break;
|
||||||
@@ -3495,10 +3497,6 @@ static int jsonParseValueFromBlob(JsonParse *pParse, u32 i){
|
|||||||
sz, zPayload);
|
sz, zPayload);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JSONB_TEXTRAW: {
|
|
||||||
jsonParseAddNode(pParse, JSON_STRING | (JNODE_RAW<<8), sz, zPayload);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case JSONB_ARRAY: {
|
case JSONB_ARRAY: {
|
||||||
int iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
|
int iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
|
||||||
u32 j = i+x;
|
u32 j = i+x;
|
||||||
@@ -3529,6 +3527,10 @@ static int jsonParseValueFromBlob(JsonParse *pParse, u32 i){
|
|||||||
if( k&1 ) return -1;
|
if( k&1 ) return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
|
pParse->nErr++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return i+x+sz;
|
return i+x+sz;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user