本文整理匯總了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;
}