diff options
author | drh <drh@noemail.net> | 2020-07-20 13:11:19 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2020-07-20 13:11:19 +0000 |
commit | a192807c132854b8da42aad2ba0d03b26751fce4 (patch) | |
tree | 98b42a3c17be42f601144f1c638e82b08db96792 /src | |
parent | 51da8daf822a8c27fd2f4646c4c19d8ed23a7e73 (diff) | |
download | sqlite-a192807c132854b8da42aad2ba0d03b26751fce4.tar.gz sqlite-a192807c132854b8da42aad2ba0d03b26751fce4.zip |
Faster column name lookup in the columnIndex() routine using hashing.
FossilOrigin-Name: de2a90812498e504c9b8eeb83bfc48a948b45e87bdfa242c0aa9f0377d90740f
Diffstat (limited to 'src')
-rw-r--r-- | src/select.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c index cbc64e3c2..903b90a5d 100644 --- a/src/select.c +++ b/src/select.c @@ -264,8 +264,10 @@ int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ */ static int columnIndex(Table *pTab, const char *zCol){ int i; - for(i=0; i<pTab->nCol; i++){ - if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i; + u8 h = sqlite3StrIHash(zCol); + Column *pCol; + for(pCol=pTab->aCol, i=0; i<pTab->nCol; pCol++, i++){ + if( pCol->hName==h && sqlite3StrICmp(pCol->zName, zCol)==0 ) return i; } return -1; } |