[freetds] Bug in Code ? (dbih_setup_fbav: invalid number of fields)

Daniel Schwager Daniel.Schwager at dtnet.de
Mon Dec 30 19:22:07 EST 2002


Hi,

i try to track down a problem with the MS-SQL-Server (MSDE) and
linux-perl. We wrote a application in perl running on linux
which connects to a MS-SQL-Server via 
        DBI -> DBD::Sybase --> FreeTDS.

The programm does a lot of queries to the SQL-Database
and update some columns.

The problem is, that our application terminates in 3 ways
(operating on the SAME-Database !!):
        a) normale and successfull (CASE 0)
        b) with an error like CASE 1 (see traceoutput DBI->trace(3) below)
        c) with an error like CASE 2 (see traceoutput DBI->trace(3) below)

Every case has got 3 sections:
	a) The console output is see running the application
	b) Trace output from the normal&successfuly run (*OK)
	c) Trace output from the failed run (*FAILED)

When running the programm, it terminats indeterminate in one of the 3 casese ...

I think, there's a bug in one of the components between our application
and the MS-SQL-Server.

Could somebody help me tracking down this problem ?

regards

Danny

*** Versionen
- FreeTDS-Version
  CVS-Snapshoot Mon 30.12.2002 16:04

        [danny at master ~/work/_office.sdi_report/sdi_report]$ ldd /usr/lib/perl5/site_perl/5.005/i586-linux/auto/DBD/Sybase/Sybase.so
                libct.so.0 => /usr/local/lib/libct.so.0 (0x40015000)
                libtds.so.1 => /usr/local/lib/libtds.so.1 (0x4003c000)
                libdl.so.2 => /lib/libdl.so.2 (0x4005c000)
                libm.so.6 => /lib/libm.so.6 (0x40060000)
                libc.so.6 => /lib/libc.so.6 (0x4007d000)
                libnsl.so.1 => /lib/libnsl.so.1 (0x40178000)
                /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
        ls -la 
                /usr/local/lib/libct.so.0 -> libct.so.0.0
                /usr/local/lib/libtds.so.1 -> libtds.so.1.1

        -rwxr-xr-x   1 root     root       463292 Dec 30 16:00 /usr/local/lib/libct.so.0.0
        -rwxr-xr-x   1 root     root       357318 Dec 30 16:00 /usr/local/lib/libtds.so.1.1

- DBD-Sybase-0.95
        (Sybase.pm,v 1.41 2002/10/23)

- DBI:   $DBI::VERSION = "1.32"

******** CASE 1
* stdout:
sql: select TASKKEY, RESOURCEKEY, SUM(ActualUnits) from distInfo  where PROJECTID = '02061301'  AND ActualUnits>0 group by TASKKEY, RESOURCEKEY
Out of memory!
Speicherzugriffsfehler

