本文整理汇总了PHP中ADODB_Pear_error函数的典型用法代码示例。如果您正苦于以下问题:PHP ADODB_Pear_error函数的具体用法?PHP ADODB_Pear_error怎么用?PHP ADODB_Pear_error使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ADODB_Pear_error函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _connect
/**
* Connect to database by using the given DSN string
*
* @access private
* @param string DSN string
* @return mixed Object on error, otherwise bool
*/
function _connect($dsn)
{
if (is_string($dsn) || is_array($dsn)) {
if (!$this->db) {
$this->db = ADONewConnection($dsn);
if ($err = ADODB_Pear_error()) {
return PEAR::raiseError($err);
}
}
} else {
return PEAR::raiseError('The given dsn was not valid in file ' . __FILE__ . ' at line ' . __LINE__, 41, PEAR_ERROR_RETURN, null, null);
}
if (!$this->db) {
return PEAR::raiseError(ADODB_Pear_error());
} else {
return true;
}
}
示例2: _connect
/**
* Connect to database by using the given DSN string
*
* @access private
* @param string DSN string
* @return mixed Object on error, otherwise bool
*/
function _connect($dsn)
{
if (is_string($dsn) || is_array($dsn)) {
if (!$this->db) {
$this->db =& ADONewConnection($this->options['db_type']);
if ($err = ADODB_Pear_error()) {
return PEAR::raiseError($err);
}
}
$dbconnected = $this->db->Connect($this->options['db_host'], $this->options['db_user'], $this->options['db_pass'], $this->options['db_name']);
if (!$dbconnected) {
PEAR::raiseError('Unable to connect to database');
}
} else {
return PEAR::raiseError('The given dsn was not valid in file ' . __FILE__ . ' at line ' . __LINE__, 41, PEAR_ERROR_RETURN, null, null);
}
if (!$this->db) {
return PEAR::raiseError(ADODB_Pear_error());
} else {
return true;
}
}