PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
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/t.pl
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/t.pl
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/t.pl 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), 
id=undef)
    dbih_setup_handle(DBI::st=HASH(0x1019cc9c)=>DBI::st=HASH(0x1019cc54), 
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/t.pl 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

Michael




"Ed Avis"  
08.01.2008 12:20

To
, 
cc

Subject
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 ?');
    $sth->execute('x');

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

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 http://www.messagelabs.com/email 
______________________________________________________________________



-----------------------------------------
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 http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.