mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Performance optimization to the new affinity handling logic.
FossilOrigin-Name: c9724e761bce7a4ae63ce3c1408795915865e8d3024dcb90690456f724f0df53
This commit is contained in:
18
src/expr.c
18
src/expr.c
@@ -239,11 +239,6 @@ char sqlite3CompareAffinity(Expr *pExpr, char aff2){
|
||||
}else{
|
||||
return SQLITE_AFF_BLOB;
|
||||
}
|
||||
}else if( aff1<=SQLITE_AFF_NONE && aff2<=SQLITE_AFF_NONE ){
|
||||
/* Neither side of the comparison is a column. Compare the
|
||||
** results directly.
|
||||
*/
|
||||
return SQLITE_AFF_BLOB;
|
||||
}else{
|
||||
/* One side is a column, the other is not. Use the columns affinity. */
|
||||
assert( aff1<=SQLITE_AFF_NONE || aff2<=SQLITE_AFF_NONE );
|
||||
@@ -280,14 +275,13 @@ static char comparisonAffinity(Expr *pExpr){
|
||||
*/
|
||||
int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){
|
||||
char aff = comparisonAffinity(pExpr);
|
||||
switch( aff ){
|
||||
case SQLITE_AFF_BLOB:
|
||||
return 1;
|
||||
case SQLITE_AFF_TEXT:
|
||||
return idx_affinity==SQLITE_AFF_TEXT;
|
||||
default:
|
||||
return sqlite3IsNumericAffinity(idx_affinity);
|
||||
if( aff<SQLITE_AFF_TEXT ){
|
||||
return 1;
|
||||
}
|
||||
if( aff==SQLITE_AFF_TEXT ){
|
||||
return idx_affinity==SQLITE_AFF_TEXT;
|
||||
}
|
||||
return sqlite3IsNumericAffinity(idx_affinity);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user