aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/misc/json1.c73
-rw-r--r--main.mk6
-rw-r--r--manifest16
-rw-r--r--manifest.uuid2
-rw-r--r--test/permutations.test2
5 files changed, 49 insertions, 50 deletions
diff --git a/ext/misc/json1.c b/ext/misc/json1.c
index d51d69e1e..755d035c3 100644
--- a/ext/misc/json1.c
+++ b/ext/misc/json1.c
@@ -1444,7 +1444,7 @@ struct JsonEachCursor {
u8 eType; /* Type of top-level element */
u8 bRecursive; /* True for json_tree(). False for json_each() */
char *zJson; /* Input JSON */
- char *zPath; /* Path by which to filter zJson */
+ char *zRoot; /* Path by which to filter zJson */
JsonParse sParse; /* Parse of the input JSON */
};
@@ -1467,16 +1467,17 @@ static int jsonEachConnect(
#define JEACH_ID 4
#define JEACH_PARENT 5
#define JEACH_FULLKEY 6
-#define JEACH_JSON 7
-#define JEACH_PATH 8
+#define JEACH_PATH 7
+#define JEACH_JSON 8
+#define JEACH_ROOT 9
UNUSED_PARAM(pzErr);
UNUSED_PARAM(argv);
UNUSED_PARAM(argc);
UNUSED_PARAM(pAux);
rc = sqlite3_declare_vtab(db,
- "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,"
- "json HIDDEN,path HIDDEN)");
+ "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,"
+ "json HIDDEN,root HIDDEN)");
if( rc==SQLITE_OK ){
pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
if( pNew==0 ) return SQLITE_NOMEM;
@@ -1517,14 +1518,14 @@ static int jsonEachOpenTree(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
** held. */
static void jsonEachCursorReset(JsonEachCursor *p){
sqlite3_free(p->zJson);
- sqlite3_free(p->zPath);
+ sqlite3_free(p->zRoot);
jsonParseReset(&p->sParse);
p->iRowid = 0;
p->i = 0;
p->iEnd = 0;
p->eType = 0;
p->zJson = 0;
- p->zPath = 0;
+ p->zRoot = 0;
}
/* Destructor for a jsonEachCursor object */
@@ -1668,8 +1669,8 @@ static int jsonEachColumn(
if( p->bRecursive ){
jsonEachComputePath(p, &x, p->i);
}else{
- if( p->zPath ){
- jsonAppendRaw(&x, p->zPath, (int)strlen(p->zPath));
+ if( p->zRoot ){
+ jsonAppendRaw(&x, p->zRoot, (int)strlen(p->zRoot));
}else{
jsonAppendChar(&x, '$');
}
@@ -1683,18 +1684,20 @@ static int jsonEachColumn(
break;
}
case JEACH_PATH: {
- const char *zPath = p->zPath;
- if( zPath==0 ){
- if( p->bRecursive ){
- JsonString x;
- jsonInit(&x, ctx);
- jsonEachComputePath(p, &x, p->sParse.aUp[p->i]);
- jsonResult(&x);
- break;
- }
- zPath = "$";
+ if( p->bRecursive ){
+ JsonString x;
+ jsonInit(&x, ctx);
+ jsonEachComputePath(p, &x, p->sParse.aUp[p->i]);
+ jsonResult(&x);
+ break;
}
- sqlite3_result_text(ctx, zPath, -1, SQLITE_STATIC);
+ /* For json_each() path and root are the same so fall through
+ ** into the root case */
+ }
+ case JEACH_ROOT: {
+ const char *zRoot = p->zRoot;
+ if( zRoot==0 ) zRoot = "$";
+ sqlite3_result_text(ctx, zRoot, -1, SQLITE_STATIC);
break;
}
default: {
@@ -1715,7 +1718,7 @@ static int jsonEachRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
/* The query strategy is to look for an equality constraint on the json
** column. Without such a constraint, the table cannot operate. idxNum is
-** 1 if the constraint is found, 3 if the constraint and zPath are found,
+** 1 if the constraint is found, 3 if the constraint and zRoot are found,
** and 0 otherwise.
*/
static int jsonEachBestIndex(
@@ -1724,7 +1727,7 @@ static int jsonEachBestIndex(
){
int i;
int jsonIdx = -1;
- int pathIdx = -1;
+ int rootIdx = -1;
const struct sqlite3_index_constraint *pConstraint;
UNUSED_PARAM(tab);
@@ -1734,7 +1737,7 @@ static int jsonEachBestIndex(
if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
switch( pConstraint->iColumn ){
case JEACH_JSON: jsonIdx = i; break;
- case JEACH_PATH: pathIdx = i; break;
+ case JEACH_ROOT: rootIdx = i; break;
default: /* no-op */ break;
}
}
@@ -1745,11 +1748,11 @@ static int jsonEachBestIndex(
pIdxInfo->estimatedCost = 1.0;
pIdxInfo->aConstraintUsage[jsonIdx].argvIndex = 1;
pIdxInfo->aConstraintUsage[jsonIdx].omit = 1;
- if( pathIdx<0 ){
+ if( rootIdx<0 ){
pIdxInfo->idxNum = 1;
}else{
- pIdxInfo->aConstraintUsage[pathIdx].argvIndex = 2;
- pIdxInfo->aConstraintUsage[pathIdx].omit = 1;
+ pIdxInfo->aConstraintUsage[rootIdx].argvIndex = 2;
+ pIdxInfo->aConstraintUsage[rootIdx].omit = 1;
pIdxInfo->idxNum = 3;
}
}
@@ -1764,7 +1767,7 @@ static int jsonEachFilter(
){
JsonEachCursor *p = (JsonEachCursor*)cur;
const char *z;
- const char *zPath;
+ const char *zRoot;
sqlite3_int64 n;
UNUSED_PARAM(idxStr);
@@ -1774,11 +1777,11 @@ static int jsonEachFilter(
z = (const char*)sqlite3_value_text(argv[0]);
if( z==0 ) return SQLITE_OK;
if( idxNum&2 ){
- zPath = (const char*)sqlite3_value_text(argv[1]);
- if( zPath==0 ) return SQLITE_OK;
- if( zPath[0]!='$' ){
+ zRoot = (const char*)sqlite3_value_text(argv[1]);
+ if( zRoot==0 ) return SQLITE_OK;
+ if( zRoot[0]!='$' ){
sqlite3_free(cur->pVtab->zErrMsg);
- cur->pVtab->zErrMsg = jsonPathSyntaxError(zPath);
+ cur->pVtab->zErrMsg = jsonPathSyntaxError(zRoot);
return cur->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM;
}
}
@@ -1803,10 +1806,10 @@ static int jsonEachFilter(
if( idxNum==3 ){
const char *zErr = 0;
n = sqlite3_value_bytes(argv[1]);
- p->zPath = sqlite3_malloc64( n+1 );
- if( p->zPath==0 ) return SQLITE_NOMEM;
- memcpy(p->zPath, zPath, (size_t)n+1);
- pNode = jsonLookupStep(&p->sParse, 0, p->zPath+1, 0, &zErr);
+ p->zRoot = sqlite3_malloc64( n+1 );
+ if( p->zRoot==0 ) return SQLITE_NOMEM;
+ memcpy(p->zRoot, zRoot, (size_t)n+1);
+ pNode = jsonLookupStep(&p->sParse, 0, p->zRoot+1, 0, &zErr);
if( p->sParse.nErr ){
sqlite3_free(cur->pVtab->zErrMsg);
cur->pVtab->zErrMsg = jsonPathSyntaxError(zErr);
diff --git a/main.mk b/main.mk
index cec4d3df4..3668c8432 100644
--- a/main.mk
+++ b/main.mk
@@ -332,11 +332,7 @@ TESTSRC += \
$(TOP)/ext/misc/vfslog.c \
$(TOP)/ext/fts5/fts5_tcl.c \
$(TOP)/ext/fts5/fts5_test_mi.c \
- $(FTS5_SRC)
-
-
-# fts5.c
-
+ fts5.c
#TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
diff --git a/manifest b/manifest
index f78303a53..6d894da74 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Increment\sthe\sfts5\sversion\svalue\sto\sindicate\sthat\sthe\son-disk\sformat\shas\schanged.
-D 2015-09-10T16:39:38.823
+C Modify\sthe\sfts5\sleaf\spage\sformat\sto\spermit\sfaster\sseek\soperations.\sThis\sis\sa\sfile-format\schange.\sAny\sexisting\sdatabases\scan\sbe\supgraded\sby\srunning\sthe\sfts5\s'rebuild'\scommand.
+D 2015-09-10T17:23:37.872
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in f85066ce844a28b671aaeeff320921cd0ce36239
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -195,7 +195,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/json1.c 46c2aff110eb8241591cd29267ddb57a8d0ab337
+F ext/misc/json1.c 4387d091c0ec0f4d9ed05560960f03d366db4fe0
F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
@@ -261,7 +261,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
-F main.mk 354f24951fcc2efd62aef684f2ae44e1128bfbeb
+F main.mk 58eb74de702467c3b71cdf06f213cefe7f5ce544
F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
F mkopcodeh.awk 0e7f04a8eb90f92259e47d80110e4e98d7ce337a
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
@@ -920,7 +920,7 @@ F test/parser1.test 222b5cbf3e2e659fec1bf7d723488c8b9c94f1d0
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
-F test/permutations.test 3c66f062605c63e30ce00a693e607dc2518a006a
+F test/permutations.test ac3b00c299250cc087d4a527b5c75a0f8aef4e54
F test/pragma.test be7195f0aa72bdb8a512133e9640ac40f15b57a2
F test/pragma2.test 8e72df3a16c0fda748ad52abf79cb8256b04a6fe
F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
@@ -1385,7 +1385,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 4931e37da4d2c26d7afc5432f7f0d534b51a85fa
-R eed5bbc75e101ddc9b925dace5d76427
+P 127cce3eb96b819005832997e0a082df9fb96f0b 99de5e3613d557728dd196353516bc7cf64a0e6c
+R 94d00b9df8244e9367669b9ccbab9a5c
U dan
-Z 95c35bdd15155223e616b807a46e7fe9
+Z a63610a6f3469795714a7c77d99e36a6
diff --git a/manifest.uuid b/manifest.uuid
index 477390ac7..a1569dabf 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-99de5e3613d557728dd196353516bc7cf64a0e6c \ No newline at end of file
+0c0c4ae971e54efc526eed7bd071c90dfadb95ff \ No newline at end of file
diff --git a/test/permutations.test b/test/permutations.test
index f8de9af5f..c01dc22c5 100644
--- a/test/permutations.test
+++ b/test/permutations.test
@@ -258,7 +258,7 @@ test_suite "fts5-light" -prefix "" -description {
} -files [
test_set \
[glob -nocomplain $::testdir/../ext/fts5/test/*.test] \
- -exclude *corrupt*
+ -exclude *corrupt* *fault* *big* *fts5aj*
]
test_suite "nofaultsim" -prefix "" -description {