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 peppler at bnpparibas dot com
Subject: Re: The call to "prepare" is also executing the statement (also under bug report 599)
Date: Jun 27 2005 1:19PM

I'm working on fixing this.

Michael




Internet
David.Ridges@citadelgroup.com@peppler.org - 27/06/2005 14:51


Sent by:    owner-sybperl-l@peppler.org

To:    sybperl-l

cc:


Subject:    The call to "prepare" is also executing the statement (also
       under bug report 599)




I believe to have found a bug in the behavior of "prepare" in DBD::Sybase
1.05.

The act of preparing a statement that has no bound parameters is, in fact,
executing the statement as well.

A snippet from my test script follows:

...
DBI->trace(5);
my $dbh = DBI->connect($data_source, $username, $password);
my $st = $dbh->prepare('select * into tmp from some_table');
...

I stepped through the code in the debugger and found that immediately after
the
call to prepare, the trace log indicates: "cmd_execute() -> ct_command()
OK".
I confirmed that it does insert these rows into the database at the point
of
merely preparing the statement.

My understanding is that this statement should not execute until I
explictly
call "$st->execute()". Version 1.02 of the driver behaved as I expected
(i.e.
it did not execute until "execute" was called).

Have I found a bug or is this a misunderstanding of the api?

Many thanks for a great product.

Dave

==========
I thought this pasted snippet from my debug session may be helpful:

main::(testprepare.pl:52): my $st = $dbh->prepare('select * into tmp from
some_table');
DB<3> n
-> prepare for DBD::Sybase::db (DBI::db=HASH(0x8df1a68)~0x8e29a38 'select *
into tmp from some_table')
New DBI::st (for DBD::Sybase::st, parent=DBI::db=HASH(0x8e29a38), id=)
dbih_setup_handle(DBI::st=HASH(0x8e2a378)=>DBI::st=HASH(0x8d8b304),
DBD::Sybase::st, 8df8820, Null!)
dbih_make_com(DBI::db=HASH(0x8e29a38), 0x8e2a5d8, DBD::Sybase::st, 420,
(nil)) thr#(nil)
dbih_setup_attrib(DBI::st=HASH(0x8d8b304), Err, DBI::db=HASH(0x8e29a38))
SCALAR(0x81f50f4) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x8d8b304), State, DBI::db=HASH(0x8e29a38))
SCALAR(0x81f516c) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x8d8b304), Errstr, DBI::db=HASH(0x8e29a38))
SCALAR(0x81f5130) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x8d8b304), TraceLevel, DBI::db=HASH
(0x8e29a38)) 0 (already defined)
dbih_setup_attrib(DBI::st=HASH(0x8d8b304), FetchHashKeyName, DBI::db=HASH
(0x8e29a38)) 'NAME' (already defined)
dbih_setup_attrib(DBI::st=HASH(0x8d8b304), HandleSetErr, DBI::db=HASH
(0x8e29a38)) undef (not defined)
dbih_setup_attrib(DBI::st=HASH(0x8d8b304), HandleError, DBI::db=HASH
(0x8e29a38)) undef (not defined)
syb_st_prepare() -> inUse = 0
syb_alloc_cmd() -> CS_COMMAND 8e5e4b8 for CS_CONNECTION 8e2b098
cmd_execute() -> ct_command() OK
cmd_execute() -> ct_send() OK
cmd_execute() -> set inUse flag
syb_st_prepare() -> set inUse
<- prepare= DBI::st=HASH(0x8e2a378) at testprepare.pl line 52
main::(testprepare.pl:55): exit



-------------------------------------------------------------------------------------------------
-------------------------

CONFIDENTIALITY AND SECURITY NOTICE

This e-mail contains information that may be confidential and
proprietary. It is to be read and used solely by the intended recipient(s).
Citadel and its affiliates retain all proprietary rights they may have in
the
information. If you are not an intended recipient, please notify us
immediately either by reply e-mail or by telephone at 312-395-2100
and delete this e-mail (including any attachments hereto) immediately
without reading, disseminating, distributing or copying. We cannot give
any assurances that this e-mail and any attachments are free of viruses
and other harmful code. Citadel reserves the right to monitor, intercept
and block all communications involving its computer systems.












This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.