Skip to Content.
Sympa Menu

freetds - Re: [freetds] new utility: bsqlodbc

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] new utility: bsqlodbc
  • Date: Wed, 7 Feb 2007 19:27:41 -0500

ZIGLIO, Frediano, VF-IT wrote:
> > value
> > ----------
> > 9
> > value
> > ----------
> > 10
> > bsqlodbc: error -1: SQLFetch: SQL_ERROR: failed
> > bsqlodbc: error 50000: 42000: [FreeTDS][SQL Server]ouch of severity 11
> >
> > >From that, it looks like SQLExecute gets an error, but when
> > print_error_message tries to retrieve the messages (how many
> > should there
> > be?) it finds only one. Thereafter SQLFetch gets only
> > SQL_SUCCESS until
> > it comes across the RAISERROR with severity 11, when it gets
> > SQL_ERROR.
>
> You are using ODBC which is quite strange with this things. Try using
> latest unixODBC and ODBC 3.

Hi Freddy,

Are you saying you this should not work without a DM? It's only the DM's
job?

> The problem came from SQLFetch return. If a data is fetched a
> SQL_SUCCESS is returned and server error get read by SQLMoreResults

This IMO is not correct behavior. SQLFetch should return
SQL_SUCCESS_WITH_INFO:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcsqlfetch.asp

"SQLFetch returns the status records in row number order. That is, it
returns all status records for unknown rows (if any), then all status
records for the first row (if any), then all status records for the second
row (if any), and so on. The status records for each individual row are
ordered according to the normal rules for ordering status records...."

> unixODBC (as my suggestion) read errors
> even if SQLMoreResults returns SQL_SUCCESS

Afaict that's unixODBC compensating for a driver error. I would like to
test without a DM if possible. The results are clearer and easier to
debug that way.

> ODBC 3 support
> recordset without rows but with error to separate errors during fetch
> from single errors.

SQLFetch was introduced with ODBC 1.0 but was never deprecated or
superseded. It is a 3.0 function, no?

My query produces 17 resultsets. IMO SQLFetch should return
SQL_SUCCESS_WITH_INFO for every one until it returns SQL_ERROR.

> server error get read by SQLMoreResults
> however this function has to return SQL_SUCCESS when we have another
> recordset

Why?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcsqlfetch.asp

"When SQLMoreResults returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an
associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a
HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle."

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page