我正在使用DBI perl与Sybase数据服务器连接。我的流程执行以下全天循环运行的循环
Till end of day, do {
$sth = $dbh->prepare
execute query
someAnotherPerlFunction()
someAnotherPerlFunctionOne()
}
someAnotherPerlFunction()
{
$sth = $dbh->prepare (select)
execute query
}
someAnotherPerlFunctionOne()
{
my $sth = undef;
$sth = $dbh->prepare (update)
execute query;
undef $sth;
}
现在,由于这将全天运行,因此在资源清理方面我需要牢记一些事情。
目前,我正在执行undef $sth
每个函数,如someAnotherPerlFunctionOne中所示。那有必要吗?
Perl会为您清理,但是将db句柄传递给函数是一个好主意,而不是每次都重新创建它并立即销毁它。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句