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: "Ridges, David" <David dot Ridges at citadelgroup dot com>
Subject: The call to "prepare" is also executing the statement (also under bug report 599)
Date: Jun 27 2005 12:51PM


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.