diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2022-08-19 15:07:24 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2022-08-19 15:07:24 +0200 |
commit | 8cd940e41aead82921f3d8f5b49d6a9c7773ce40 (patch) | |
tree | 2d2859360bc4bfd21d12b2a3318b870b558abd44 | |
parent | 20d2a17dccd77f5b31e41a170bacc656fa5acc7d (diff) | |
download | manaserv-8cd940e41aead82921f3d8f5b49d6a9c7773ce40.tar.gz manaserv-8cd940e41aead82921f3d8f5b49d6a9c7773ce40.tar.bz2 manaserv-8cd940e41aead82921f3d8f5b49d6a9c7773ce40.tar.xz manaserv-8cd940e41aead82921f3d8f5b49d6a9c7773ce40.zip |
Premature optimization based on clazy hint
-rw-r--r-- | src/dal/sqlitedataprovider.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dal/sqlitedataprovider.cpp b/src/dal/sqlitedataprovider.cpp index d83dc274..4b959f98 100644 --- a/src/dal/sqlitedataprovider.cpp +++ b/src/dal/sqlitedataprovider.cpp @@ -370,10 +370,11 @@ const RecordSet &SqLiteDataProvider::processSql() if (!mIsConnected) throw std::runtime_error("not connected to database"); - int totalCols = sqlite3_column_count(mStmt); + const int totalCols = sqlite3_column_count(mStmt); // ensure we set column headers before adding a row Row fieldNames; + fieldNames.reserve(totalCols); for (int col = 0; col < totalCols; ++col) { fieldNames.push_back(sqlite3_column_name(mStmt, col)); @@ -383,6 +384,7 @@ const RecordSet &SqLiteDataProvider::processSql() while (sqlite3_step(mStmt) == SQLITE_ROW) { Row r; + r.reserve(totalCols); for (int col = 0; col < totalCols; ++col) { const unsigned char *txt = sqlite3_column_text(mStmt, col); |