update: sqlite 3.49.2.
This commit is contained in:
71
deps/sqlite/shell.c
vendored
71
deps/sqlite/shell.c
vendored
@ -6267,8 +6267,7 @@ int sqlite3_ieee_init(
|
||||
** step HIDDEN
|
||||
** );
|
||||
**
|
||||
** The virtual table also has a rowid, logically equivalent to n+1 where
|
||||
** "n" is the ascending integer in the aforesaid production definition.
|
||||
** The virtual table also has a rowid which is an alias for the value.
|
||||
**
|
||||
** Function arguments in queries against this virtual table are translated
|
||||
** into equality constraints against successive hidden columns. In other
|
||||
@ -6323,6 +6322,7 @@ SQLITE_EXTENSION_INIT1
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
/*
|
||||
@ -6483,6 +6483,7 @@ static int seriesConnect(
|
||||
int rc;
|
||||
|
||||
/* Column numbers */
|
||||
#define SERIES_COLUMN_ROWID (-1)
|
||||
#define SERIES_COLUMN_VALUE 0
|
||||
#define SERIES_COLUMN_START 1
|
||||
#define SERIES_COLUMN_STOP 2
|
||||
@ -6570,13 +6571,11 @@ static int seriesColumn(
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Return the rowid for the current row, logically equivalent to n+1 where
|
||||
** "n" is the ascending integer in the aforesaid production definition.
|
||||
** The rowid is the same as the value.
|
||||
*/
|
||||
static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
|
||||
series_cursor *pCur = (series_cursor*)cur;
|
||||
sqlite3_uint64 n = pCur->ss.uSeqIndexNow;
|
||||
*pRowid = (sqlite3_int64)((n<LARGEST_UINT64)? n+1 : 0);
|
||||
*pRowid = pCur->ss.iValueNow;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@ -6689,25 +6688,52 @@ static int seriesFilter(
|
||||
** constraints on the "value" column.
|
||||
*/
|
||||
if( idxNum & 0x0080 ){
|
||||
iMin = iMax = sqlite3_value_int64(argv[i++]);
|
||||
if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
|
||||
double r = sqlite3_value_double(argv[i++]);
|
||||
if( r==ceil(r) ){
|
||||
iMin = iMax = (sqlite3_int64)r;
|
||||
}else{
|
||||
returnNoRows = 1;
|
||||
}
|
||||
}else{
|
||||
iMin = iMax = sqlite3_value_int64(argv[i++]);
|
||||
}
|
||||
}else{
|
||||
if( idxNum & 0x0300 ){
|
||||
iMin = sqlite3_value_int64(argv[i++]);
|
||||
if( idxNum & 0x0200 ){
|
||||
if( iMin==LARGEST_INT64 ){
|
||||
returnNoRows = 1;
|
||||
if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
|
||||
double r = sqlite3_value_double(argv[i++]);
|
||||
if( idxNum & 0x0200 && r==ceil(r) ){
|
||||
iMin = (sqlite3_int64)ceil(r+1.0);
|
||||
}else{
|
||||
iMin++;
|
||||
iMin = (sqlite3_int64)ceil(r);
|
||||
}
|
||||
}else{
|
||||
iMin = sqlite3_value_int64(argv[i++]);
|
||||
if( idxNum & 0x0200 ){
|
||||
if( iMin==LARGEST_INT64 ){
|
||||
returnNoRows = 1;
|
||||
}else{
|
||||
iMin++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( idxNum & 0x3000 ){
|
||||
iMax = sqlite3_value_int64(argv[i++]);
|
||||
if( idxNum & 0x2000 ){
|
||||
if( iMax==SMALLEST_INT64 ){
|
||||
returnNoRows = 1;
|
||||
if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
|
||||
double r = sqlite3_value_double(argv[i++]);
|
||||
if( (idxNum & 0x2000)!=0 && r==floor(r) ){
|
||||
iMax = (sqlite3_int64)(r-1.0);
|
||||
}else{
|
||||
iMax--;
|
||||
iMax = (sqlite3_int64)floor(r);
|
||||
}
|
||||
}else{
|
||||
iMax = sqlite3_value_int64(argv[i++]);
|
||||
if( idxNum & 0x2000 ){
|
||||
if( iMax==SMALLEST_INT64 ){
|
||||
returnNoRows = 1;
|
||||
}else{
|
||||
iMax--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6726,8 +6752,7 @@ static int seriesFilter(
|
||||
pCur->ss.iBase += ((d+szStep-1)/szStep)*szStep;
|
||||
}
|
||||
if( pCur->ss.iTerm>iMax ){
|
||||
sqlite3_uint64 d = pCur->ss.iTerm - iMax;
|
||||
pCur->ss.iTerm -= ((d+szStep-1)/szStep)*szStep;
|
||||
pCur->ss.iTerm = iMax;
|
||||
}
|
||||
}else{
|
||||
sqlite3_int64 szStep = -pCur->ss.iStep;
|
||||
@ -6737,8 +6762,7 @@ static int seriesFilter(
|
||||
pCur->ss.iBase -= ((d+szStep-1)/szStep)*szStep;
|
||||
}
|
||||
if( pCur->ss.iTerm<iMin ){
|
||||
sqlite3_uint64 d = iMin - pCur->ss.iTerm;
|
||||
pCur->ss.iTerm += ((d+szStep-1)/szStep)*szStep;
|
||||
pCur->ss.iTerm = iMin;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6866,7 +6890,10 @@ static int seriesBestIndex(
|
||||
continue;
|
||||
}
|
||||
if( pConstraint->iColumn<SERIES_COLUMN_START ){
|
||||
if( pConstraint->iColumn==SERIES_COLUMN_VALUE && pConstraint->usable ){
|
||||
if( (pConstraint->iColumn==SERIES_COLUMN_VALUE ||
|
||||
pConstraint->iColumn==SERIES_COLUMN_ROWID)
|
||||
&& pConstraint->usable
|
||||
){
|
||||
switch( op ){
|
||||
case SQLITE_INDEX_CONSTRAINT_EQ:
|
||||
case SQLITE_INDEX_CONSTRAINT_IS: {
|
||||
|
Reference in New Issue
Block a user