1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Extract directly from BLOB is now complete and appears to work.

FossilOrigin-Name: 3de58ec99444b16dfcda1e226420e2343450b77abd3faf33a88b6d18339ef17c
This commit is contained in:
drh
2023-09-28 17:23:46 +00:00
parent 59862e6d22
commit 6b1db92228
3 changed files with 36 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
C Miscellaneous\sbugs\sfixed. C Extract\sdirectly\sfrom\sBLOB\sis\snow\scomplete\sand\sappears\sto\swork.
D 2023-09-28T17:07:43.443 D 2023-09-28T17:23:46.244
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 946e0bbc5070db333a370e2f7b806ad07d2e9fb93d057cf52a9e5fb58fd43768 F src/json.c 7e68346bfc4f030e454c68751ab7082af52b9925ff28bff88eef03258e486d7c
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
@@ -2123,8 +2123,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 8c82576176539c4d132b14d46adbf31366c4bcaa59a61dd639dc9cc308fe8825 P 5c0815fa2e422d81198a43a2c04a022e319fcbcadfd4be4437f2e663892ca26b
R e6233e4f5d16d81e42c25a8ff039c998 R 0d79abb184ac0c9db2e32b0ee612448c
U drh U drh
Z beeeb6a9ecf43431f000f927a20c9a15 Z dfb6861bdfa5add7990cbc313b482bb0
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
5c0815fa2e422d81198a43a2c04a022e319fcbcadfd4be4437f2e663892ca26b 3de58ec99444b16dfcda1e226420e2343450b77abd3faf33a88b6d18339ef17c

View File

@@ -3507,6 +3507,21 @@ static void jsonRenderNodeAsBlob(
} }
} }
/*
** Given that a JSONB_ARRAY object starts at offset i, return
** the number of entries in that array.
*/
static u32 jsonbArrayCount(JsonParse *pParse, u32 iRoot){
u32 n, sz, i, iEnd;
u32 k = 0;
n = jsonbPayloadSize(pParse, iRoot, &sz);
iEnd = iRoot+n+sz;
for(i=iRoot+n; i<iEnd; i+=sz+n, k++){
n = jsonbPayloadSize(pParse, i, &sz);
}
return k;
}
/* /*
** Error returns from jsonLookupBlobStep() ** Error returns from jsonLookupBlobStep()
*/ */
@@ -3579,6 +3594,9 @@ static u32 jsonLookupBlobStep(
} }
if( j>iEnd ) return JSON_BLOB_ERROR; if( j>iEnd ) return JSON_BLOB_ERROR;
}else if( zPath[0]=='[' ){ }else if( zPath[0]=='[' ){
x = pParse->aBlob[iRoot] & 0x0f;
if( x!=JSONB_ARRAY ) return JSON_BLOB_NOTFOUND;
n = jsonbPayloadSize(pParse, iRoot, &sz);
k = 0; k = 0;
i = 1; i = 1;
while( sqlite3Isdigit(zPath[i]) ){ while( sqlite3Isdigit(zPath[i]) ){
@@ -3586,49 +3604,28 @@ static u32 jsonLookupBlobStep(
i++; i++;
} }
if( i<2 || zPath[i]!=']' ){ if( i<2 || zPath[i]!=']' ){
#if 0
if( zPath[1]=='#' ){ if( zPath[1]=='#' ){
JsonNode *pBase = pRoot; k = jsonbArrayCount(pParse, iRoot);
int iBase = iRoot; i = 2;
if( pRoot->eType!=JSON_ARRAY ) return 0;
for(;;){
while( j<=pBase->n ){
if( (pBase[j].jnFlags & JNODE_REMOVE)==0 || pParse->useMod==0 ) i++;
j += jsonNodeSize(&pBase[j]);
}
if( (pBase->jnFlags & JNODE_APPEND)==0 ) break;
if( pParse->useMod==0 ) break;
assert( pBase->eU==2 );
iBase = pBase->u.iAppend;
pBase = &pParse->aNode[iBase];
j = 1;
}
j = 2;
if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){ if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){
unsigned int x = 0; unsigned int x = 0;
j = 3; i = 3;
do{ do{
x = x*10 + zPath[j] - '0'; x = x*10 + zPath[i] - '0';
j++; i++;
}while( sqlite3Isdigit(zPath[j]) ); }while( sqlite3Isdigit(zPath[i]) );
if( x>i ) return 0; if( x>k ) return 0;
i -= x; k -= x;
} }
if( zPath[j]!=']' ){ if( zPath[i]!=']' ){
*pzErr = zPath;
return 0;
}
}else{
*pzErr = zPath;
return 0;
}
#endif
*pzErr = zPath; *pzErr = zPath;
return JSON_BLOB_PATHERROR; return JSON_BLOB_PATHERROR;
} }
x = pParse->aBlob[iRoot] & 0x0f; }else{
if( x!=JSONB_ARRAY ) return JSON_BLOB_NOTFOUND; *pzErr = zPath;
n = jsonbPayloadSize(pParse, iRoot, &sz); return JSON_BLOB_PATHERROR;
}
}
j = iRoot+n; j = iRoot+n;
iEnd = j+sz; iEnd = j+sz;
while( j<iEnd ){ while( j<iEnd ){