# HG changeset patch # User František Kučera # Date 1650732565 -7200 # Node ID a4907b207f0c464120daa38efa2d92ca60bd06a1 # Parent 723621f9b14a1ac806f392f86b1d510870b6125b remove superfluous c_str() diff -r 723621f9b14a -r a4907b207f0c src/ResultSet.cpp --- a/src/ResultSet.cpp Sat Dec 04 21:14:54 2021 +0100 +++ b/src/ResultSet.cpp Sat Apr 23 18:49:25 2022 +0200 @@ -67,9 +67,9 @@ return L""; } else if (stringLength >= 0) { std::string value; - value.reserve(stringLength); + value.resize(stringLength); result = SQLGetData(statement, columnNumber, SQL_C_CHAR, (SQLCHAR*) value.c_str(), value.capacity() + 1, &stringLength); // trailing null byte = + 1 - if (OdbcCommon::isSuccessful(result)) return convertor.from_bytes(value.c_str()); + if (OdbcCommon::isSuccessful(result)) return convertor.from_bytes(value); } throw SqlException(L"Unable to get string value", result, SQL_HANDLE_STMT, statement); } @@ -128,8 +128,8 @@ } std::wstringstream errorMessage; - errorMessage << L"Unable to find column with name „" << columnName.c_str() << L"“ Availalable columns are: "; - for (MetaData::ColumnDescriptor cd : columnDescriptors) errorMessage << L"„" << cd.name.c_str() << L"“ "; + errorMessage << L"Unable to find column with name „" << columnName << L"“ Availalable columns are: "; + for (MetaData::ColumnDescriptor cd : columnDescriptors) errorMessage << L"„" << cd.name << L"“ "; throw SqlException(errorMessage.str()); } diff -r 723621f9b14a -r a4907b207f0c src/SqlHandler.h --- a/src/SqlHandler.h Sat Dec 04 21:14:54 2021 +0100 +++ b/src/SqlHandler.h Sat Apr 23 18:49:25 2022 +0200 @@ -70,7 +70,7 @@ for (wchar_t ch; *input >> ch;) { if (scanner.append(ch)) { - *sql << scanner.getAndReset().c_str(); + *sql << scanner.getAndReset(); return true; } }