Can't write to DB using stored procedure

Bodo Schulze <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <9376.1242397750@mardochee>
Hi guys,

using FreeTDS v0.82 and DBD::Sybase v1.09 on a Linux box with Perl
v5.8.5 I'm executing a stored procedure that should create a new member
and return its ID.

But while DBD::Sybase throws no error, execute() invariably returns -1,
meaning that the number of rows affected is unknown.

My client confirms that there is no problem with the underlying stored
procedure (to which I have no access).

I tried several approachs (with positioned and with named params, with
and without placeholders), but the result is invariably that execute
returns -1.

Any ideas? Maybe the DBI trace below can help?

Warmest regards,

Bodo

<dbi.trace>
    DBI::db=HASH(0x975a288) trace level set to 0x0/15 (DBI @ 0x0/0) in DBI 1.53-ithread (pid 15315)
    -> prepare for DBD::Sybase::db (DBI::db=HASH(0x97449e0)~0x975a288 'EXEC RegisterNewMember ?,?,?,?,?,?,?,?,?,?,?,?,? ') thr#8db4008
    dbih_setup_handle(DBI::st=HASH(0x975b0d4)=>DBI::st=HASH(0x97ae190), DBD::Sybase::st, 975b0e0, Null!)
    dbih_make_com(DBI::db=HASH(0x975a288), 975b740, DBD::Sybase::st, 420, 0) thr#8db4008
    dbih_setup_attrib(DBI::st=HASH(0x97ae190), Err, DBI::db=HASH(0x975a288)) SCALAR(0x95f17f8) (already defined)
    dbih_setup_attrib(DBI::st=HASH(0x97ae190), State, DBI::db=HASH(0x975a288)) SCALAR(0x95f1858) (already defined)
    dbih_setup_attrib(DBI::st=HASH(0x97ae190), Errstr, DBI::db=HASH(0x975a288)) SCALAR(0x95f1828) (already defined)
    dbih_setup_attrib(DBI::st=HASH(0x97ae190), TraceLevel, DBI::db=HASH(0x975a288)) 15 (already defined)
    dbih_setup_attrib(DBI::st=HASH(0x97ae190), FetchHashKeyName, DBI::db=HASH(0x975a288)) 'NAME' (already defined)
    dbih_setup_attrib(DBI::st=HASH(0x97ae190), HandleSetErr, DBI::db=HASH(0x975a288)) undef (not defined)
    dbih_setup_attrib(DBI::st=HASH(0x97ae190), HandleError, DBI::db=HASH(0x975a288)) undef (not defined)
    syb_st_prepare() -> inUse = 0
    dbd_preparse parameter :p1 ()
    dbd_preparse parameter :p2 ()
    dbd_preparse parameter :p3 ()
    dbd_preparse parameter :p4 ()
    dbd_preparse parameter :p5 ()
    dbd_preparse parameter :p6 ()
    dbd_preparse parameter :p7 ()
    dbd_preparse parameter :p8 ()
    dbd_preparse parameter :p9 ()
    dbd_preparse parameter :p10 ()
    dbd_preparse parameter :p11 ()
    dbd_preparse parameter :p12 ()
    dbd_preparse parameter :p13 ()
    dbd_preparse scanned 13 distinct placeholders
    describe_proc: procname = RegisterNewMember
    syb_alloc_cmd() -> CS_COMMAND 98936d8 for CS_CONNECTION 975cb28
    syb_st_prepare() -> set inUse
    <- prepare= DBI::st=HASH(0x975b0d4) at /home/bodo/xxx/lib/Client/WebServices.pm line 156 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 1 '[email protected]' 12) thr#8db4008
