* @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';
}
// }}}
* @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)
{
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];
* @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_common extends PEAR
*
* @return void
*/
- function DB_common()
+ function __construct()
{
$this->PEAR('DB_Error');
}
* @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_dbase extends DB_common
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_dbase()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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
* @since Class functional since Release 1.7.0
*/
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_fbsql()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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
* @since Class became stable in Release 1.7.0
*/
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_ibase()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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_ifx extends DB_common
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_ifx()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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
* @since Class not functional until Release 1.7.0
*/
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_msql()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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_mssql extends DB_common
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_mssql()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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_mysql extends DB_common
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_mysql()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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
* @since Class functional since Release 1.6.3
*/
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_mysqli()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
*/
function freeResult($result)
{
- return is_resource($result) ? mysqli_free_result($result) : false;
+ if (! $result instanceof mysqli_result) {
+ return false;
+ }
+ mysqli_free_result($result);
+ return true;
}
// }}}
? $this->mysqli_types[$tmp->type]
: 'unknown',
// http://bugs.php.net/?id=36579
+ // Doc Bug #36579: mysqli_fetch_field length handling
+ // https://bugs.php.net/bug.php?id=62426
+ // Bug #62426: mysqli_fetch_field_direct returns incorrect
+ // length on UTF8 fields
'len' => $tmp->length,
'flags' => $flags,
);
* @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_oci8 extends DB_common
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_oci8()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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_odbc extends DB_common
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_odbc()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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_pgsql extends DB_common
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_pgsql()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @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 3.0
- * @version Release: 1.8.2
+ * @version Release: 1.9.2
* @link http://pear.php.net/package/DB
*/
class DB_sqlite extends DB_common
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_sqlite()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}
* @author Stig Bakken <stig@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_storage extends PEAR
* a reference to this object
*
*/
- function DB_storage($table, $keycolumn, &$dbh, $validator = null)
+ function __construct($table, $keycolumn, &$dbh, $validator = null)
{
$this->PEAR('DB_Error');
$this->_table = $table;
* @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_sybase extends DB_common
// {{{ constructor
/**
- * This constructor calls <kbd>$this->DB_common()</kbd>
+ * This constructor calls <kbd>parent::__construct()</kbd>
*
* @return void
*/
- function DB_sybase()
+ function __construct()
{
- $this->DB_common();
+ parent::__construct();
}
// }}}