--- a/src/SqlException.cpp Mon May 25 21:11:17 2020 +0200
+++ b/src/SqlException.cpp Sun May 31 16:56:07 2020 +0200
@@ -18,6 +18,7 @@
#include <cstring>
#include <codecvt>
#include <locale>
+#include <iostream>
#include <sql.h>
#include <sqlext.h>
@@ -29,9 +30,11 @@
namespace sql {
SqlException::SqlException(std::wstring message) : message(message) {
+ std::wcerr << L"XXX SqlException: " << message.c_str() << std::endl << std::flush; // FIXME: remove
}
SqlException::SqlException(std::wstring message, SQLRETURN resultCode, SQLSMALLINT handleType, SQLHANDLE handle) : message(message), resultCode(resultCode) {
+ std::wcerr << L"XXX SqlException: " << message.c_str() << std::endl << std::flush; // FIXME: remove
std::wstring_convert < std::codecvt_utf8<wchar_t>> convertor; // TODO: support also other encodings
SQLCHAR buffer[SQL_MAX_MESSAGE_LENGTH + 1];
SQLCHAR sqlstate[SQL_SQLSTATE_SIZE + 1];
@@ -49,7 +52,8 @@
}
std::wstring SqlException::getMessage() const {
- return message;
+ if (resultCode) return message + L" SQLRETURN=" + std::to_wstring(resultCode);
+ else return message;
}
SQLRETURN SqlException::getResultCode() const {