1
0
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:
drh
2019-08-06 15:18:15 +00:00
parent 96fb16eecd
commit 915e434c35
3 changed files with 13 additions and 19 deletions

View File

@@ -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);
}
/*