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()); }