-C Miscellaneous\sbugs\sfixed.
-D 2023-09-28T17:07:43.443
+C Extract\sdirectly\sfrom\sBLOB\sis\snow\scomplete\sand\sappears\sto\swork.
+D 2023-09-28T17:23:46.244
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276
-F src/json.c 946e0bbc5070db333a370e2f7b806ad07d2e9fb93d057cf52a9e5fb58fd43768
+F src/json.c 7e68346bfc4f030e454c68751ab7082af52b9925ff28bff88eef03258e486d7c
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0
F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 8c82576176539c4d132b14d46adbf31366c4bcaa59a61dd639dc9cc308fe8825
-R e6233e4f5d16d81e42c25a8ff039c998
+P 5c0815fa2e422d81198a43a2c04a022e319fcbcadfd4be4437f2e663892ca26b
+R 0d79abb184ac0c9db2e32b0ee612448c
U drh
-Z beeeb6a9ecf43431f000f927a20c9a15
+Z dfb6861bdfa5add7990cbc313b482bb0
# Remove this line to create a well-formed Fossil manifest.
}
}
+/*
+** 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()
*/
}
if( j>iEnd ) return JSON_BLOB_ERROR;
}else if( zPath[0]=='[' ){
+ x = pParse->aBlob[iRoot] & 0x0f;
+ if( x!=JSONB_ARRAY ) return JSON_BLOB_NOTFOUND;
+ n = jsonbPayloadSize(pParse, iRoot, &sz);
k = 0;
i = 1;
while( sqlite3Isdigit(zPath[i]) ){
i++;
}
if( i<2 || zPath[i]!=']' ){
-#if 0
if( zPath[1]=='#' ){
- JsonNode *pBase = pRoot;
- int iBase = iRoot;
- 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;
+ k = jsonbArrayCount(pParse, iRoot);
+ i = 2;
if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){
unsigned int x = 0;
- j = 3;
+ i = 3;
do{
- x = x*10 + zPath[j] - '0';
- j++;
- }while( sqlite3Isdigit(zPath[j]) );
- if( x>i ) return 0;
- i -= x;
+ x = x*10 + zPath[i] - '0';
+ i++;
+ }while( sqlite3Isdigit(zPath[i]) );
+ if( x>k ) return 0;
+ k -= x;
}
- if( zPath[j]!=']' ){
+ if( zPath[i]!=']' ){
*pzErr = zPath;
- return 0;
+ return JSON_BLOB_PATHERROR;
}
}else{
*pzErr = zPath;
- return 0;
+ return JSON_BLOB_PATHERROR;
}
-#endif
- *pzErr = zPath;
- return JSON_BLOB_PATHERROR;
}
- x = pParse->aBlob[iRoot] & 0x0f;
- if( x!=JSONB_ARRAY ) return JSON_BLOB_NOTFOUND;
- n = jsonbPayloadSize(pParse, iRoot, &sz);
j = iRoot+n;
iEnd = j+sz;
while( j<iEnd ){