* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.8.2
+ * @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB
*/
function apiVersion()
{
- return '1.8.2';
+ return '1.9.2';
}
// }}}
$parsed['dbsyntax'] = $str;
}
- if (!count($dsn)) {
+ if (!strlen($dsn)) {
return $parsed;
}
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.8.2
+ * @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_Error extends PEAR_Error
*
* @see PEAR_Error
*/
- function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
+ function __construct($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
$level = E_USER_NOTICE, $debuginfo = null)
{
- common_debug(var_export($debuginfo,true));
if (is_int($code)) {
- $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code,
+ parent::__construct('DB Error: ' . DB::errorMessage($code), $code,
$mode, $level, $debuginfo);
} else {
- $this->PEAR_Error("DB Error: $code", DB_ERROR,
+ parent::__construct("DB Error: $code", DB_ERROR,
$mode, $level, $debuginfo);
}
}
+ /**
+ * Workaround to both avoid the "Redefining already defined constructor"
+ * PHP error and provide backward compatibility in case someone is calling
+ * DB_Error() dynamically
+ */
+ public function __call($method, $arguments)
+ {
+ if ($method == 'DB_Error') {
+ return call_user_func_array(array($this, '__construct'), $arguments);
+ }
+ trigger_error(
+ 'Call to undefined method DB_Error::' . $method . '()', E_USER_ERROR
+ );
+ }
// }}}
}
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.8.2
+ * @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_result
*
* @return void
*/
- function DB_result(&$dbh, $result, $options = array())
+ function __construct(&$dbh, $result, $options = array())
{
$this->autofree = $dbh->options['autofree'];
$this->dbh = &$dbh;
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version Release: 1.8.2
+ * @version Release: 1.9.2
* @link http://pear.php.net/package/DB
* @see DB_common::setFetchMode()
*/
*
* @return void
*/
- function DB_row(&$arr)
+ function __construct(&$arr)
{
foreach ($arr as $key => $value) {
$this->$key = &$arr[$key];