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