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: "James K. Lowden" <jklowden AT schemamania.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Row processed count returns 0
  • Date: Fri, 19 Mar 2004 00:17:45 -0500

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.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page