Use transparent comparator in mColumnNames to avoid creating std::string when comparing

This commit is contained in:
Kacperos155 2022-07-23 16:12:44 +02:00
parent d9e5a74773
commit 04a4c2e8ef
2 changed files with 3 additions and 3 deletions

View File

@ -703,7 +703,7 @@ private:
bool mbDone{false}; //!< true when the last executeStep() had no more row to fetch
/// Map of columns index by name (mutable so getColumnIndex can be const)
mutable std::map<std::string, int> mColumnNames;
mutable std::map<std::string, int, std::less<>> mColumnNames{};
};

View File

@ -275,7 +275,7 @@ int Statement::getColumnIndex(const char* apName) const
for (int i = 0; i < mColumnCount; ++i)
{
const char* pName = sqlite3_column_name(getPreparedStatement(), i);
mColumnNames[pName] = i;
mColumnNames.emplace(pName, i);
}
}
@ -288,7 +288,7 @@ int Statement::getColumnIndex(const char* apName) const
return iIndex->second;
}
const char * Statement::getColumnDeclaredType(const int aIndex) const
const char* Statement::getColumnDeclaredType(const int aIndex) const
{
checkIndex(aIndex);
const char * result = sqlite3_column_decltype(getPreparedStatement(), aIndex);