diff options
Diffstat (limited to 'src')
-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); |