]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix the path lookup for objects so that it can handle quoted identifier
authordrh <drh@noemail.net>
Wed, 19 Aug 2015 23:02:49 +0000 (23:02 +0000)
committerdrh <drh@noemail.net>
Wed, 19 Aug 2015 23:02:49 +0000 (23:02 +0000)
names and non-alphanumerics in the identifier.

FossilOrigin-Name: 87f5873004f69396baa7c67937342b4e32f79bda

ext/misc/json.c
manifest
manifest.uuid

index 7e1d210e3701acd6cf34f70f5a099ef58b2a1f80..77bc6d67941977aefcc4eaf8d5d531aefccb4fc0 100644 (file)
@@ -703,19 +703,29 @@ static JsonNode *jsonLookup(
   const char *zPath,      /* The path to search */
   int *pApnd              /* Append nodes to complete path if not NULL */
 ){
-  u32 i, j, k;
+  u32 i, j, k, nKey;
+  const char *zKey;
   JsonNode *pRoot = &pParse->aNode[iRoot];
   if( zPath[0]==0 ) return pRoot;
   if( zPath[0]=='.' ){
     if( pRoot->eType!=JSON_OBJECT ) return 0;
     zPath++;
-    for(i=0; isalnum(zPath[i]); i++){}
-    if( i==0 ) return 0;
+    if( zPath[0]=='"' ){
+      zKey = zPath + 1;
+      for(i=1; zPath[i] && zPath[i]!='"'; i++){}
+      nKey = i-1;
+      if( zPath[i] ) i++;
+    }else{
+      zKey = zPath;
+      for(i=0; zPath[i] && zPath[i]!='.' && zPath[i]!='['; i++){}
+      nKey = i;
+    }
+    if( nKey==0 ) return 0;
     j = 1;
     for(;;){
       while( j<=pRoot->n ){
-        if( pRoot[j].n==i+2
-         && strncmp(&pRoot[j].u.zJContent[1],zPath,i)==0
+        if( pRoot[j].n==nKey+2
+         && strncmp(&pRoot[j].u.zJContent[1],zKey,nKey)==0
         ){
           return jsonLookup(pParse, iRoot+j+1, &zPath[i], pApnd);
         }
index d5dc07e75eb7950fdbbda8e6bfc5625acf994a63..28efbe568582e41f313e91eccc8567cb0d94389f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\sjson_each(JSON,PATH)\stable-valued-function.
-D 2015-08-19T22:47:17.476
+C Fix\sthe\spath\slookup\sfor\sobjects\sso\sthat\sit\scan\shandle\squoted\sidentifier\nnames\sand\snon-alphanumerics\sin\sthe\sidentifier.
+D 2015-08-19T23:02:49.082
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 90f3097efb9a53f5fc59a4f8a08be07cf9f52c02
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -192,7 +192,7 @@ F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
 F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
 F ext/misc/fuzzer.c 4c84635c71c26cfa7c2e5848cf49fe2d2cfcd767
 F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e
-F ext/misc/json.c 57a9f747b2813edc5f481eb808889d304a1c5f79
+F ext/misc/json.c 8654245a5d5aeb499fb0c00abce53f3836d52c20
 F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
 F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
@@ -1378,7 +1378,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P a06a6392bd48baa8b9bac2624869c0cc7da7e779
-R 43d8c9f353202a0c5a0252660436f9ac
+P 3335ac17bbcb09dc915173d69bf42048f84ad563
+R bd9ac56614e747436a95e2948b6eea19
 U drh
-Z 41b78b71d0425818407424da18ee9720
+Z b6a64887dfaaae356da3f82cf4115061
index a1d2dfbb42d022766e46e9596fceb9667b5c623b..40c8eba985244bd63d936a292729fd036ff5eb0b 100644 (file)
@@ -1 +1 @@
-3335ac17bbcb09dc915173d69bf42048f84ad563
\ No newline at end of file
+87f5873004f69396baa7c67937342b4e32f79bda
\ No newline at end of file