bind :p1 <== '[email protected]' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 2 5 -6) thr#8db4008
bind :p2 <== '5' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 3 'myname3' 12) thr#8db4008
bind :p3 <== 'myname3' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 4 '2058-02-02' 9) thr#8db4008
bind :p4 <== '2058-02-02' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 5 'M' 12) thr#8db4008
bind :p5 <== 'M' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 6 'england' 12) thr#8db4008
bind :p6 <== 'england' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 7 12323 12) thr#8db4008
bind :p7 <== '12323' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 8 0 -6) thr#8db4008
bind :p8 <== '0' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 9 0 -6) thr#8db4008
bind :p9 <== '0' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 10 0 -6) thr#8db4008
bind :p10 <== '0' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 11 undef 12) thr#8db4008
bind :p11 <== '' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 12 undef 4) thr#8db4008
bind :p12 <== '' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 166 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> bind_param for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190 13 undef 4) thr#8db4008
bind :p13 <== '' (attribs: )
    <- bind_param= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 170 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> execute for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190) thr#8db4008
       bind :p1 () <== '[email protected]' (size 15/16/0, ptype 4, otype 0)
       bind :p1 <== '[email protected]' (size 15, ok 1)
       datafmt: type=0, name=, status=256, len=15
       saved type: 0
       bind :p2 () <== 5 (size 1/2/0, ptype 5, otype 0)
       bind :p2 <== '5' (size 1, ok 1)
       datafmt: type=0, name=, status=256, len=1
       saved type: 0
       bind :p3 () <== 'myname3' (size 7/8/0, ptype 4, otype 0)
       bind :p3 <== 'myname3' (size 7, ok 1)
       datafmt: type=0, name=, status=256, len=7
       saved type: 0
       bind :p4 () <== '2058-02-02' (size 10/11/0, ptype 4, otype 0)
       bind :p4 <== '2058-02-02' (size 10, ok 1)
       datafmt: type=0, name=, status=256, len=10
       saved type: 0
       bind :p5 () <== 'M' (size 1/2/0, ptype 4, otype 0)
       bind :p5 <== 'M' (size 1, ok 1)
       datafmt: type=0, name=, status=256, len=1
       saved type: 0
       bind :p6 () <== 'england' (size 7/8/0, ptype 4, otype 0)
       bind :p6 <== 'england' (size 7, ok 1)
       datafmt: type=0, name=, status=256, len=7
       saved type: 0
       bind :p7 () <== 12323 (size 5/6/0, ptype 5, otype 0)
       bind :p7 <== '12323' (size 5, ok 1)
       datafmt: type=0, name=, status=256, len=5
       saved type: 0
       bind :p8 () <== 0 (size 1/2/0, ptype 5, otype 0)
       bind :p8 <== '0' (size 1, ok 1)
       datafmt: type=0, name=, status=256, len=1
       saved type: 0
       bind :p9 () <== 0 (size 1/2/0, ptype 5, otype 0)
       bind :p9 <== '0' (size 1, ok 1)
       datafmt: type=0, name=, status=256, len=1
       saved type: 0
       bind :p10 () <== 0 (size 1/2/0, ptype 5, otype 0)
       bind :p10 <== '0' (size 1, ok 1)
       datafmt: type=0, name=, status=256, len=1
       saved type: 0
       bind :p11 () <== undef (NULL, ptype 4, otype 0)
       bind :p11 <== '(null)' (size -1, ok 0)
       datafmt: type=0, name=, status=256, len=0
       saved type: 0
       bind :p12 () <== undef (NULL, ptype 4, otype 8)
       bind :p12 <== '(null)' (size -1, ok 0)
       datafmt: type=8, name=, status=256, len=0
       saved type: 8
       bind :p13 () <== undef (NULL, ptype 0, otype 8)
       bind :p13 <== '(null)' (size -1, ok 0)
       datafmt: type=8, name=, status=256, len=0
       saved type: 8
    cmd_execute() -> ct_send() OK
    cmd_execute() -> set inUse flag
    st_next_result() -> ct_results(4043) == 1
    ct_res_info() returns 1 columns
    STORE DBI::st=HASH(0x97ae190) '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 at /home/bodo/xxx/lib/Client/WebServices.pm line 172 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 172
    -> fetchrow_array for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190) thr#8db4008
    dbih_setup_fbav for 1 fields => 0x97ae4b4
    syb_st_fetch() -> ct_fetch() = 1 (1 rows, 1 cols)
    syb_st_fetch() -> 0/4/8
    <- fetchrow_array= ( 0 ) [1 items] row1 at /home/bodo/xxx/lib/Client/WebServices.pm line 176 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> finish for DBD::Sybase::st (DBI::st=HASH(0x975b0d4)~0x97ae190) thr#8db4008
    syb_st_finish() -> ct_cancel(CS_CANCEL_ALL)
    clear_sth_flags() -> resetting ACTIVE, moreResults, dyn_execed, exec_done
    clear_sth_flags() -> reset inUse flag
    <- finish= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 187 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> DESTROY for DBD::Sybase::st (DBI::st=HASH(0x97ae190)~INNER) thr#8db4008
    syb_st_destroy: called on 98928e0...
    syb_st_destroy(): freeing imp_sth->statement
    ct_cmd_drop() -> CS_COMMAND 98936d8
    syb_st_destroy(): cmd dropped: 1
    <- DESTROY= undef at /home/bodo/xxx/lib/Client/WebServices.pm line 110 via  at /home/bodo/xxx/lib/Client/WebServices.pm line 110
    -> disconnect for DBD::Sybase::db (DBI::db=HASH(0x97449e0)~0x975a288) thr#8db4008
    syb_db_disconnect() -> ct_close()
    <- disconnect= 1 at /home/bodo/xxx/lib/Client/WebServices.pm line 33 via  at /home/bodo/xxx/cgi/json.pl line 0
!   -> DESTROY for DBD::Sybase::db (DBI::db=HASH(0x975a288)~INNER) thr#8db4008
!   <- DESTROY= undef during global destruction
</dbi.trace>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.