本文整理汇总了PHP中MDB2::getCode方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB2::getCode方法的具体用法?PHP MDB2::getCode怎么用?PHP MDB2::getCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDB2
的用法示例。
在下文中一共展示了MDB2::getCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* The options are:
* - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL
* - dsn: the Data Source Name to connect to a database through PEAR::MDB2 {@link http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php}.
* The DSN must be provided as an associative array or as a string.
* The array format is preferred, since it doesn't require a further parsing step (see the {@link http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php Connecting
* chapter} for an example). The string format of the supplied DSN is in its fullest form:
* phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value
* Examples:
* $dsn = 'mysqli://themaster:thepowerofthepower@localhost/masterdb'
* $dsn = array(
* 'phptype' => 'mysqli',
* 'username' => 'themaster',
* 'password' => 'thepowerofthepower',
* 'hostspec' => 'localhost',
* 'database' => 'masterdb'
* );
* - mdb2_options: can contain runtime configuration settings for the MDB2 package (see the {@link http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php Connecting} for more details).
* - table: the name of the table where debug logs are stored.
*
* @param array $options
* @throws BadMethodCallException
* @throws exceptions
*/
public function __construct($options = null)
{
$this->_dsn = isset($options['dsn']) ? $options['dsn'] : DEBUG_DEFAULT_MYSQL_DSN;
$this->_table = isset($options['table']) ? $options['table'] : DEBUG_DEFAULT_MYSQL_TABLE;
$this->_mdb2_options = isset($options['mdb2_options']) ? $options['mdb2_options'] : array();
parent::__construct($options);
$this->_mdb2 =& MDB2::factory($this->_dsn, $this->_mdb2_options);
if (PEAR::isError($this->_mdb2)) {
throw new exceptions($this->_mdb2->getMessage(), $this->_mdb2->getCode());
}
}