[unixODBC-dev] Problem getting error on SQL_NO_DATA

Nick Gorham nick at lurcher.org
Fri Apr 8 13:57:08 BST 2005


ZIGLIO, Frediano, VF-IT wrote:
> After some tests if seems that if a function (SQLFetch or
> SQLMoreResults) return SQL_NO_DATA it can also return warning/errors
> however the way unixODBC work (cache error on
> SQL_SUCCESS_WITH_INFO/SQL_ERROR) do not work cause it do not expect
> diagnostics on SQL_NO_DATA.
> 
> For example using a store procedure with this body on mssql
> 
>   SELECT 1
>   RAISERROR ('test', 16, 1)
> 
> using this sequence
> 
>    SQLBindCol
>    SQLExecDirect
>    SQLFetch (success)
>    SQLFetch (no data)
> this last fetch return 'test' diagnostic (RAISERROR cause a diagnostic
> information to be returned from server)
> 
> freddy77
> 
> _______________________________________________
> unixODBC-dev mailing list
> unixODBC-dev at easysoft.com
> http://mail.easysoft.com/mailman/listinfo/unixodbc-dev

That should be a simple thing to do, to try, just edit 
DriverManager/__info.c and on or about line 4870 change

int function_return_ex( int level, void * handle, int ret_code, int 
save_to_diag )
{
     DMHENV henv;
     DMHDBC hdbc;
     DMHSTMT hstmt;
     DMHDESC hdesc;

     if ( ret_code == SQL_ERROR ||
             ret_code == SQL_SUCCESS_WITH_INFO )
     {


to


int function_return_ex( int level, void * handle, int ret_code, int 
save_to_diag )
{
     DMHENV henv;
     DMHDBC hdbc;
     DMHSTMT hstmt;
     DMHDESC hdesc;

     if ( ret_code == SQL_ERROR ||
             ret_code == SQL_SUCCESS_WITH_INFO ||
	    ret_code == SQL_NO_DATA )
     {

See is that does what you are after.

-- 
Nick




More information about the unixODBC-dev mailing list