Fix an off-by-one comparison in the intarray() virtual table. Get the

intarray() virtual table tests working using the legacy makefile.

FossilOrigin-Name: 7c3d441f2a9f642f3d91dcee854a4d16d298bc34
This commit is contained in:
drh
2016-07-02 20:57:06 +00:00
parent 2519b2a3e5
commit ba637157ca
5 changed files with 23 additions and 14 deletions
+2 -5
View File
@@ -25,7 +25,7 @@
** The intarray "function" is really a virtual table with the
** following schema:
**
** CREATE FUNCTION intarray(
** CREATE TABLE intarray(
** value,
** pointer HIDDEN,
** count HIDDEN
@@ -168,7 +168,7 @@ static int intarrayRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
*/
static int intarrayEof(sqlite3_vtab_cursor *cur){
intarray_cursor *pCur = (intarray_cursor*)cur;
return pCur->iRowid>=pCur->iCnt;
return pCur->iRowid>pCur->iCnt;
}
/*
@@ -181,7 +181,6 @@ static int intarrayFilter(
int argc, sqlite3_value **argv
){
intarray_cursor *pCur = (intarray_cursor *)pVtabCursor;
int i = 0;
if( idxNum ){
pCur->iPtr = sqlite3_value_int64(argv[0]);
pCur->iCnt = sqlite3_value_int64(argv[1]);
@@ -210,10 +209,8 @@ static int intarrayBestIndex(
sqlite3_index_info *pIdxInfo
){
int i; /* Loop over constraints */
int idxNum = 0; /* The query plan bitmask */
int ptrIdx = -1; /* Index of the pointer= constraint, or -1 if none */
int cntIdx = -1; /* Index of the count= constraint, or -1 if none */
int nArg = 0; /* Number of arguments that intarrayFilter() expects */
const struct sqlite3_index_constraint *pConstraint;
pConstraint = pIdxInfo->aConstraint;