本文整理汇总了PHP中MDB2::raiseErrorStatic方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB2::raiseErrorStatic方法的具体用法?PHP MDB2::raiseErrorStatic怎么用?PHP MDB2::raiseErrorStatic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDB2
的用法示例。
在下文中一共展示了MDB2::raiseErrorStatic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: factory
/**
* Create a new MDB2 object for the specified database type
*
* IMPORTANT: In order for MDB2 to work properly it is necessary that
* you make sure that you work with a reference of the original
* object instead of a copy (this is a PHP4 quirk).
*
* For example:
* $db =& MDB2::factory($dsn);
* ^^
* And not:
* $db = MDB2::factory($dsn);
*
* @param mixed 'data source name', see the MDB2::parseDSN
* method for a description of the dsn format.
* Can also be specified as an array of the
* format returned by MDB2::parseDSN.
* @param array An associative array of option names and
* their values.
*
* @return mixed a newly created MDB2 object, or false on error
*
* @access public
*/
static function factory($dsn, $options = false)
{
$dsninfo = MDB2::parseDSN($dsn);
if (empty($dsninfo['phptype'])) {
$err = MDB2::raiseErrorStatic(MDB2_ERROR_NOT_FOUND, null, null, 'no RDBMS driver specified');
return $err;
}
$class_name = 'MDB2_Driver_' . $dsninfo['phptype'];
$debug = !empty($options['debug']);
$err = MDB2::loadClass($class_name, $debug);
if (PEAR::isError($err)) {
return $err;
}
$db = new $class_name();
$db->setDSN($dsninfo);
$err = MDB2::setOptions($db, $options);
if (PEAR::isError($err)) {
return $err;
}
return $db;
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:45,代码来源:owncloud_3rdparty_MDB2.php