*FAILED:
1   -> prepare for DBD::Sybase::db (DBI::db=HASH(0x81a7528)~INNER 'select TASKKEY, RESOURCEKEY, SUM(ActualUnits) from distInfo  where PROJECTID = '02061301'  AND ActualUni
    New DBI::st (for DBD::Sybase::st, parent=DBI::db=HASH(0x81a7528), id=)
    dbih_setup_handle(DBI::st=HASH(0x843311c)=>DBI::st=HASH(0x8353cb0), DBD::Sybase::st, 8353bd8, Null!)
    dbih_make_com(DBI::db=HASH(0x81a7528), DBD::Sybase::st, 396) thr#(nil)
1   <- prepare= DBI::st=HASH(0x843311c) at DBI.pm line 1306 via sdi_control_sdi2ps8.pm line 194
    <- prepare_cached= DBI::st=HASH(0x843311c) at sdi_control_sdi2ps8.pm line 194 via ./sdi_control line 228
    -> execute for DBD::Sybase::st (DBI::st=HASH(0x843311c)~0x8353cb0)
    syb_st_execute() -> ct_command() OK
    syb_st_execute() -> ct_send() OK
    st_next_result() -> ct_results(4043) == 1
    ct_res_info() returns 15704 columns						### !!!! 15704 rows --> to much !!!!!
    ct_describe(0): type = 0, maxlen = 1075416008
    describe() -> col 0, type 1, realtype 0
    ct_describe(1): type = 0, maxlen = 1075416008


*OK:
1   -> prepare for DBD::Sybase::db (DBI::db=HASH(0x81a7528)~INNER 'select TASKKEY, RESOURCEKEY, SUM(ActualUnits) from distInfo  where PROJECTID = '02061301'  AND ActualUni
    New DBI::st (for DBD::Sybase::st, parent=DBI::db=HASH(0x81a7528), id=)
    dbih_setup_handle(DBI::st=HASH(0x843311c)=>DBI::st=HASH(0x8353cb0), DBD::Sybase::st, 8353bd8, Null!)
    dbih_make_com(DBI::db=HASH(0x81a7528), DBD::Sybase::st, 396) thr#(nil)
1   <- prepare= DBI::st=HASH(0x843311c) at DBI.pm line 1306 via sdi_control_sdi2ps8.pm line 194
    <- prepare_cached= DBI::st=HASH(0x843311c) at sdi_control_sdi2ps8.pm line 194 via ./sdi_control line 228
    -> execute for DBD::Sybase::st (DBI::st=HASH(0x843311c)~0x8353cb0)
    syb_st_execute() -> ct_command() OK
    syb_st_execute() -> ct_send() OK
    st_next_result() -> ct_results(4040) == 1
    ct_res_info() returns 3 columns
    ct_describe(0): type = 1, maxlen = 25
    describe() -> col 0, type 1, realtype 1
    ct_describe(1): type = 1, maxlen = 25
    describe() -> col 1, type 1, realtype 1
    ct_describe(2): type = 15, maxlen = 8
    describe() -> col 2, type 15, realtype 15


================================================================================
******** CASE 2
*stdout:
Query: select RemainingUnits from distInfo where PROJECTID = '02061301' AND TASKKEY = '96' AND RESOURCEKEY = 'dts' AND START1 = 'OCT 09 2002 12:00AM'
ct_res_info() returned 0 columns at /usr/lib/perl5/site_perl/5.005/i586-linux/DBI.pm line 1253.
dbih_setup_fbav: invalid number of fields: -29744, NUM_OF_FIELDS attribute probably not set right at /usr/lib/perl5/site_perl/5.005/i586-linux/DBI.pm line 1577.


*FAILED:
    -> selectall_arrayref for DBD::Sybase::db (DBI::db=HASH(0x834d8d8)~0x81a7528 'select RemainingUnits from distInfo where PROJECTID = '02061301' AND TASKKEY = '96' AND R
1   -> prepare for DBD::Sybase::db (DBI::db=HASH(0x81a7528)~INNER 'select RemainingUnits from distInfo where PROJECTID = '02061301' AND TASKKEY = '96' AND RESOURCEKEY = 'd
    New DBI::st (for DBD::Sybase::st, parent=DBI::db=HASH(0x81a7528), id=)
    dbih_setup_handle(DBI::st=HASH(0x843311c)=>DBI::st=HASH(0x843314c), DBD::Sybase::st, 834db90, Null!)
    dbih_make_com(DBI::db=HASH(0x81a7528), DBD::Sybase::st, 396) thr#(nil)
1   <- prepare= DBI::st=HASH(0x843311c) at DBI.pm line 1251 via sdi_control_sdi2ps8.pm line 152
    -> execute for DBD::Sybase::st (DBI::st=HASH(0x843311c)~0x843314c)
    syb_st_execute() -> ct_command() OK
    syb_st_execute() -> ct_send() OK
    st_next_result() -> ct_results(4043) == 1                                             ### Missing some lines (compared to *OK)
describe() retcode = 1
    st_next_result() -> lasterr = 0, lastsev = 0
    <- execute= -1 at DBI.pm line 1253 via sdi_control_sdi2ps8.pm line 152
    -> fetchall_arrayref for DBD::Sybase::st (DBI::st=HASH(0x843311c)~0x843314c undef undef (magic-sg:y))
1   -> fetch for DBD::Sybase::st (DBI::st=HASH(0x843314c)~INNER)
    <> DESTROY ignored for outer handle DBI::st=HASH(0x843311c) (inner DBI::st=HASH(0x843314c))
    -> DESTROY for DBD::Sybase::st (DBI::st=HASH(0x843314c)~INNER)
    syb_st_finish() -> ct_cancel(CS_CANCEL_ALL)
    syb_st_finish() -> resetting ACTIVE, moreResults, dyn_execed
    syb_st_destroy: called on 834dd10...
    syb_st_destroy(): freeing imp_sth->statement
    syb_st_destroy(): cmd dropped: 1
    <- DESTROY= undef
    -- DBI::END
    -> disconnect_all for DBD::mysql::dr (DBI::dr=HASH(0x8188770)~0x8313900)
    <- disconnect_all= '' at DBI.pm line 575 via ./sdi_control line 0
    -> disconnect_all for DBD::Sybase::dr (DBI::dr=HASH(0x8306748)~0x834d95c)
    <- disconnect_all= 1 at DBI.pm line 575 via ./sdi_control line 0
    <> DESTROY for DBI::dr=HASH(0x8306748) ignored (inner handle gone)
    -> DESTROY for DBD::mysql::db (DBI::db=HASH(0x83139f0)~INNER)
&imp_dbh->mysql: 83090c4
    <- DESTROY= undef during global destruction
    <> DESTROY ignored for outer handle DBI::db=HASH(0x834d8d8) (inner DBI::db=HASH(0x81a7528))
    -> DESTROY for DBD::Sybase::db (DBI::db=HASH(0x81a7528)~INNER)
    syb_db_disconnect() -> ct_close()
    <- DESTROY= undef during global destruction
    <> DESTROY for DBI::dr=HASH(0x8188770) ignored (inner handle gone)
    <> DESTROY for DBI::db=HASH(0x831396c) ignored (inner handle gone)

*OK:
    -> selectall_arrayref for DBD::Sybase::db (DBI::db=HASH(0x834d8d8)~0x81a7528 'select RemainingUnits from distInfo where PROJECTID = '02061301' AND TASKKEY = '96' AND R
1   -> prepare for DBD::Sybase::db (DBI::db=HASH(0x81a7528)~INNER 'select RemainingUnits from distInfo where PROJECTID = '02061301' AND TASKKEY = '96' AND RESOURCEKEY = 'd
    New DBI::st (for DBD::Sybase::st, parent=DBI::db=HASH(0x81a7528), id=)
    dbih_setup_handle(DBI::st=HASH(0x843311c)=>DBI::st=HASH(0x843314c), DBD::Sybase::st, 834db90, Null!)
    dbih_make_com(DBI::db=HASH(0x81a7528), DBD::Sybase::st, 396) thr#(nil)
1   <- prepare= DBI::st=HASH(0x843311c) at DBI.pm line 1251 via sdi_control_sdi2ps8.pm line 152
    -> execute for DBD::Sybase::st (DBI::st=HASH(0x843311c)~0x843314c)
    syb_st_execute() -> ct_command() OK
    syb_st_execute() -> ct_send() OK
    st_next_result() -> ct_results(4040) == 1
    ct_res_info() returns 1 columns
    ct_describe(0): type = 15, maxlen = 8
    describe() -> col 0, type 15, realtype 15
describe() retcode = 1
    st_next_result() -> lasterr = 0, lastsev = 0
    <- execute= -1 at DBI.pm line 1253 via sdi_control_sdi2ps8.pm line 152
    -> fetchall_arrayref for DBD::Sybase::st (DBI::st=HASH(0x843311c)~0x843314c undef undef (magic-sg:y))
1   -> fetch for DBD::Sybase::st (DBI::st=HASH(0x843314c)~INNER)
    dbih_setup_fbav for 1 fields => 0x84330f8
1   <- fetch= [ 0 ] row1 at DBI.pm line 1577 via ./sdi_control line 228
1   -> fetch for DBD::Sybase::st (DBI::st=HASH(0x843314c)~INNER)
    st_next_result() -> ct_results(4046) == 1
ct_results() final retcode = 15
    st_next_result() -> lasterr = 0, lastsev = 0
    syb_st_fetch() -> st_next_results() == 4046
    syb_st_fetch() -> resetting ACTIVE, moreResults, dyn_execed
1   <- fetch= undef row2 at DBI.pm line 1577 via ./sdi_control line 228
    <- fetchall_arrayref= [ ARRAY(0x8353bd8) ] row2 at DBI.pm line 1261 via sdi_control_sdi2ps8.pm line 152
    <- selectall_arrayref= [ ARRAY(0x8353bd8) ] at sdi_control_sdi2ps8.pm line 152 via ./sdi_control line 228
    <> DESTROY ignored for outer handle DBI::st=HASH(0x843311c) (inner DBI::st=HASH(0x843314c))
    -> DESTROY for DBD::Sybase::st (DBI::st=HASH(0x843314c)~INNER)
    syb_st_destroy: called on 834dd10...
    syb_st_destroy(): freeing imp_sth->statement
    syb_st_destroy(): cmd dropped: 1
    <- DESTROY= undef at sdi_control_sdi2ps8.pm line 153
    -> err for DBD::Sybase::db (DBI::db=HASH(0x834d8d8)~0x81a7528)
    <- err= undef at sdi_control_sdi2ps8.pm line 155 via ./sdi_control line 228
    -> do for DBD::Sybase::db (DBI::db=HASH(0x834d8d8)~0x81a7528 'update distInfo set OriginalUnits = '0', ActualUnits = '1.25' where PROJECTID = '02061301' AND TASKKEY = 
.....

-- 
------------------------------------------------------------
DT Netsolution GmbH -  Talaeckerstr. 30 -  D-70437 Stuttgart
Tel: +49-711-849910-32               Fax: +49-711-849910-932
WEB: http://www.dtnet.de/           email: schwager at dtnet.de



More information about the FreeTDS mailing list