Overview
| SHA1 Hash: | f9fa7581c0371fe0feb4e97487741ade18595810 |
|---|---|
| Date: | 2012-12-07 20:31:11 |
| User: | drh |
| Comment: | Many more tests are passing. Only about 100 failures remain in veryquick. |
Tags And Properties
- branch=ticket-71e333e7 inherited from [cc6e0785df]
- sym-ticket-71e333e7 inherited from [cc6e0785df]
Changes
Changes to src/expr.c
108 while( p && pColl==0 ){ 108 while( p && pColl==0 ){ 109 int op = p->op; 109 int op = p->op; 110 if( op==TK_CAST || op==TK_UPLUS ){ 110 if( op==TK_CAST || op==TK_UPLUS ){ 111 p = p->pLeft; 111 p = p->pLeft; 112 continue; 112 continue; 113 } 113 } 114 if( op==TK_COLLATE ){ 114 if( op==TK_COLLATE ){ 115 pColl = sqlite3FindCollSeq(db, ENC(db), p->u.zToken, 0); | 115 pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken); 116 break; 116 break; 117 } 117 } 118 if( p->pTab!=0 118 if( p->pTab!=0 119 && (op==TK_AGG_COLUMN || op==TK_COLUMN 119 && (op==TK_AGG_COLUMN || op==TK_COLUMN 120 || op==TK_REGISTER || op==TK_TRIGGER) 120 || op==TK_REGISTER || op==TK_TRIGGER) 121 ){ 121 ){ 122 /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally 122 /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally ................................................................................................................................................................................ 3124 3124 3125 case TK_UMINUS: zUniOp = "UMINUS"; break; 3125 case TK_UMINUS: zUniOp = "UMINUS"; break; 3126 case TK_UPLUS: zUniOp = "UPLUS"; break; 3126 case TK_UPLUS: zUniOp = "UPLUS"; break; 3127 case TK_BITNOT: zUniOp = "BITNOT"; break; 3127 case TK_BITNOT: zUniOp = "BITNOT"; break; 3128 case TK_NOT: zUniOp = "NOT"; break; 3128 case TK_NOT: zUniOp = "NOT"; break; 3129 case TK_ISNULL: zUniOp = "ISNULL"; break; 3129 case TK_ISNULL: zUniOp = "ISNULL"; break; 3130 case TK_NOTNULL: zUniOp = "NOTNULL"; break; 3130 case TK_NOTNULL: zUniOp = "NOTNULL"; break; > 3131 > 3132 case TK_COLLATE: { > 3133 sqlite3ExplainExpr(pOut, pExpr->pLeft); > 3134 sqlite3ExplainPrintf(pOut,".COLLATE(%s)",pExpr->u.zToken); > 3135 break; > 3136 } 3131 3137 3132 case TK_AGG_FUNCTION: 3138 case TK_AGG_FUNCTION: 3133 case TK_CONST_FUNC: 3139 case TK_CONST_FUNC: 3134 case TK_FUNCTION: { 3140 case TK_FUNCTION: { 3135 ExprList *pFarg; /* List of function arguments */ 3141 ExprList *pFarg; /* List of function arguments */ 3136 if( ExprHasAnyProperty(pExpr, EP_TokenOnly) ){ 3142 if( ExprHasAnyProperty(pExpr, EP_TokenOnly) ){ 3137 pFarg = 0; 3143 pFarg = 0;
Changes to src/where.c
1184 sqlite3 *db = pParse->db; /* Database connection */ 1184 sqlite3 *db = pParse->db; /* Database connection */ 1185 1185 1186 if( db->mallocFailed ){ 1186 if( db->mallocFailed ){ 1187 return; 1187 return; 1188 } 1188 } 1189 pTerm = &pWC->a[idxTerm]; 1189 pTerm = &pWC->a[idxTerm]; 1190 pMaskSet = pWC->pMaskSet; 1190 pMaskSet = pWC->pMaskSet; 1191 pExpr = pTerm->pExpr; | 1191 pExpr = sqlite3ExprSkipCollate(pTerm->pExpr); 1192 prereqLeft = exprTableUsage(pMaskSet, pExpr->pLeft); 1192 prereqLeft = exprTableUsage(pMaskSet, pExpr->pLeft); 1193 op = pExpr->op; 1193 op = pExpr->op; 1194 if( op==TK_IN ){ 1194 if( op==TK_IN ){ 1195 assert( pExpr->pRight==0 ); 1195 assert( pExpr->pRight==0 ); 1196 if( ExprHasProperty(pExpr, EP_xIsSelect) ){ 1196 if( ExprHasProperty(pExpr, EP_xIsSelect) ){ 1197 pTerm->prereqRight = exprSelectTableUsage(pMaskSet, pExpr->x.pSelect); 1197 pTerm->prereqRight = exprSelectTableUsage(pMaskSet, pExpr->x.pSelect); 1198 }else{ 1198 }else{ ................................................................................................................................................................................ 1211 ** on left table of a LEFT JOIN. Ticket #3015 */ 1211 ** on left table of a LEFT JOIN. Ticket #3015 */ 1212 } 1212 } 1213 pTerm->prereqAll = prereqAll; 1213 pTerm->prereqAll = prereqAll; 1214 pTerm->leftCursor = -1; 1214 pTerm->leftCursor = -1; 1215 pTerm->iParent = -1; 1215 pTerm->iParent = -1; 1216 pTerm->eOperator = 0; 1216 pTerm->eOperator = 0; 1217 if( allowedOp(op) && (pTerm->prereqRight & prereqLeft)==0 ){ 1217 if( allowedOp(op) && (pTerm->prereqRight & prereqLeft)==0 ){ 1218 Expr *pLeft = pExpr->pLeft; | 1218 Expr *pLeft = sqlite3ExprSkipCollate(pExpr->pLeft); 1219 Expr *pRight = pExpr->pRight; | 1219 Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight); 1220 if( pLeft->op==TK_COLUMN ){ 1220 if( pLeft->op==TK_COLUMN ){ 1221 pTerm->leftCursor = pLeft->iTable; 1221 pTerm->leftCursor = pLeft->iTable; 1222 pTerm->u.leftColumn = pLeft->iColumn; 1222 pTerm->u.leftColumn = pLeft->iColumn; 1223 pTerm->eOperator = operatorMask(op); 1223 pTerm->eOperator = operatorMask(op); 1224 } 1224 } 1225 if( pRight && pRight->op==TK_COLUMN ){ 1225 if( pRight && pRight->op==TK_COLUMN ){ 1226 WhereTerm *pNew; 1226 WhereTerm *pNew; ................................................................................................................................................................................ 2861 int isMatch; /* ORDER BY term matches the index term */ 2861 int isMatch; /* ORDER BY term matches the index term */ 2862 const char *zColl; /* Name of collating sequence for i-th index term */ 2862 const char *zColl; /* Name of collating sequence for i-th index term */ 2863 WhereTerm *pConstraint; /* A constraint in the WHERE clause */ 2863 WhereTerm *pConstraint; /* A constraint in the WHERE clause */ 2864 2864 2865 /* If the next term of the ORDER BY clause refers to anything other than 2865 /* If the next term of the ORDER BY clause refers to anything other than 2866 ** a column in the "base" table, then this index will not be of any 2866 ** a column in the "base" table, then this index will not be of any 2867 ** further use in handling the ORDER BY. */ 2867 ** further use in handling the ORDER BY. */ 2868 pOBExpr = pOBItem->pExpr; | 2868 pOBExpr = sqlite3ExprSkipCollate(pOBItem->pExpr); 2869 if( pOBExpr->op!=TK_COLUMN || pOBExpr->iTable!=base ){ 2869 if( pOBExpr->op!=TK_COLUMN || pOBExpr->iTable!=base ){ 2870 break; 2870 break; 2871 } 2871 } 2872 2872 2873 /* Find column number and collating sequence for the next entry 2873 /* Find column number and collating sequence for the next entry 2874 ** in the index */ 2874 ** in the index */ 2875 if( pIdx->zName && i<pIdx->nColumn ){ 2875 if( pIdx->zName && i<pIdx->nColumn ){ ................................................................................................................................................................................ 2887 } 2887 } 2888 2888 2889 /* Check to see if the column number and collating sequence of the 2889 /* Check to see if the column number and collating sequence of the 2890 ** index match the column number and collating sequence of the ORDER BY 2890 ** index match the column number and collating sequence of the ORDER BY 2891 ** clause entry. Set isMatch to 1 if they both match. */ 2891 ** clause entry. Set isMatch to 1 if they both match. */ 2892 if( pOBExpr->iColumn==iColumn ){ 2892 if( pOBExpr->iColumn==iColumn ){ 2893 if( zColl ){ 2893 if( zColl ){ 2894 pColl = sqlite3ExprCollSeq(pParse, pOBExpr); | 2894 pColl = sqlite3ExprCollSeq(pParse, pOBItem->pExpr); 2895 if( !pColl ) pColl = db->pDfltColl; 2895 if( !pColl ) pColl = db->pDfltColl; 2896 isMatch = sqlite3StrICmp(pColl->zName, zColl)==0; 2896 isMatch = sqlite3StrICmp(pColl->zName, zColl)==0; 2897 }else{ 2897 }else{ 2898 isMatch = 1; 2898 isMatch = 1; 2899 } 2899 } 2900 }else{ 2900 }else{ 2901 isMatch = 0; 2901 isMatch = 0;