|
|
@@ -1158,7 +1158,7 @@ extern "C" {
|
|
|
*/
|
|
|
#define SQLITE_VERSION "3.25.0"
|
|
|
#define SQLITE_VERSION_NUMBER 3025000
|
|
|
-#define SQLITE_SOURCE_ID "2018-09-08 20:29:04 5a954533edbde58aa7158572ece7ceeb1c6e610b71f3ae45d0b8371d74f9alt1"
|
|
|
+#define SQLITE_SOURCE_ID "2018-09-12 01:05:26 78862252da7f59d4737ed16f4ccf100cea27d8b421db31051afbaa8d96f2alt1"
|
|
|
|
|
|
/*
|
|
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
|
@@ -46441,8 +46441,8 @@ SQLITE_API int sqlite3_os_end(void){
|
|
|
** This file also implements interface sqlite3_serialize() and
|
|
|
** sqlite3_deserialize().
|
|
|
*/
|
|
|
-#ifdef SQLITE_ENABLE_DESERIALIZE
|
|
|
/* #include "sqliteInt.h" */
|
|
|
+#ifdef SQLITE_ENABLE_DESERIALIZE
|
|
|
|
|
|
/*
|
|
|
** Forward declaration of objects used by this utility
|
|
|
@@ -60669,7 +60669,7 @@ SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){
|
|
|
**
|
|
|
** If the database contents have changes since the previous read
|
|
|
** transaction, then *pChanged is set to 1 before returning. The
|
|
|
-** Pager layer will use this to know that is cache is stale and
|
|
|
+** Pager layer will use this to know that its cache is stale and
|
|
|
** needs to be flushed.
|
|
|
*/
|
|
|
SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
|
|
|
@@ -78700,7 +78700,7 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
|
|
|
*/
|
|
|
sqlite3VdbeHalt(p);
|
|
|
|
|
|
- /* If the VDBE has be run even partially, then transfer the error code
|
|
|
+ /* If the VDBE has been run even partially, then transfer the error code
|
|
|
** and error message from the VDBE into the main database structure. But
|
|
|
** if the VDBE has just been set to run but has not actually executed any
|
|
|
** instructions yet, leave the main database error information unchanged.
|
|
|
@@ -118130,6 +118130,12 @@ struct sqlite3_api_routines {
|
|
|
int (*str_errcode)(sqlite3_str*);
|
|
|
int (*str_length)(sqlite3_str*);
|
|
|
char *(*str_value)(sqlite3_str*);
|
|
|
+ int (*create_window_function)(sqlite3*,const char*,int,int,void*,
|
|
|
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
|
|
|
+ void (*xFinal)(sqlite3_context*),
|
|
|
+ void (*xValue)(sqlite3_context*),
|
|
|
+ void (*xInv)(sqlite3_context*,int,sqlite3_value**),
|
|
|
+ void(*xDestroy)(void*));
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
@@ -118416,6 +118422,8 @@ typedef int (*sqlite3_loadext_entry)(
|
|
|
#define sqlite3_str_errcode sqlite3_api->str_errcode
|
|
|
#define sqlite3_str_length sqlite3_api->str_length
|
|
|
#define sqlite3_str_value sqlite3_api->str_value
|
|
|
+/* Version 3.25.0 and later */
|
|
|
+#define sqlite3_create_window_function sqlite3_api->create_window_function
|
|
|
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
|
|
|
|
|
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
|
|
@@ -118871,7 +118879,9 @@ static const sqlite3_api_routines sqlite3Apis = {
|
|
|
sqlite3_str_reset,
|
|
|
sqlite3_str_errcode,
|
|
|
sqlite3_str_length,
|
|
|
- sqlite3_str_value
|
|
|
+ sqlite3_str_value,
|
|
|
+ /* Version 3.25.0 and later */
|
|
|
+ sqlite3_create_window_function
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
@@ -135566,13 +135576,10 @@ static int codeCursorHintIsOrFunction(Walker *pWalker, Expr *pExpr){
|
|
|
static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
|
|
|
int rc = WRC_Continue;
|
|
|
struct CCurHint *pHint = pWalker->u.pCCurHint;
|
|
|
- if( pExpr->op==TK_COLUMN && !ExprHasProperty(pExpr, EP_FixedCol) ){
|
|
|
+ if( pExpr->op==TK_COLUMN ){
|
|
|
if( pExpr->iTable!=pHint->iTabCur ){
|
|
|
- Vdbe *v = pWalker->pParse->pVdbe;
|
|
|
int reg = ++pWalker->pParse->nMem; /* Register for column value */
|
|
|
- sqlite3ExprCodeGetColumnOfTable(
|
|
|
- v, pExpr->pTab, pExpr->iTable, pExpr->iColumn, reg
|
|
|
- );
|
|
|
+ sqlite3ExprCode(pWalker->pParse, pExpr, reg);
|
|
|
pExpr->op = TK_REGISTER;
|
|
|
pExpr->iTable = reg;
|
|
|
}else if( pHint->pIdx!=0 ){
|
|
|
@@ -137153,23 +137160,6 @@ static int isLikeOrGlob(
|
|
|
}
|
|
|
if( z ){
|
|
|
|
|
|
- /* If the RHS begins with a digit or a minus sign, then the LHS must
|
|
|
- ** be an ordinary column (not a virtual table column) with TEXT affinity.
|
|
|
- ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false
|
|
|
- ** even though "lhs LIKE rhs" is true. But if the RHS does not start
|
|
|
- ** with a digit or '-', then "lhs LIKE rhs" will always be false if
|
|
|
- ** the LHS is numeric and so the optimization still works.
|
|
|
- */
|
|
|
- if( sqlite3Isdigit(z[0]) || z[0]=='-' ){
|
|
|
- if( pLeft->op!=TK_COLUMN
|
|
|
- || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
|
|
|
- || IsVirtual(pLeft->pTab) /* Value might be numeric */
|
|
|
- ){
|
|
|
- sqlite3ValueFree(pVal);
|
|
|
- return 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/* Count the number of prefix characters prior to the first wildcard */
|
|
|
cnt = 0;
|
|
|
while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
|
|
|
@@ -137202,6 +137192,32 @@ static int isLikeOrGlob(
|
|
|
zNew[iTo++] = zNew[iFrom];
|
|
|
}
|
|
|
zNew[iTo] = 0;
|
|
|
+
|
|
|
+ /* If the RHS begins with a digit or a minus sign, then the LHS must be
|
|
|
+ ** an ordinary column (not a virtual table column) with TEXT affinity.
|
|
|
+ ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false
|
|
|
+ ** even though "lhs LIKE rhs" is true. But if the RHS does not start
|
|
|
+ ** with a digit or '-', then "lhs LIKE rhs" will always be false if
|
|
|
+ ** the LHS is numeric and so the optimization still works.
|
|
|
+ **
|
|
|
+ ** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033
|
|
|
+ ** The RHS pattern must not be '/%' because the termination condition
|
|
|
+ ** will then become "x<'0'" and if the affinity is numeric, will then
|
|
|
+ ** be converted into "x<0", which is incorrect.
|
|
|
+ */
|
|
|
+ if( sqlite3Isdigit(zNew[0])
|
|
|
+ || zNew[0]=='-'
|
|
|
+ || (zNew[0]+1=='0' && iTo==1)
|
|
|
+ ){
|
|
|
+ if( pLeft->op!=TK_COLUMN
|
|
|
+ || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
|
|
|
+ || IsVirtual(pLeft->pTab) /* Value might be numeric */
|
|
|
+ ){
|
|
|
+ sqlite3ExprDelete(db, pPrefix);
|
|
|
+ sqlite3ValueFree(pVal);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
*ppPrefix = pPrefix;
|
|
|
|
|
|
@@ -139474,6 +139490,20 @@ static sqlite3_index_info *allocateIndexInfo(
|
|
|
testcase( pTerm->eOperator & WO_ALL );
|
|
|
if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
|
|
|
if( pTerm->wtFlags & TERM_VNULL ) continue;
|
|
|
+ if( (pSrc->fg.jointype & JT_LEFT)!=0
|
|
|
+ && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
|
|
|
+ && (pTerm->eOperator & (WO_IS|WO_ISNULL))
|
|
|
+ ){
|
|
|
+ /* An "IS" term in the WHERE clause where the virtual table is the rhs
|
|
|
+ ** of a LEFT JOIN. Do not pass this term to the virtual table
|
|
|
+ ** implementation, as this can lead to incorrect results from SQL such
|
|
|
+ ** as:
|
|
|
+ **
|
|
|
+ ** "LEFT JOIN vtab WHERE vtab.col IS NULL" */
|
|
|
+ testcase( pTerm->eOperator & WO_ISNULL );
|
|
|
+ testcase( pTerm->eOperator & WO_IS );
|
|
|
+ continue;
|
|
|
+ }
|
|
|
assert( pTerm->u.leftColumn>=(-1) );
|
|
|
pIdxCons[j].iColumn = pTerm->u.leftColumn;
|
|
|
pIdxCons[j].iTermOffset = i;
|
|
|
@@ -162503,7 +162533,7 @@ static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){
|
|
|
int rc = SQLITE_OK;
|
|
|
UNUSED_PARAMETER(iSavepoint);
|
|
|
assert( ((Fts3Table *)pVtab)->inTransaction );
|
|
|
- assert( ((Fts3Table *)pVtab)->mxSavepoint < iSavepoint );
|
|
|
+ assert( ((Fts3Table *)pVtab)->mxSavepoint <= iSavepoint );
|
|
|
TESTONLY( ((Fts3Table *)pVtab)->mxSavepoint = iSavepoint );
|
|
|
if( ((Fts3Table *)pVtab)->bIgnoreSavepoint==0 ){
|
|
|
rc = fts3SyncMethod(pVtab);
|
|
|
@@ -179111,11 +179141,11 @@ static void jsonArrayCompute(sqlite3_context *ctx, int isFinal){
|
|
|
if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx);
|
|
|
assert( pStr->bStatic );
|
|
|
}else if( isFinal ){
|
|
|
- sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
|
|
|
+ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed,
|
|
|
pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
|
|
|
pStr->bStatic = 1;
|
|
|
}else{
|
|
|
- sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed, SQLITE_TRANSIENT);
|
|
|
+ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT);
|
|
|
pStr->nUsed--;
|
|
|
}
|
|
|
}else{
|
|
|
@@ -179164,7 +179194,7 @@ static void jsonGroupInverse(
|
|
|
}
|
|
|
}
|
|
|
pStr->nUsed -= i;
|
|
|
- memmove(&z[1], &z[i+1], pStr->nUsed-1);
|
|
|
+ memmove(&z[1], &z[i+1], (size_t)pStr->nUsed-1);
|
|
|
}
|
|
|
#else
|
|
|
# define jsonGroupInverse 0
|
|
|
@@ -179210,11 +179240,11 @@ static void jsonObjectCompute(sqlite3_context *ctx, int isFinal){
|
|
|
if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx);
|
|
|
assert( pStr->bStatic );
|
|
|
}else if( isFinal ){
|
|
|
- sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
|
|
|
+ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed,
|
|
|
pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
|
|
|
pStr->bStatic = 1;
|
|
|
}else{
|
|
|
- sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed, SQLITE_TRANSIENT);
|
|
|
+ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT);
|
|
|
pStr->nUsed--;
|
|
|
}
|
|
|
}else{
|
|
|
@@ -183068,7 +183098,7 @@ static int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){
|
|
|
*/
|
|
|
static int rtreeSavepoint(sqlite3_vtab *pVtab, int iSavepoint){
|
|
|
Rtree *pRtree = (Rtree *)pVtab;
|
|
|
- int iwt = pRtree->inWrTrans;
|
|
|
+ u8 iwt = pRtree->inWrTrans;
|
|
|
UNUSED_PARAMETER(iSavepoint);
|
|
|
pRtree->inWrTrans = 0;
|
|
|
nodeBlobReset(pRtree);
|
|
|
@@ -184208,7 +184238,7 @@ static int geopolyParseNumber(GeoParse *p, GeoCoord *pVal){
|
|
|
break;
|
|
|
}
|
|
|
if( z[j-1]<'0' ) return 0;
|
|
|
- if( pVal ) *pVal = atof((const char*)p->z);
|
|
|
+ if( pVal ) *pVal = (GeoCoord)atof((const char*)p->z);
|
|
|
p->z += j;
|
|
|
return 1;
|
|
|
}
|
|
|
@@ -184463,8 +184493,8 @@ static void geopolyXformFunc(
|
|
|
for(ii=0; ii<p->nVertex; ii++){
|
|
|
x0 = p->a[ii*2];
|
|
|
y0 = p->a[ii*2+1];
|
|
|
- x1 = A*x0 + B*y0 + E;
|
|
|
- y1 = C*x0 + D*y0 + F;
|
|
|
+ x1 = (GeoCoord)(A*x0 + B*y0 + E);
|
|
|
+ y1 = (GeoCoord)(C*x0 + D*y0 + F);
|
|
|
p->a[ii*2] = x1;
|
|
|
p->a[ii*2+1] = y1;
|
|
|
}
|
|
|
@@ -184539,11 +184569,11 @@ static GeoPoly *geopolyBBox(
|
|
|
mnY = mxY = p->a[1];
|
|
|
for(ii=1; ii<p->nVertex; ii++){
|
|
|
double r = p->a[ii*2];
|
|
|
- if( r<mnX ) mnX = r;
|
|
|
- else if( r>mxX ) mxX = r;
|
|
|
+ if( r<mnX ) mnX = (float)r;
|
|
|
+ else if( r>mxX ) mxX = (float)r;
|
|
|
r = p->a[ii*2+1];
|
|
|
- if( r<mnY ) mnY = r;
|
|
|
- else if( r>mxY ) mxY = r;
|
|
|
+ if( r<mnY ) mnY = (float)r;
|
|
|
+ else if( r>mxY ) mxY = (float)r;
|
|
|
}
|
|
|
if( pRc ) *pRc = SQLITE_OK;
|
|
|
if( aCoord==0 ){
|
|
|
@@ -230530,9 +230560,9 @@ static void print_elem(void *e, sqlite_int64 c, void* p){
|
|
|
#endif
|
|
|
|
|
|
/************** End of extension-functions.c *********************************/
|
|
|
-#if __LINE__!=230533
|
|
|
+#if __LINE__!=230563
|
|
|
#undef SQLITE_SOURCE_ID
|
|
|
-#define SQLITE_SOURCE_ID "2018-09-08 20:29:04 5a954533edbde58aa7158572ece7ceeb1c6e610b71f3ae45d0b8371d74f9alt2"
|
|
|
+#define SQLITE_SOURCE_ID "2018-09-12 01:05:26 78862252da7f59d4737ed16f4ccf100cea27d8b421db31051afbaa8d96f2alt2"
|
|
|
#endif
|
|
|
/* Return the source-id for this library */
|
|
|
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
|