1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

Create a new datatype "ynVar" to hold "nVar" (number of variable) values.

This is normally 16-bits can can be 32-bits if SQLITE_MAX_VARIABLE_NUMBER
is large enough.

FossilOrigin-Name: 24a4d520d540d92b611abc4eb57dc6da9be4eac6
This commit is contained in:
drh
2009-11-04 13:17:14 +00:00
parent e68e8c58c9
commit 8677d30812
7 changed files with 37 additions and 46 deletions

View File

@@ -571,20 +571,12 @@ 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
pExpr->iColumn = (ynVar)(++pParse->nVar);
}else if( z[0]=='?' ){
/* Wildcard of the form "?nnn". Convert "nnn" to an integer and
** use it as the variable number */
int i = atoi((char*)&z[1]);
#if SQLITE_MAX_VARIABLE_NUMBER<=32767
pExpr->iColumn = (i16)i;
#else
pExpr->iColumn = i;
#endif
pExpr->iColumn = (ynVar)i;
testcase( i==0 );
testcase( i==1 );
testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 );
@@ -613,11 +605,7 @@ 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
pExpr->iColumn = (ynVar)(++pParse->nVar);
if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){
pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10;
pParse->apVarExpr =