diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-29 02:42:43 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-29 06:00:07 +0000 |
commit | be237957454cd7a4e84a5a603bdef6ab3ab8b8e1 (patch) | |
tree | bfe7f06152b2d453bcd097d9913918473d8fecd7 /libodbcpp/odbc-selectcommand.cpp | |
parent | Remove rebind (diff) | |
download | libdbpp-odbc-be237957454cd7a4e84a5a603bdef6ab3ab8b8e1.tar.bz2 libdbpp-odbc-be237957454cd7a4e84a5a603bdef6ab3ab8b8e1.tar.xz libdbpp-odbc-be237957454cd7a4e84a5a603bdef6ab3ab8b8e1.zip |
Reshuffle and add new exceptions
Diffstat (limited to 'libodbcpp/odbc-selectcommand.cpp')
-rw-r--r-- | libodbcpp/odbc-selectcommand.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libodbcpp/odbc-selectcommand.cpp b/libodbcpp/odbc-selectcommand.cpp index 52a45ad..6418501 100644 --- a/libodbcpp/odbc-selectcommand.cpp +++ b/libodbcpp/odbc-selectcommand.cpp @@ -19,7 +19,7 @@ ODBC::SelectCommand::~SelectCommand() if (!columns->empty()) { RETCODE rc = SQLCloseCursor(hStmt); if (!SQL_SUCCEEDED(rc)) { - throw Error(rc, SQL_HANDLE_STMT, hStmt, "ODBC::SelectCommand::~SelectCommand SQLCloseCursor"); + throw Error(rc, SQL_HANDLE_STMT, hStmt); } } } @@ -52,7 +52,7 @@ ODBC::SelectCommand::fetch(SQLSMALLINT orientation, SQLLEN offset) } } if (rc != SQL_SUCCESS_WITH_INFO) { - throw Error(rc, SQL_HANDLE_STMT, hStmt, "ODBC::SelectCommand::fetch SQLFetch"); + throw Error(rc, SQL_HANDLE_STMT, hStmt); } } case SQL_SUCCESS: @@ -76,14 +76,11 @@ ODBC::SelectCommand::execute() { RETCODE rc = SQLExecute(hStmt); if (!SQL_SUCCEEDED(rc)) { - throw Error(rc, SQL_HANDLE_STMT, hStmt, "ODBC::SelectCommand::execute SQLExecute"); + throw Error(rc, SQL_HANDLE_STMT, hStmt); } SQLSMALLINT colCount; if (!SQL_SUCCEEDED(rc = SQLNumResultCols(hStmt, &colCount))) { - throw Error(rc, SQL_HANDLE_STMT, hStmt, "ODBC::SelectCommand::execute SQLNumResultCols"); - } - if (colCount < 1) { - throw Error("ODBC::SelectCommand::execute No result columns"); + throw Error(rc, SQL_HANDLE_STMT, hStmt); } for (int col = 0; col < colCount; col++) { SQLCHAR _colName[300]; @@ -92,7 +89,7 @@ ODBC::SelectCommand::execute() int sqlcol = col + 1; if (!SQL_SUCCEEDED(rc = SQLDescribeCol(hStmt, sqlcol, _colName, sizeof(_colName), &nameLen, &bindType, &bindSize, &dp, &nullable))) { - throw Error(rc, SQL_HANDLE_STMT, hStmt, "ODBC::SelectCommand::execute SQLDescribeCol for %d"); + throw Error(rc, SQL_HANDLE_STMT, hStmt); } Glib::ustring colName((const char *)_colName, nameLen); DB::ColumnPtr ncol; @@ -133,7 +130,7 @@ ODBC::SelectCommand::execute() ncol = insertColumn(DB::ColumnPtr(new TimeStampColumn(this, colName, col))); break; case SQL_UNKNOWN_TYPE: - throw Error("Unknown column type"); + throw DB::ColumnTypeNotSupported(); default: ncol = insertColumn(DB::ColumnPtr(new CharArrayColumn(this, colName, col, bindSize))); break; |