mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 03:20:11 +01:00
improved ODBC error reporting (SQL_NO_DATA)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ODBCStatementImpl.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/ODBC/src/ODBCStatementImpl.cpp#5 $
|
||||
// $Id: //poco/Main/Data/ODBC/src/ODBCStatementImpl.cpp#8 $
|
||||
//
|
||||
// Library: ODBC
|
||||
// Package: ODBC
|
||||
@@ -323,12 +323,16 @@ void ODBCStatementImpl::checkError(SQLRETURN rc, const std::string& msg)
|
||||
{
|
||||
if (Utility::isError(rc))
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << std::endl << "Requested SQL statement: " << toString() << std::endl;
|
||||
os << "Native SQL statement: " << nativeSQL() << std::endl;
|
||||
std::string str(msg); str += os.str();
|
||||
if (rc != SQL_NO_DATA)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << std::endl << "Requested SQL statement: " << toString() << std::endl;
|
||||
os << "Native SQL statement: " << nativeSQL() << std::endl;
|
||||
std::string str(msg); str += os.str();
|
||||
|
||||
throw StatementException(_stmt, str);
|
||||
throw StatementException(_stmt, str);
|
||||
}
|
||||
else throw NoDataException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DataException.h
|
||||
//
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/DataException.h#7 $
|
||||
// $Id: //poco/Main/Data/include/Poco/Data/DataException.h#8 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -60,6 +60,7 @@ POCO_DECLARE_EXCEPTION(Data_API, NotSupportedException, DataException)
|
||||
POCO_DECLARE_EXCEPTION(Data_API, NotImplementedException, DataException)
|
||||
POCO_DECLARE_EXCEPTION(Data_API, SessionUnavailableException, DataException)
|
||||
POCO_DECLARE_EXCEPTION(Data_API, SessionPoolExhaustedException, DataException)
|
||||
POCO_DECLARE_EXCEPTION(Data_API, NoDataException, DataException)
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// DataException.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/src/DataException.cpp#7 $
|
||||
// $Id: //poco/Main/Data/src/DataException.cpp#8 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
@@ -54,6 +54,7 @@ POCO_IMPLEMENT_EXCEPTION(NotSupportedException, DataException, "Feature or prope
|
||||
POCO_IMPLEMENT_EXCEPTION(NotImplementedException, DataException, "Feature or property not implemented")
|
||||
POCO_IMPLEMENT_EXCEPTION(SessionUnavailableException, DataException, "Session is unavailable")
|
||||
POCO_IMPLEMENT_EXCEPTION(SessionPoolExhaustedException, DataException, "No more sessions available from the session pool")
|
||||
POCO_IMPLEMENT_EXCEPTION(NoDataException, DataException, "No data found")
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
|
||||
Reference in New Issue
Block a user