/ Check-in [f66c1db2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Recognize TK_COLLATE operators that have been transformed into TK_REGISTER. Skip both TK_COLLATE and TK_AS operators when looking for the top of an expression.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ticket-71e333e7
Files: files | file ages | folders
SHA1: f66c1db2965054f38125218202b6a6ec62d57666
User & Date: drh 2012-12-08 00:52:14
Context
2012-12-08
03:34
Veryquick passes all tests now. check-in: 7b96115e user: drh tags: ticket-71e333e7
00:52
Recognize TK_COLLATE operators that have been transformed into TK_REGISTER. Skip both TK_COLLATE and TK_AS operators when looking for the top of an expression. check-in: f66c1db2 user: drh tags: ticket-71e333e7
2012-12-07
23:23
Improved error messages when column integers in an ORDER BY clause are out of range. check-in: bd960d93 user: drh tags: ticket-71e333e7
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/expr.c.

81
82
83
84
85
86
87
88

89
90

91

92
93
94
95
96
97
98
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
    s.n = sqlite3Strlen30(s.z);
    pExpr = sqlite3ExprAddCollateToken(pParse, pExpr, &s);
  }
  return pExpr;
}

/*
** Skip over any TK_COLLATE operator in an expression.

*/
Expr *sqlite3ExprSkipCollate(Expr *pExpr){

  if( pExpr && pExpr->op==TK_COLLATE ) pExpr = pExpr->pLeft;

  return pExpr;
}

/*
** Return the collation sequence for the expression pExpr. If
** there is no defined collating sequence, return NULL.
**
................................................................................
  Expr *p = pExpr;
  while( p && pColl==0 ){
    int op = p->op;
    if( op==TK_CAST || op==TK_UPLUS ){
      p = p->pLeft;
      continue;
    }
    if( op==TK_COLLATE ){
      if( db->init.busy ){
        /* Do not report errors when parsing while the schema */
        pColl = sqlite3FindCollSeq(db, ENC(db), p->u.zToken, 0);
      }else{
        pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
      }
      break;







|
>


>
|
>







 







|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
    s.n = sqlite3Strlen30(s.z);
    pExpr = sqlite3ExprAddCollateToken(pParse, pExpr, &s);
  }
  return pExpr;
}

/*
** Skip over any TK_COLLATE and/or TK_AS operators at the root of
** an expression.
*/
Expr *sqlite3ExprSkipCollate(Expr *pExpr){
  while( pExpr && (pExpr->op==TK_COLLATE || pExpr->op==TK_AS) ){
    pExpr = pExpr->pLeft;
  }
  return pExpr;
}

/*
** Return the collation sequence for the expression pExpr. If
** there is no defined collating sequence, return NULL.
**
................................................................................
  Expr *p = pExpr;
  while( p && pColl==0 ){
    int op = p->op;
    if( op==TK_CAST || op==TK_UPLUS ){
      p = p->pLeft;
      continue;
    }
    if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
      if( db->init.busy ){
        /* Do not report errors when parsing while the schema */
        pColl = sqlite3FindCollSeq(db, ENC(db), p->u.zToken, 0);
      }else{
        pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
      }
      break;