Upgraded SQLite 3 library to version 3.3.13

This commit is contained in:
Ilia Alshanetsky 2007-02-20 00:09:43 +00:00
parent c6402df3a7
commit 03e5b080a3
21 changed files with 1588 additions and 1275 deletions

View file

@ -49,6 +49,24 @@ char sqlite3ExprAffinity(Expr *pExpr){
return pExpr->affinity;
}
/*
** Set the collating sequence for expression pExpr to be the collating
** sequence named by pToken. Return a pointer to the revised expression.
** The collating sequence is marked as "explicit" using the EP_ExpCollate
** flag. An explicit collating sequence will override implicit
** collating sequences.
*/
Expr *sqlite3ExprSetColl(Parse *pParse, Expr *pExpr, Token *pName){
CollSeq *pColl;
if( pExpr==0 ) return 0;
pColl = sqlite3LocateCollSeq(pParse, (char*)pName->z, pName->n);
if( pColl ){
pExpr->pColl = pColl;
pExpr->flags |= EP_ExpCollate;
}
return pExpr;
}
/*
** Return the default collation sequence for the expression pExpr. If
** there is no default collation type, return 0.
@ -158,9 +176,20 @@ static int binaryCompareP1(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){
** type.
*/
static CollSeq* binaryCompareCollSeq(Parse *pParse, Expr *pLeft, Expr *pRight){
CollSeq *pColl = sqlite3ExprCollSeq(pParse, pLeft);
if( !pColl ){
pColl = sqlite3ExprCollSeq(pParse, pRight);
CollSeq *pColl;
assert( pLeft );
assert( pRight );
if( pLeft->flags & EP_ExpCollate ){
assert( pLeft->pColl );
pColl = pLeft->pColl;
}else if( pRight->flags & EP_ExpCollate ){
assert( pRight->pColl );
pColl = pRight->pColl;
}else{
pColl = sqlite3ExprCollSeq(pParse, pLeft);
if( !pColl ){
pColl = sqlite3ExprCollSeq(pParse, pRight);
}
}
return pColl;
}
@ -205,8 +234,18 @@ Expr *sqlite3Expr(int op, Expr *pLeft, Expr *pRight, const Token *pToken){
if( pToken ){
assert( pToken->dyn==0 );
pNew->span = pNew->token = *pToken;
}else if( pLeft && pRight ){
sqlite3ExprSpan(pNew, &pLeft->span, &pRight->span);
}else if( pLeft ){
if( pRight ){
sqlite3ExprSpan(pNew, &pLeft->span, &pRight->span);
if( pRight->flags && EP_ExpCollate ){
pNew->flags |= EP_ExpCollate;
pNew->pColl = pRight->pColl;
}
}
if( pLeft->flags && EP_ExpCollate ){
pNew->flags |= EP_ExpCollate;
pNew->pColl = pLeft->pColl;
}
}
return pNew;
}
@ -890,7 +929,9 @@ static int lookupName(
/* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
pExpr->iColumn = j==pTab->iPKey ? -1 : j;
pExpr->affinity = pTab->aCol[j].affinity;
pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0);
if( (pExpr->flags & EP_ExpCollate)==0 ){
pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0);
}
if( i<pSrcList->nSrc-1 ){
if( pItem[1].jointype & JT_NATURAL ){
/* If this match occurred in the left table of a natural join,
@ -946,7 +987,9 @@ static int lookupName(
cnt++;
pExpr->iColumn = iCol==pTab->iPKey ? -1 : iCol;
pExpr->affinity = pTab->aCol[iCol].affinity;
pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0);
if( (pExpr->flags & EP_ExpCollate)==0 ){
pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0);
}
pExpr->pTab = pTab;
break;
}
@ -1046,7 +1089,7 @@ static int lookupName(
n = sizeof(Bitmask)*8-1;
}
assert( pMatch->iCursor==pExpr->iTable );
pMatch->colUsed |= 1<<n;
pMatch->colUsed |= ((Bitmask)1)<<n;
}
lookupname_end: