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: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] new utility: bsqlodbc
  • Date: Mon, 12 Feb 2007 11:20:17 +0100

>
> 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.
>

Sorry for late reply, I sent this reply a week ago but I don't
understand why it was rejected (and I was too busy to post again
earlier)

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

No, I though you were using unixODBC, no problem without DM.
However I think you'll get better results with ODBC 3

> > 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.
>

the problem is SQLMoreResults.

> > 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.
>


select return no errors so SQLFetch returns SQL_SUCCESS, error is
retrieved by SQLMoreResults.

> > 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."
>


You are using ODBC 2, documentation refer to ODBC 3.

bye
freddy77

PS: yes, it's a nightmare :)






Archive powered by MHonArc 2.6.24.

Top of Page