OLD | NEW |
1 /* | 1 /* |
2 ** 2001 September 15 | 2 ** 2001 September 15 |
3 ** | 3 ** |
4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
6 ** | 6 ** |
7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
10 ** | 10 ** |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 } | 571 } |
572 if( i>pParse->nVar ){ | 572 if( i>pParse->nVar ){ |
573 pParse->nVar = (int)i; | 573 pParse->nVar = (int)i; |
574 } | 574 } |
575 }else{ | 575 }else{ |
576 /* Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable | 576 /* Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable |
577 ** number as the prior appearance of the same name, or if the name | 577 ** number as the prior appearance of the same name, or if the name |
578 ** has never appeared before, reuse the same variable number | 578 ** has never appeared before, reuse the same variable number |
579 */ | 579 */ |
580 int i; | 580 int i; |
581 u32 n; | |
582 n = sqlite3Strlen30(z); | |
583 for(i=0; i<pParse->nVarExpr; i++){ | 581 for(i=0; i<pParse->nVarExpr; i++){ |
584 Expr *pE = pParse->apVarExpr[i]; | 582 Expr *pE = pParse->apVarExpr[i]; |
585 assert( pE!=0 ); | 583 assert( pE!=0 ); |
586 if( memcmp(pE->u.zToken, z, n)==0 && pE->u.zToken[n]==0 ){ | 584 if( strcmp(pE->u.zToken, z)==0 ){ |
587 pExpr->iColumn = pE->iColumn; | 585 pExpr->iColumn = pE->iColumn; |
588 break; | 586 break; |
589 } | 587 } |
590 } | 588 } |
591 if( i>=pParse->nVarExpr ){ | 589 if( i>=pParse->nVarExpr ){ |
592 pExpr->iColumn = (ynVar)(++pParse->nVar); | 590 pExpr->iColumn = (ynVar)(++pParse->nVar); |
593 if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){ | 591 if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){ |
594 pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10; | 592 pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10; |
595 pParse->apVarExpr = | 593 pParse->apVarExpr = |
596 sqlite3DbReallocOrFree( | 594 sqlite3DbReallocOrFree( |
(...skipping 3151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3748 } | 3746 } |
3749 return i; | 3747 return i; |
3750 } | 3748 } |
3751 void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){ | 3749 void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){ |
3752 sqlite3ExprCacheRemove(pParse, iReg, nReg); | 3750 sqlite3ExprCacheRemove(pParse, iReg, nReg); |
3753 if( nReg>pParse->nRangeReg ){ | 3751 if( nReg>pParse->nRangeReg ){ |
3754 pParse->nRangeReg = nReg; | 3752 pParse->nRangeReg = nReg; |
3755 pParse->iRangeReg = iReg; | 3753 pParse->iRangeReg = iReg; |
3756 } | 3754 } |
3757 } | 3755 } |
OLD | NEW |