Home » Open Source » Programming Interfaces » Perl DBI : prepare function
Perl DBI : prepare function [message #34411] Fri, 10 December 2004 00:51
Messages: 98
Registered: November 2003
<A name=pgfId=1030540>[/url]$sth = $dbh->prepare("SELECT truc, machin FROM table WHERE bidule=?");

$sth->execute( $bidule );

while ( @ligne = $sth->fetchrow_array ) {print "@lignen";}

Hello, I've a  DBI-perl-program  with 4 distinct sql requests.

Always the same are called many time in each loop.

Do you think it's a good idea to create many $sth, like this

$sth1 = $dbh->prepare("SELECT truc, machin FROM table1 WHERE bidule=?");

$sth2 = $dbh->prepare("SELECT truc, machin FROM table2 WHERE bidule=?");

$sth3 = $dbh->prepare("SELECT truc, machin FROM table WHERE bidule=?");

and called them when it's necessary.  That mean the object will stay open

during long long time, and I won't destroy $sth1 before using $sth2

Does it affects the Oracle Database to keep during few hours this kind of objects

Thank you.

Previous Topic: OCI and SESSIONS ORACLE
Next Topic: Connect PHP to Oracle9i
Goto Forum:

Current Time: Sat Apr 30 10:22:15 CDT 2016

Total time taken to generate the page: 0.14609 seconds