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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 ** Set the collating sequence for expression pExpr to be the collating | 62 ** Set the collating sequence for expression pExpr to be the collating |
63 ** sequence named by pToken. Return a pointer to a new Expr node that | 63 ** sequence named by pToken. Return a pointer to a new Expr node that |
64 ** implements the COLLATE operator. | 64 ** implements the COLLATE operator. |
65 ** | 65 ** |
66 ** If a memory allocation error occurs, that fact is recorded in pParse->db | 66 ** If a memory allocation error occurs, that fact is recorded in pParse->db |
67 ** and the pExpr parameter is returned unchanged. | 67 ** and the pExpr parameter is returned unchanged. |
68 */ | 68 */ |
69 Expr *sqlite3ExprAddCollateToken( | 69 Expr *sqlite3ExprAddCollateToken( |
70 Parse *pParse, /* Parsing context */ | 70 Parse *pParse, /* Parsing context */ |
71 Expr *pExpr, /* Add the "COLLATE" clause to this expression */ | 71 Expr *pExpr, /* Add the "COLLATE" clause to this expression */ |
72 const Token *pCollName /* Name of collating sequence */ | 72 const Token *pCollName, /* Name of collating sequence */ |
| 73 int dequote /* True to dequote pCollName */ |
73 ){ | 74 ){ |
74 if( pCollName->n>0 ){ | 75 if( pCollName->n>0 ){ |
75 Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, 1); | 76 Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote); |
76 if( pNew ){ | 77 if( pNew ){ |
77 pNew->pLeft = pExpr; | 78 pNew->pLeft = pExpr; |
78 pNew->flags |= EP_Collate|EP_Skip; | 79 pNew->flags |= EP_Collate|EP_Skip; |
79 pExpr = pNew; | 80 pExpr = pNew; |
80 } | 81 } |
81 } | 82 } |
82 return pExpr; | 83 return pExpr; |
83 } | 84 } |
84 Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){ | 85 Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){ |
85 Token s; | 86 Token s; |
86 assert( zC!=0 ); | 87 assert( zC!=0 ); |
87 s.z = zC; | 88 s.z = zC; |
88 s.n = sqlite3Strlen30(s.z); | 89 s.n = sqlite3Strlen30(s.z); |
89 return sqlite3ExprAddCollateToken(pParse, pExpr, &s); | 90 return sqlite3ExprAddCollateToken(pParse, pExpr, &s, 0); |
90 } | 91 } |
91 | 92 |
92 /* | 93 /* |
93 ** Skip over any TK_COLLATE or TK_AS operators and any unlikely() | 94 ** Skip over any TK_COLLATE or TK_AS operators and any unlikely() |
94 ** or likelihood() function at the root of an expression. | 95 ** or likelihood() function at the root of an expression. |
95 */ | 96 */ |
96 Expr *sqlite3ExprSkipCollate(Expr *pExpr){ | 97 Expr *sqlite3ExprSkipCollate(Expr *pExpr){ |
97 while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){ | 98 while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){ |
98 if( ExprHasProperty(pExpr, EP_Unlikely) ){ | 99 if( ExprHasProperty(pExpr, EP_Unlikely) ){ |
99 assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); | 100 assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); |
(...skipping 4239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4339 } | 4340 } |
4340 } | 4341 } |
4341 | 4342 |
4342 /* | 4343 /* |
4343 ** Mark all temporary registers as being unavailable for reuse. | 4344 ** Mark all temporary registers as being unavailable for reuse. |
4344 */ | 4345 */ |
4345 void sqlite3ClearTempRegCache(Parse *pParse){ | 4346 void sqlite3ClearTempRegCache(Parse *pParse){ |
4346 pParse->nTempReg = 0; | 4347 pParse->nTempReg = 0; |
4347 pParse->nRangeReg = 0; | 4348 pParse->nRangeReg = 0; |
4348 } | 4349 } |
OLD | NEW |