diff options
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c index 0602032ac..ff75f5f70 100644 --- a/src/expr.c +++ b/src/expr.c @@ -571,12 +571,20 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){ if( z[1]==0 ){ /* Wildcard of the form "?". Assign the next variable number */ assert( z[0]=='?' ); +#if SQLITE_MAX_VARIABLE_NUMBER<=32767 + pExpr->iColumn = (i16)(++pParse->nVar); +#else pExpr->iColumn = ++pParse->nVar; +#endif }else if( z[0]=='?' ){ /* Wildcard of the form "?nnn". Convert "nnn" to an integer and ** use it as the variable number */ - int i; - pExpr->iColumn = i = atoi((char*)&z[1]); + int i = atoi((char*)&z[1]); +#if SQLITE_MAX_VARIABLE_NUMBER<=32767 + pExpr->iColumn = (i16)i; +#else + pExpr->iColumn = i; +#endif testcase( i==0 ); testcase( i==1 ); testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 ); @@ -605,7 +613,11 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){ } } if( i>=pParse->nVarExpr ){ +#if SQLITE_MAX_VARIABLE_NUMBER<=32767 + pExpr->iColumn = (i16)(++pParse->nVar); +#else pExpr->iColumn = ++pParse->nVar; +#endif if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){ pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10; pParse->apVarExpr = |