get error without recording it
This commit is contained in:
parent
3f0d3b65f6
commit
53c280fe54
|
@ -2041,17 +2041,20 @@ namespace core {
|
|||
SQLSMALLINT num_cols;
|
||||
r = ::SQLNumResultCols( stmt->handle(), &num_cols );
|
||||
|
||||
// Workaround for a bug in unixODBC: after SQLExecDirect for an empty result set,
|
||||
// Workaround for a bug in unixODBC: after SQLExecDirect returns SQL_NO_DATA,
|
||||
// r = ::SQLNumResultCols( stmt->handle(), &num_cols );
|
||||
// returns r=-1 (SQL_ERROR) and error HY010 (Function sequence error)
|
||||
// but it should have succeeded with r=0 (SQL_SUCCESS) and no error
|
||||
// instead of throwing an exception, return 0 if the r=-1, stament has been executed, and has a HY010 error
|
||||
// (HY010 error should not return if stmt->execute is true)
|
||||
#ifndef _WIN32
|
||||
if ( r == -1 && stmt->executed && strcmp( reinterpret_cast<const char*>( stmt->last_error()->sqlstate ), "HY010" ) == 0 )
|
||||
sqlsrv_error_auto_ptr error;
|
||||
if ( stmt->current_results != NULL ) {
|
||||
error = stmt->current_results->get_diag_rec( 1 );
|
||||
}
|
||||
if ( r == -1 && stmt->executed && strcmp( reinterpret_cast<const char*>( error->sqlstate ), "HY010" ) == 0 )
|
||||
return 0;
|
||||
#endif // !_WIN32
|
||||
|
||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
||||
throw CoreException();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue