|
@@ -327,7 +327,7 @@ extern "C" {
|
|
|
*/
|
|
*/
|
|
|
#define SQLITE_VERSION "3.8.12"
|
|
#define SQLITE_VERSION "3.8.12"
|
|
|
#define SQLITE_VERSION_NUMBER 3008012
|
|
#define SQLITE_VERSION_NUMBER 3008012
|
|
|
-#define SQLITE_SOURCE_ID "2015-09-14 19:51:05 c1f76686cee3918b1be785a4071d68cb3afda0ef"
|
|
|
|
|
|
|
+#define SQLITE_SOURCE_ID "2015-09-17 17:21:09 6713e35b8a8c997aa2717e86ce6dcd63bb993477"
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -97641,7 +97641,11 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
|
|
|
** It is easier just to erase the whole table. Prior to version 3.6.5,
|
|
** It is easier just to erase the whole table. Prior to version 3.6.5,
|
|
|
** this optimization caused the row change count (the value returned by
|
|
** this optimization caused the row change count (the value returned by
|
|
|
** API function sqlite3_count_changes) to be set incorrectly. */
|
|
** API function sqlite3_count_changes) to be set incorrectly. */
|
|
|
- if( rcauth==SQLITE_OK && pWhere==0 && !bComplex && !IsVirtual(pTab) ){
|
|
|
|
|
|
|
+ if( rcauth==SQLITE_OK
|
|
|
|
|
+ && pWhere==0
|
|
|
|
|
+ && !bComplex
|
|
|
|
|
+ && !IsVirtual(pTab)
|
|
|
|
|
+ ){
|
|
|
assert( !isView );
|
|
assert( !isView );
|
|
|
sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
|
|
sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
|
|
|
if( HasRowid(pTab) ){
|
|
if( HasRowid(pTab) ){
|
|
@@ -102765,9 +102769,11 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
|
|
|
sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
|
|
sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
|
|
|
regNewData, 1, 0, OE_Replace,
|
|
regNewData, 1, 0, OE_Replace,
|
|
|
ONEPASS_SINGLE, -1);
|
|
ONEPASS_SINGLE, -1);
|
|
|
- }else if( pTab->pIndex ){
|
|
|
|
|
- sqlite3MultiWrite(pParse);
|
|
|
|
|
- sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, 0, -1);
|
|
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if( pTab->pIndex ){
|
|
|
|
|
+ sqlite3MultiWrite(pParse);
|
|
|
|
|
+ sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
seenReplace = 1;
|
|
seenReplace = 1;
|
|
|
break;
|
|
break;
|
|
@@ -172240,6 +172246,14 @@ SQLITE_EXTENSION_INIT1
|
|
|
|
|
|
|
|
#define UNUSED_PARAM(X) (void)(X)
|
|
#define UNUSED_PARAM(X) (void)(X)
|
|
|
|
|
|
|
|
|
|
+/*
|
|
|
|
|
+** Versions of isspace(), isalnum() and isdigit() to which it is safe
|
|
|
|
|
+** to pass signed char values.
|
|
|
|
|
+*/
|
|
|
|
|
+#define safe_isspace(x) isspace((unsigned char)(x))
|
|
|
|
|
+#define safe_isdigit(x) isdigit((unsigned char)(x))
|
|
|
|
|
+#define safe_isalnum(x) isalnum((unsigned char)(x))
|
|
|
|
|
+
|
|
|
/* Unsigned integer types */
|
|
/* Unsigned integer types */
|
|
|
typedef sqlite3_uint64 u64;
|
|
typedef sqlite3_uint64 u64;
|
|
|
typedef unsigned int u32;
|
|
typedef unsigned int u32;
|
|
@@ -172792,14 +172806,14 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
|
|
|
int iThis;
|
|
int iThis;
|
|
|
int x;
|
|
int x;
|
|
|
JsonNode *pNode;
|
|
JsonNode *pNode;
|
|
|
- while( isspace(pParse->zJson[i]) ){ i++; }
|
|
|
|
|
|
|
+ while( safe_isspace(pParse->zJson[i]) ){ i++; }
|
|
|
if( (c = pParse->zJson[i])==0 ) return 0;
|
|
if( (c = pParse->zJson[i])==0 ) return 0;
|
|
|
if( c=='{' ){
|
|
if( c=='{' ){
|
|
|
/* Parse object */
|
|
/* Parse object */
|
|
|
iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0);
|
|
iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0);
|
|
|
if( iThis<0 ) return -1;
|
|
if( iThis<0 ) return -1;
|
|
|
for(j=i+1;;j++){
|
|
for(j=i+1;;j++){
|
|
|
- while( isspace(pParse->zJson[j]) ){ j++; }
|
|
|
|
|
|
|
+ while( safe_isspace(pParse->zJson[j]) ){ j++; }
|
|
|
x = jsonParseValue(pParse, j);
|
|
x = jsonParseValue(pParse, j);
|
|
|
if( x<0 ){
|
|
if( x<0 ){
|
|
|
if( x==(-2) && pParse->nNode==(u32)iThis+1 ) return j+1;
|
|
if( x==(-2) && pParse->nNode==(u32)iThis+1 ) return j+1;
|
|
@@ -172810,13 +172824,13 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
|
|
|
if( pNode->eType!=JSON_STRING ) return -1;
|
|
if( pNode->eType!=JSON_STRING ) return -1;
|
|
|
pNode->jnFlags |= JNODE_LABEL;
|
|
pNode->jnFlags |= JNODE_LABEL;
|
|
|
j = x;
|
|
j = x;
|
|
|
- while( isspace(pParse->zJson[j]) ){ j++; }
|
|
|
|
|
|
|
+ while( safe_isspace(pParse->zJson[j]) ){ j++; }
|
|
|
if( pParse->zJson[j]!=':' ) return -1;
|
|
if( pParse->zJson[j]!=':' ) return -1;
|
|
|
j++;
|
|
j++;
|
|
|
x = jsonParseValue(pParse, j);
|
|
x = jsonParseValue(pParse, j);
|
|
|
if( x<0 ) return -1;
|
|
if( x<0 ) return -1;
|
|
|
j = x;
|
|
j = x;
|
|
|
- while( isspace(pParse->zJson[j]) ){ j++; }
|
|
|
|
|
|
|
+ while( safe_isspace(pParse->zJson[j]) ){ j++; }
|
|
|
c = pParse->zJson[j];
|
|
c = pParse->zJson[j];
|
|
|
if( c==',' ) continue;
|
|
if( c==',' ) continue;
|
|
|
if( c!='}' ) return -1;
|
|
if( c!='}' ) return -1;
|
|
@@ -172829,14 +172843,14 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
|
|
|
iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
|
|
iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0);
|
|
|
if( iThis<0 ) return -1;
|
|
if( iThis<0 ) return -1;
|
|
|
for(j=i+1;;j++){
|
|
for(j=i+1;;j++){
|
|
|
- while( isspace(pParse->zJson[j]) ){ j++; }
|
|
|
|
|
|
|
+ while( safe_isspace(pParse->zJson[j]) ){ j++; }
|
|
|
x = jsonParseValue(pParse, j);
|
|
x = jsonParseValue(pParse, j);
|
|
|
if( x<0 ){
|
|
if( x<0 ){
|
|
|
if( x==(-3) && pParse->nNode==(u32)iThis+1 ) return j+1;
|
|
if( x==(-3) && pParse->nNode==(u32)iThis+1 ) return j+1;
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
j = x;
|
|
j = x;
|
|
|
- while( isspace(pParse->zJson[j]) ){ j++; }
|
|
|
|
|
|
|
+ while( safe_isspace(pParse->zJson[j]) ){ j++; }
|
|
|
c = pParse->zJson[j];
|
|
c = pParse->zJson[j];
|
|
|
if( c==',' ) continue;
|
|
if( c==',' ) continue;
|
|
|
if( c!=']' ) return -1;
|
|
if( c!=']' ) return -1;
|
|
@@ -172865,17 +172879,17 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
|
|
|
return j+1;
|
|
return j+1;
|
|
|
}else if( c=='n'
|
|
}else if( c=='n'
|
|
|
&& strncmp(pParse->zJson+i,"null",4)==0
|
|
&& strncmp(pParse->zJson+i,"null",4)==0
|
|
|
- && !isalnum(pParse->zJson[i+4]) ){
|
|
|
|
|
|
|
+ && !safe_isalnum(pParse->zJson[i+4]) ){
|
|
|
jsonParseAddNode(pParse, JSON_NULL, 0, 0);
|
|
jsonParseAddNode(pParse, JSON_NULL, 0, 0);
|
|
|
return i+4;
|
|
return i+4;
|
|
|
}else if( c=='t'
|
|
}else if( c=='t'
|
|
|
&& strncmp(pParse->zJson+i,"true",4)==0
|
|
&& strncmp(pParse->zJson+i,"true",4)==0
|
|
|
- && !isalnum(pParse->zJson[i+4]) ){
|
|
|
|
|
|
|
+ && !safe_isalnum(pParse->zJson[i+4]) ){
|
|
|
jsonParseAddNode(pParse, JSON_TRUE, 0, 0);
|
|
jsonParseAddNode(pParse, JSON_TRUE, 0, 0);
|
|
|
return i+4;
|
|
return i+4;
|
|
|
}else if( c=='f'
|
|
}else if( c=='f'
|
|
|
&& strncmp(pParse->zJson+i,"false",5)==0
|
|
&& strncmp(pParse->zJson+i,"false",5)==0
|
|
|
- && !isalnum(pParse->zJson[i+5]) ){
|
|
|
|
|
|
|
+ && !safe_isalnum(pParse->zJson[i+5]) ){
|
|
|
jsonParseAddNode(pParse, JSON_FALSE, 0, 0);
|
|
jsonParseAddNode(pParse, JSON_FALSE, 0, 0);
|
|
|
return i+5;
|
|
return i+5;
|
|
|
}else if( c=='-' || (c>='0' && c<='9') ){
|
|
}else if( c=='-' || (c>='0' && c<='9') ){
|
|
@@ -172938,7 +172952,7 @@ static int jsonParse(
|
|
|
i = jsonParseValue(pParse, 0);
|
|
i = jsonParseValue(pParse, 0);
|
|
|
if( pParse->oom ) i = -1;
|
|
if( pParse->oom ) i = -1;
|
|
|
if( i>0 ){
|
|
if( i>0 ){
|
|
|
- while( isspace(zJson[i]) ) i++;
|
|
|
|
|
|
|
+ while( safe_isspace(zJson[i]) ) i++;
|
|
|
if( zJson[i] ) i = -1;
|
|
if( zJson[i] ) i = -1;
|
|
|
}
|
|
}
|
|
|
if( i<=0 ){
|
|
if( i<=0 ){
|
|
@@ -173069,11 +173083,11 @@ static JsonNode *jsonLookupStep(
|
|
|
}
|
|
}
|
|
|
return pNode;
|
|
return pNode;
|
|
|
}
|
|
}
|
|
|
- }else if( zPath[0]=='[' && isdigit(zPath[1]) ){
|
|
|
|
|
|
|
+ }else if( zPath[0]=='[' && safe_isdigit(zPath[1]) ){
|
|
|
if( pRoot->eType!=JSON_ARRAY ) return 0;
|
|
if( pRoot->eType!=JSON_ARRAY ) return 0;
|
|
|
i = 0;
|
|
i = 0;
|
|
|
zPath++;
|
|
zPath++;
|
|
|
- while( isdigit(zPath[0]) ){
|
|
|
|
|
|
|
+ while( safe_isdigit(zPath[0]) ){
|
|
|
i = i*10 + zPath[0] - '0';
|
|
i = i*10 + zPath[0] - '0';
|
|
|
zPath++;
|
|
zPath++;
|
|
|
}
|
|
}
|