本文整理汇总了PHP中MDB2_Schema::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB2_Schema::connect方法的具体用法?PHP MDB2_Schema::connect怎么用?PHP MDB2_Schema::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDB2_Schema
的用法示例。
在下文中一共展示了MDB2_Schema::connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Create a new MDB2 object for the specified database type
* type
*
* @param string|array|MDB2_Driver_Common &$db '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 @see MDB2::parseDSN.
* Finally you can also pass an existing db object to be used.
* @param array $options An associative array of option names and their values.
*
* @return bool|MDB2_Error MDB2_OK or error object
* @access public
* @see MDB2::parseDSN
*/
static function &factory(&$db, $options = array())
{
$obj = new MDB2_Schema();
$result = $obj->connect($db, $options);
if (PEAR::isError($result)) {
return $result;
}
return $obj;
}
示例2: array
/**
* Create a new MDB2 object for the specified database type
* type
*
* @param string|array|MDB2_Driver_Common 'data source name', see the
* @see MDB2::parseDSN method for a description of the dsn format.
* Can also be specified as an array of the
* format returned by @see MDB2::parseDSN.
* Finally you can also pass an existing db object to be used.
* @param array An associative array of option names and their values.
* @return bool|MDB2_Error MDB2_OK or error object
* @access public
* @see MDB2::parseDSN
*/
function &factory(&$db, $options = array())
{
$obj = new MDB2_Schema();
$err = $obj->connect($db, $options);
if (PEAR::isError($err)) {
return $err;
}
return $obj;
}