1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Use the sqlite3ColumnIndex() routine to look up a column in a table, rather

than using a custom loop.  Performance improvement, size reduction, and
complexity decrease.

FossilOrigin-Name: 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8
This commit is contained in:
drh
2025-02-08 14:15:42 +00:00
parent 03c65171b8
commit 9d90a3af2f
10 changed files with 106 additions and 152 deletions

View File

@@ -3943,13 +3943,10 @@ int sqlite3_table_column_metadata(
if( zColumnName==0 ){
/* Query for existence of table only */
}else{
for(iCol=0; iCol<pTab->nCol; iCol++){
iCol = sqlite3ColumnIndex(pTab, zColumnName);
if( iCol>=0 ){
pCol = &pTab->aCol[iCol];
if( 0==sqlite3StrICmp(pCol->zCnName, zColumnName) ){
break;
}
}
if( iCol==pTab->nCol ){
}else{
if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){
iCol = pTab->iPKey;
pCol = iCol>=0 ? &pTab->aCol[iCol] : 0;