improved ODBC error reporting (SQL_NO_DATA)

This commit is contained in:
Guenter Obiltschnig
2007-09-19 20:01:48 +00:00
parent 2fa2a98714
commit 40c0f41fa0
3 changed files with 15 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
// //
// ODBCStatementImpl.cpp // ODBCStatementImpl.cpp
// //
// $Id: //poco/Main/Data/ODBC/src/ODBCStatementImpl.cpp#5 $ // $Id: //poco/Main/Data/ODBC/src/ODBCStatementImpl.cpp#8 $
// //
// Library: ODBC // Library: ODBC
// Package: ODBC // Package: ODBC
@@ -322,6 +322,8 @@ std::string ODBCStatementImpl::nativeSQL()
void ODBCStatementImpl::checkError(SQLRETURN rc, const std::string& msg) void ODBCStatementImpl::checkError(SQLRETURN rc, const std::string& msg)
{ {
if (Utility::isError(rc)) if (Utility::isError(rc))
{
if (rc != SQL_NO_DATA)
{ {
std::ostringstream os; std::ostringstream os;
os << std::endl << "Requested SQL statement: " << toString() << std::endl; os << std::endl << "Requested SQL statement: " << toString() << std::endl;
@@ -330,6 +332,8 @@ void ODBCStatementImpl::checkError(SQLRETURN rc, const std::string& msg)
throw StatementException(_stmt, str); throw StatementException(_stmt, str);
} }
else throw NoDataException();
}
} }

View File

@@ -1,7 +1,7 @@
// //
// DataException.h // DataException.h
// //
// $Id: //poco/Main/Data/include/Poco/Data/DataException.h#7 $ // $Id: //poco/Main/Data/include/Poco/Data/DataException.h#8 $
// //
// Library: Data // Library: Data
// Package: DataCore // 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, NotImplementedException, DataException)
POCO_DECLARE_EXCEPTION(Data_API, SessionUnavailableException, DataException) POCO_DECLARE_EXCEPTION(Data_API, SessionUnavailableException, DataException)
POCO_DECLARE_EXCEPTION(Data_API, SessionPoolExhaustedException, DataException) POCO_DECLARE_EXCEPTION(Data_API, SessionPoolExhaustedException, DataException)
POCO_DECLARE_EXCEPTION(Data_API, NoDataException, DataException)
} } // namespace Poco::Data } } // namespace Poco::Data

View File

@@ -1,7 +1,7 @@
// //
// DataException.cpp // DataException.cpp
// //
// $Id: //poco/Main/Data/src/DataException.cpp#7 $ // $Id: //poco/Main/Data/src/DataException.cpp#8 $
// //
// Library: Data // Library: Data
// Package: DataCore // 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(NotImplementedException, DataException, "Feature or property not implemented")
POCO_IMPLEMENT_EXCEPTION(SessionUnavailableException, DataException, "Session is unavailable") POCO_IMPLEMENT_EXCEPTION(SessionUnavailableException, DataException, "Session is unavailable")
POCO_IMPLEMENT_EXCEPTION(SessionPoolExhaustedException, DataException, "No more sessions available from the session pool") POCO_IMPLEMENT_EXCEPTION(SessionPoolExhaustedException, DataException, "No more sessions available from the session pool")
POCO_IMPLEMENT_EXCEPTION(NoDataException, DataException, "No data found")
} } // namespace Poco::Data } } // namespace Poco::Data