Skip to Content.
Sympa Menu

freetds - RE: [freetds] FreeTDS 0.61 broken with Sybase

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] FreeTDS 0.61 broken with Sybase
  • Date: Thu, 26 Jun 2003 17:45:42 -0400

> From: Alex Kiesel [mailto:alex.kiesel AT document-root.de]
> Sent: June 26, 2003 4:55 PM
>
> Again, after testing with PHP5 (out of todays CVS), and todays
> freetds-current (0.61.dev.20030626) and looking a little bit into PHP
> Sybase handling code, I see the following when selecting an empty
> resultset:

Now I think we're getting somewhere. Sorry to put you to so much trouble.

> * ct_results is called, it gives restype 4047 (TDS_CMD_SUCCEED)
> fetching of any data except for
> ct_res_info(sybase_ptr->cmd, CS_ROW_COUNT, &row_count, ...)
> therefore does not take place. A CS_ROW_RESULT would be
> necessary even
> if it is an empty resultset.

Let me see if I understand. I'm not a ct-lib programmer; I just read the
docs and follow along.

1. The command is executed and the result set empty. The query might
have been as simple as "select 1 where 0=1".
2. ct_results() is called, it gives restype 4047 (CS_CMD_SUCCEED). It
should return CS_ROW_RESULT.
2a. ct_res_info() should be called and should yield the number of
columns.
2b. ct_fetch should be called, and should return no rows.
3. Instead, 2a & 2b do *not* happen.
4. The next call to ct_results() returns a surprise to PHP, and bad
things start to happen.

You're right that empty resultset handling changed since 0.60, even since
0.61.1. It's not clear to me exactly what's wrong, though.

We have unittests for empty result sets:

src/dblib/unittests/t0016.c
src/dblib/unittests/t0017.c
src/odbc/unittests/t0002.c

but not for ct-lib. :-( I will not have time to write a unittest before the
weekend. It appears a small change to src/ctlib/unittests/t0009.c could
illustrate what's wrong.

I think you're right that you and Tim are experiencing the same problem.
:-( You're using ct-lib, and he's using Frank M. Kromann's mssql extention,
based on db-lib. Taken together, those facts imply a problem in libtds (and
not in PHP).

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.






Archive powered by MHonArc 2.6.24.

Top of Page