[freetds] SQLMoreResults and odbc/unittests/rpc.c

Lowden, James K james.k.lowden at alliancebernstein.com
Wed Jul 12 10:17:00 EDT 2006

> From: Frediano Ziglio
> Sent: Wednesday, July 12, 2006 1:08 AM
> Well, currently test should work, I tested it with ms odbc and it
> returns 3 resultset (and IMO it has to do so...). So the only
> problem is that SQLMoreResults returns one more SQL_SUCCESS...
> Il giorno mar, 11/07/2006 alle 18.44 -0400, Lowden, James K ha
> scritto:
> > The problem is row_count=1; it should be TDS_NO_COUNT.
> ...
> > I hope that by fixing this, we'll make DBD::ODBC happy.
> > 
> ?? according to http://freetds.sourceforge.net/out/test/test.1.html
> DBD::ODBC is already happy..

Sometimes DBD::ODBC is happy.  But look at this output:

=== begin ===
$ perl ~/tmp/odbc_rpc.pl [...]  simdb..IsFreeTdsBroken
  Perl            : 5.008       (alpha-dec_osf)
  OS              : dec_osf     (4.0g)
  DBI             : 1.50
  DBD::Sponge     : 11.10
  DBD::Proxy      : 0.2004
  DBD::ODBC       : 1.13
  DBD::Multiplex  : 0.9
  DBD::File       : 0.33
  DBD::ExampleP   : 11.12
  DBD::DBM        : 0.03
odbc_async_exec is: 0
                         SQL_DM_VER     03.52.0002.0002
                    SQL_DRIVER_NAME     libtdsodbc.so
                     SQL_DRIVER_VER     0.64RC3
                      SQL_DBMS_NAME     Microsoft SQL Server
                       SQL_DBMS_VER     08.00.2162
                       SQL_ODBC_VER     03.52
                SQL_DRIVER_ODBC_VER     03.00
               SQL_DATA_SOURCE_NAME     mpquant
                    SQL_SERVER_NAME     AC2KAMA0848
                  SQL_DATABASE_NAME     master
Binding parameter #1, the return code

Executing: "{? = call simdb..IsFreeTdsBroken }" with parameters ''
execute returned: '-1'
Result #1:
'2006-07-01 00:00:00'
Result #2:
===> state: HY010 msg: Function sequence error
DBD::ODBC::st fetchrow failed: (DBD: st_fetch/SQLFetch err=-1) at
/usr/users2/jklowden/tmp/odbc_rpc.pl line 133.
(return status is 0)
=== end ===

To remind you, the procedure selects a smalldatetime row (1 column) and
returns 0:

CREATE procedure IsFreeTdsBroken
as begin

        select LatestInputsmDate = max(smDate)
        from smdates

        return 0

The loop continues to the second "phantom" resultset because 

	while ( $sth->{Active} ) 

evaluates to TRUE twice.  That might be because SQLMoreResults
"succeeds" one extra time. 



The information contained in this transmission may be privileged and
confidential 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.  If you, as the intended recipient
of this message, the purpose of which is to inform and update our clients, prospects
and consultants of developments relating to our services and products, would not
like to receive further e-mail correspondence from the sender, please "reply" to the
sender indicating your wishes.  In the U.S.: 1345 Avenue of the Americas, New York,
NY 10105.

More information about the FreeTDS mailing list