本文整理汇总了PHP中Dal::_connection方法的典型用法代码示例。如果您正苦于以下问题:PHP Dal::_connection方法的具体用法?PHP Dal::_connection怎么用?PHP Dal::_connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dal
的用法示例。
在下文中一共展示了Dal::_connection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_connection
public static function get_connection()
{
if (!Dal::$_connection) {
global $peepagg_dsn;
Dal::$_connection = DB::connect($peepagg_dsn, array("autofree" => true));
if (Dal::$_connection instanceof PEAR_Error) {
$msg = Dal::$_connection->getMessage();
if (strpos($msg, "no such database") != -1) {
?>
<h1>Database not found</h1>
<p>Please check your <code>AppConfig.xml</code> file and ensure that the <code>$peepagg_dsn</code> variable is set and points to a valid database.</p>
<p>Currently, either the database doesn't exist, the user doesn't exist, or the password in <code>$peepagg_dsn</code> is incorrect.</p>
<?php
exit;
}
// otherwise we throw an exception
throw new PAException(DB_CONNECTION_FAILED, "Database connection failed");
}
// connection succeeded - turn off automatic committing
Dal::$_connection->autoCommit(FALSE);
}
return Dal::$_connection;
}