http://www.perlmonks.org?node_id=1031459


in reply to Re: My MSSQL query fails the second time.
in thread My MSSQL query fails the second time.

Here's some delicious DBI_TRACE=3

ok 2 - The object isa DBI::st -> execute for DBD::Sybase::st (DBI::st=HASH(0x8bc9234)~0x8bc9284) + thr#897b008 syb_alloc_cmd() -> CS_COMMAND 8bcb778 for CS_CONNECTION 8b85e60 cmd_execute() -> ct_command() OK cmd_execute() -> ct_send() OK cmd_execute() -> set inUse flag st_next_result() -> ct_results(4040) == 1 ct_res_info() returns 1 columns STORE DBI::st=HASH(0x8bc9284) 'NUM_OF_FIELDS' => 1 ct_describe(0): type = 8, maxlen = 4 describe() -> col 0, type 8, realtype 8 describe() retcode = 1 st_next_result() -> lasterr = 0, lastsev = 0 <- execute= ( -1 ) [1 items] at t/dbi-bug-pm.t line 36 via at t/d +bi-bug-pm.t line 23 ok 3 - defined: '-1' -> finish for DBD::Sybase::st (DBI::st=HASH(0x8bc9234)~0x8bc9284) +thr#897b008 syb_st_finish() -> ct_cancel(CS_CANCEL_ALL) clear_sth_flags() -> resetting ACTIVE, moreResults, dyn_execed, ex +ec_done clear_sth_flags() -> reset inUse flag <- finish= ( 1 ) [1 items] at t/dbi-bug-pm.t line 42 via at t/dbi +-bug-pm.t line 23 ok 4 - $sth->finish -> prepare_cached in DBD::_::db for DBD::Sybase::db (DBI::db=HASH( +0x8b98148)~0x8b98094 'SELECT 1') thr#897b008 -> FETCH for DBD::Sybase::st (DBI::st=HASH(0x8bc9234)~0x8bc9284 'A +ctive') thr#897b008 .. FETCH DBI::st=HASH(0x8bc9284) 'Active' = '' <- FETCH= ( '' ) [1 items] at /usr/lib/perl5/DBI.pm line 1699 via + at t/dbi-bug-pm.t line 33 <- prepare_cached= ( DBI::st=HASH(0x8bc9234) ) [1 items] at t/dbi- +bug-pm.t line 33 via at t/dbi-bug-pm.t line 28 -> execute for DBD::Sybase::st (DBI::st=HASH(0x8bc9234)~0x8bc9284) + thr#897b008 cmd_execute() -> ct_command() OK cmd_execute() -> ct_send() failed <- execute= ( undef ) [1 items] at t/dbi-bug-pm.t line 36 via at +t/dbi-bug-pm.t line 28 not ok 6 - defined: '' # Failed test 'defined: ''' # at t/dbi-bug-pm.t line 39. -> finish for DBD::Sybase::st (DBI::st=HASH(0x8bc9234)~0x8bc9284) +thr#897b008 <- finish= ( 1 ) [1 items] at t/dbi-bug-pm.t line 42 via at t/dbi +-bug-pm.t line 28 ok 7 - $sth->finish

What stands out to me is cmd_execute() -> ct_send() failed, so I Googled ct_send. It says, among other things, that it fails if there are results pending. That sounds like my problem, but $sth->finish seems too simple to fail.

Anyway, that was fun, but I'm still stumped.

Replies are listed 'Best First'.
Re^3: My MSSQL query fails the second time.
by moritz (Cardinal) on May 01, 2013 at 04:59 UTC

      Yes. My original test did that, but I took it out to make my post more succinct.

Re^3: My MSSQL query fails the second time.
by mpeppler (Vicar) on May 05, 2013 at 13:09 UTC
    I ran the test against Sybase with the Sybase client libs, and this appeared to work as expected - so I would assume that you've hit some sort of bug in the FreeTDS client libs.

    Michael