DBI:断开连接-问题 [英] DBI: disconnect - question
本文介绍了DBI:断开连接-问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您会将 disconnect
-代码的一部分称为线噪声还是直接保留?
Would you call parts of the disconnect
-code as line-noise or would you leave it as it is?
use DBI;
my $dbh = DBI->connect ...
...
...
END {
$dbh->disconnect or die $DBI::errstr if $dbh;
}
推荐答案
与数据库的显式断开是如果您在完成所有工作后退出程序,则没有严格的必要。但这是一个好主意,尤其是在您已执行多个连接或将要执行多个顺序连接的程序中。
Explicit disconnection from the database is not strictly necessary if you are exiting from your program after you have performed all the work. But it is a good idea, especially in programs in which you have performed multiple connections or will be carrying out multiple sequential connections.
请参见对Perl DBI进行编程了解更多信息。
这篇关于DBI:断开连接-问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文