Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: michael dot x dot peppler at jpmchase dot com
Subject: RE: Is there a performance advantage to using placeholders with Sybase?
Date: Jan 8 2008 11:39AM

Full name is OpenClient Client Library, so yes, it's ctlib :-)

If I execute your code literally:

$ perl /tmp/
DBD::Sybase::st execute failed: Server message number=2812 severity=16 
state=5 line=2 server=TESTING text=Stored procedure 'my_stored_proc' not 
found. Specify owner.objectname or use sp_help to check whether the object 
exists (sp_help may produce lots of output)

And if I change "my_stored_proc" with "sp_help" I get:

$ perl /tmp/
DBD::Sybase::st execute failed: Server message number=17461 severity=16 
state=1 line=213 server=TESTING procedure=sp_help text=Object does not 
exist in this database. at /tmp/ line 6.

Using DBI->trace shows that it does an RPC call with parameters:

    -> prepare for DBD::Sybase::db (DBI::db=HASH(0x1019cac8)~0x1019ca68 
'exec sp_help ?') thr#10010250
    New 'DBI::st' (for DBD::Sybase::st, parent=DBI::db=HASH(0x1019ca68), 
DBD::Sybase::st, 10103ed8, Null!)
    dbih_make_com(DBI::db=HASH(0x1019ca68), 101a0140, DBD::Sybase::st, 
440, 0) thr#10010250
    syb_st_prepare() -> inUse = 0
    dbd_preparse parameter :p1 ()
    dbd_preparse scanned 1 distinct placeholders
    describe_proc: procname = sp_help
    syb_alloc_cmd() -> CS_COMMAND 1dff750 for CS_CONNECTION 104e570
    syb_st_prepare() -> set inUse
    <- prepare= DBI::st=HASH(0x1019cc9c) at /tmp/ line 5
    -> execute for DBD::Sybase::st (DBI::st=HASH(0x1019cc9c)~0x1019cc54 
'x') thr#10010250
bind :p1 <== 'x' (attribs: )
       bind :p1 () <== 'x' (size 1/4/0, ptype 4, otype 0)
       bind :p1 <== 'x' (size 3, ok 1)
       datafmt: type=0, name=, status=256, len=1
       saved type: 0
    cmd_execute() -> ct_send() OK


"Ed Avis"  
08.01.2008 12:20


RE: Is there a performance advantage to using placeholders with Sybase?

>OpenClient can do array binding, though I've never used it. 

OpenClient == ctlib?

>For execution of RPC (procs using placeholders) you must use 
>the form "exec procname ...".

Hmm, still no error is thrown:

    my $sth = $dbh->prepare('exec my_stored_proc ?');

>And lastly - if you are using FreeTDS then most of this 
>(placeholders, array binding, RPC execution) doesn't work 

Yes, I've noticed that it tends to segfault or otherwise misbehave if you 
try to prepare statement handles and stuff.  It's likely that the above is 
a bug in FreeTDS.  What happens if you run the above code using 
DBD::Sybase using Sybase's ctlib?

Ed Avis 

This email has been scanned by the MessageLabs Email Security System.
For more information please visit 

This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.

Please refer to for
disclosures relating to UK legal entities.