Skip to Content.
Sympa Menu

freetds - RE: [freetds] Row processed count returns 0

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] Row processed count returns 0
  • Date: Fri, 19 Mar 2004 08:15:02 +0100



> -----Original Message-----
> From: freetds-bounces AT lists.ibiblio.org
> [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of James
> K. Lowden
> Sent: venerdì 19 marzo 2004 6.18
> To: FreeTDS Development Group
> Subject: Re: [freetds] Row processed count returns 0
>
>
> On Thu, 18 Mar 2004, "Piet De Jong" <piet AT ahead-tech.net> wrote:
> > > I'm getting ready to commit the attached patch. I would
> > > > appreciate it if you would look it over, to make sure it does
> > > > what you intend.
> ...
> > > It's seems right. Just remove code inside
> ENABLE_DEVELOPING #if/#endif
> > > and copy transaction.c test source from current CVS (it
> has to work).
> >
> > I have successfully applied the patch to 0.62.1
> > Not sure what you mean by (ENABLE_DEVELOPING #if/#endif and
> > transaction.c ) so I havent done anything else but applying
> the patch.
>
> See lines 185-266 in my patch. Frediano is suggesting those lines be
> deleted (from src/odbc/odbc.c) after applying the patch.
> That matters to
> me because it affects what would be included in our release, but it
> doesn't matter to you unless you use the --enable-developing
> option for
> the configure script.
>
> > When I run "make check" then all tests report success.
> >
> > However in my application I get the old error message:
> [FreeTDS][SQL
> > Server]Invalid cursor state
>
> I don't believe you're using ODBC correctly. You must
> exectute the query
> and fetch the results before asking for the rowcount. Your
> ODBC trace has
> these lines:
>
> unix 00004000 ENTER SQLPrepare
> SQLHSTMT 0x808eda0
> SQLCHAR * 0x8091850
> | select id from testtable
> where enddate
> i |
> | s null
>
> |
> SQLINTEGER -3 (SQL_NTS)
>
> unix 00004000 EXIT SQLPrepare with return code 0
> (SQL_SUCCESS)
> SQLHSTMT 0x808eda0
> SQLCHAR * 0x8091850
> SQLINTEGER -3 (SQL_NTS)
>
> unix 00004000 ENTER SQLNumResultCols
> SQLHSTMT 0x808eda0
> SQLSMALLINT * 0xbfffcfcc
>
> unix 00004000 EXIT SQLNumResultCols with return code -1
> (SQL_ERROR)
> SQLHSTMT 0x808eda0
> SQLSMALLINT * 0xbfffcfcc
>
> AFAICT, you called SQLPrepare() followed by
> SQLNumResultCols(). I think
> you need SQLExecute() or something; the server is never executing your
> query and never returns any results.
>
> RAR archives are a little unusual, BTW. You might want to
> stick to tar or
> gzip format, if you want people to read them easily. :-)
>
> HTH.
>

Just remove these lines

#if !UNIXODBC
if (stmt->dbc->current_statement != stmt) {
odbc_errs_add(&stmt->errs, "24000", NULL, NULL);
ODBC_RETURN(stmt, SQL_ERROR);
}

IRD_CHECK;
#endif

from odbc.c (SQLNumResultCols)

>From specifications you can call SQLNumResultCols after SQLPrepare. This is
>not still supported under FreeTDS however it shouldn't be a big problem...

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page