|
|
sybperl-l Archive
Up Prev Next
From: ye wei <yw at alabanza dot net>
Subject: How to implement Statement handle in CTlib?
Date: Apr 8 2000 12:55AM
Compare with DBI, I perfer Sybperl, because sybperl is much more
flexiable, but
I wonder if is there any way to implement a statement handle or have
more than 1 database
handles in a script but only keep 1 database connection in CTLib?
May script works as follows: When $X is used in a loop, it may be
needed by another function at the same time.
sub foo {
$X=Sybase::CTlib->ct_connect(...);
$X->ct_execute("select * from table");
while(($rc=$X->ct_result($restype) == CS_SUCCEED) {
...
while(@dat=$X->ct_fetch) { # loop here
### bar() will use $X to query sybase.
bar();
}
}
}
sub bar {
###########################################
# if $X is used, it will mess up foo()
###########################################
$X->ct_execute("..."); ####### Problem here !!!
}
So, I wonder is there any way to implement something like
DB_Handle/Statment_Handle (DBI conception) in CTLib?
I spent some time to study DBD::Sybase, it seems that ct_dynamic() is
used for allocate a statement handle.
But ct_cynamic() is not supported in CTLib.
Is there another way to do that, or do you have any good suggestion on
this issue?
Any help is very appericiated!!!
--
Sincerely,
Ye wei
|