DB updated to 1.8.2

This commit is contained in:
Mikael Nordfeldth 2015-02-12 22:00:50 +01:00
parent 35a9c65e4a
commit 10f2cde0b1
16 changed files with 103 additions and 112 deletions

View File

@ -5,7 +5,7 @@
/** /**
* Database independent query interface * Database independent query interface
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: DB.php,v 1.88 2007/08/12 05:27:25 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -426,12 +426,12 @@ define('DB_PORTABILITY_ALL', 63);
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.13 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB class DB
{ {
// {{{ &factory() // {{{ factory()
/** /**
* Create a new DB object for the specified database type but don't * Create a new DB object for the specified database type but don't
@ -444,7 +444,7 @@ class DB
* *
* @see DB_common::setOption() * @see DB_common::setOption()
*/ */
function &factory($type, $options = false) public static function factory($type, $options = false)
{ {
if (!is_array($options)) { if (!is_array($options)) {
$options = array('persistent' => $options); $options = array('persistent' => $options);
@ -480,7 +480,7 @@ class DB
} }
// }}} // }}}
// {{{ &connect() // {{{ connect()
/** /**
* Create a new DB object including a connection to the specified database * Create a new DB object including a connection to the specified database
@ -495,7 +495,7 @@ class DB
* 'portability' => DB_PORTABILITY_ALL, * 'portability' => DB_PORTABILITY_ALL,
* ); * );
* *
* $db =& DB::connect($dsn, $options); * $db = DB::connect($dsn, $options);
* if (PEAR::isError($db)) { * if (PEAR::isError($db)) {
* die($db->getMessage()); * die($db->getMessage());
* } * }
@ -515,7 +515,7 @@ class DB
* *
* @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError() * @uses DB::parseDSN(), DB_common::setOption(), PEAR::isError()
*/ */
function &connect($dsn, $options = array()) public static function connect($dsn, $options = array())
{ {
$dsninfo = DB::parseDSN($dsn); $dsninfo = DB::parseDSN($dsn);
$type = $dsninfo['phptype']; $type = $dsninfo['phptype'];
@ -539,7 +539,8 @@ class DB
if (!class_exists($classname)) { if (!class_exists($classname)) {
$tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null, $tmp = PEAR::raiseError(null, DB_ERROR_NOT_FOUND, null, null,
"Unable to include the DB/{$type}.php" "Unable to include the DB/{$type}.php"
. " file for '$dsn'", . " file for '"
. DB::getDSNString($dsn, true) . "'",
'DB_Error', true); 'DB_Error', true);
return $tmp; return $tmp;
} }
@ -576,7 +577,7 @@ class DB
*/ */
function apiVersion() function apiVersion()
{ {
return '1.7.13'; return '1.8.2';
} }
// }}} // }}}
@ -589,9 +590,9 @@ class DB
* *
* @return bool whether $value is DB_Error object * @return bool whether $value is DB_Error object
*/ */
function isError($value) public static function isError($value)
{ {
return is_a($value, 'DB_Error'); return is_object($value) && is_a($value, 'DB_Error');
} }
// }}} // }}}
@ -604,7 +605,7 @@ class DB
* *
* @return bool whether $value is a DB_<driver> object * @return bool whether $value is a DB_<driver> object
*/ */
function isConnection($value) public static function isConnection($value)
{ {
return (is_object($value) && return (is_object($value) &&
is_subclass_of($value, 'db_common') && is_subclass_of($value, 'db_common') &&
@ -625,7 +626,7 @@ class DB
* *
* @return boolean whether $query is a data manipulation query * @return boolean whether $query is a data manipulation query
*/ */
function isManip($query) public static function isManip($query)
{ {
$manips = 'INSERT|UPDATE|DELETE|REPLACE|' $manips = 'INSERT|UPDATE|DELETE|REPLACE|'
. 'CREATE|DROP|' . 'CREATE|DROP|'
@ -649,7 +650,7 @@ class DB
* @return string the error message or false if the error code was * @return string the error message or false if the error code was
* not recognized * not recognized
*/ */
function errorMessage($value) public static function errorMessage($value)
{ {
static $errorMessages; static $errorMessages;
if (!isset($errorMessages)) { if (!isset($errorMessages)) {
@ -730,7 +731,7 @@ class DB
* + username: User name for login * + username: User name for login
* + password: Password for login * + password: Password for login
*/ */
function parseDSN($dsn) public static function parseDSN($dsn)
{ {
$parsed = array( $parsed = array(
'phptype' => false, 'phptype' => false,
@ -859,7 +860,7 @@ class DB
* @param boolean true to hide the password, false to include it * @param boolean true to hide the password, false to include it
* @return string * @return string
*/ */
function getDSNString($dsn, $hidePassword) { public static function getDSNString($dsn, $hidePassword) {
/* Calling parseDSN will ensure that we have all the array elements /* Calling parseDSN will ensure that we have all the array elements
* defined, and means that we deal with strings and array in the same * defined, and means that we deal with strings and array in the same
* manner. */ * manner. */
@ -940,7 +941,7 @@ class DB
* @author Stig Bakken <ssb@php.net> * @author Stig Bakken <ssb@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.13 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_Error extends PEAR_Error class DB_Error extends PEAR_Error
@ -987,7 +988,7 @@ class DB_Error extends PEAR_Error
* @author Stig Bakken <ssb@php.net> * @author Stig Bakken <ssb@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.13 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_result class DB_result
@ -1452,7 +1453,7 @@ class DB_result
* @author Stig Bakken <ssb@php.net> * @author Stig Bakken <ssb@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.13 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
* @see DB_common::setFetchMode() * @see DB_common::setFetchMode()
*/ */

View File

@ -5,7 +5,7 @@
/** /**
* Contains the DB_common base class * Contains the DB_common base class
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: common.php,v 1.144 2007/11/26 22:54:03 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -42,7 +42,7 @@ require_once 'PEAR.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_common extends PEAR class DB_common extends PEAR
@ -204,7 +204,7 @@ class DB_common extends PEAR
function __wakeup() function __wakeup()
{ {
if ($this->was_connected) { if ($this->was_connected) {
$this->connect($this->dsn, $this->options); $this->connect($this->dsn, $this->options['persistent']);
} }
} }
@ -261,7 +261,7 @@ class DB_common extends PEAR
*/ */
function quoteString($string) function quoteString($string)
{ {
$string = $this->quote($string); $string = $this->quoteSmart($string);
if ($string{0} == "'") { if ($string{0} == "'") {
return substr($string, 1, -1); return substr($string, 1, -1);
} }
@ -284,8 +284,7 @@ class DB_common extends PEAR
*/ */
function quote($string = null) function quote($string = null)
{ {
return ($string === null) ? 'NULL' return $this->quoteSmart($string);
: "'" . str_replace("'", "''", $string) . "'";
} }
// }}} // }}}
@ -1249,7 +1248,7 @@ class DB_common extends PEAR
return $query; return $query;
} }
$result = $this->query($query, $params); $result = $this->query($query, $params);
if (is_a($result, 'DB_result')) { if (is_object($result) && is_a($result, 'DB_result')) {
$result->setOption('limit_from', $from); $result->setOption('limit_from', $from);
$result->setOption('limit_count', $count); $result->setOption('limit_count', $count);
} }

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's dbase extension * The PEAR DB driver for PHP's dbase extension
* for interacting with dBase databases * for interacting with dBase databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: dbase.php,v 1.45 2007/09/21 13:40:41 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -41,7 +41,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_dbase extends DB_common class DB_dbase extends DB_common

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's fbsql extension * The PEAR DB driver for PHP's fbsql extension
* for interacting with FrontBase databases * for interacting with FrontBase databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: fbsql.php,v 1.88 2007/07/06 05:19:21 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -41,7 +41,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
* @since Class functional since Release 1.7.0 * @since Class functional since Release 1.7.0
*/ */

View File

@ -9,7 +9,7 @@
* While this class works with PHP 4, PHP's InterBase extension is * While this class works with PHP 4, PHP's InterBase extension is
* unstable in PHP 4. Use PHP 5. * unstable in PHP 4. Use PHP 5.
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -23,7 +23,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: ibase.php,v 1.116 2007/09/21 13:40:41 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -49,7 +49,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
* @since Class became stable in Release 1.7.0 * @since Class became stable in Release 1.7.0
*/ */
@ -916,6 +916,8 @@ class DB_ibase extends DB_common
$error_regexps = array( $error_regexps = array(
'/generator .* is not defined/' '/generator .* is not defined/'
=> DB_ERROR_SYNTAX, // for compat. w ibase_errcode() => DB_ERROR_SYNTAX, // for compat. w ibase_errcode()
'/violation of [\w ]+ constraint/i'
=> DB_ERROR_CONSTRAINT,
'/table.*(not exist|not found|unknown)/i' '/table.*(not exist|not found|unknown)/i'
=> DB_ERROR_NOSUCHTABLE, => DB_ERROR_NOSUCHTABLE,
'/table .* already exists/i' '/table .* already exists/i'
@ -926,8 +928,6 @@ class DB_ibase extends DB_common
=> DB_ERROR_NOT_FOUND, => DB_ERROR_NOT_FOUND,
'/validation error for column .* value "\*\*\* null/i' '/validation error for column .* value "\*\*\* null/i'
=> DB_ERROR_CONSTRAINT_NOT_NULL, => DB_ERROR_CONSTRAINT_NOT_NULL,
'/violation of [\w ]+ constraint/i'
=> DB_ERROR_CONSTRAINT,
'/conversion error from string/i' '/conversion error from string/i'
=> DB_ERROR_INVALID_NUMBER, => DB_ERROR_INVALID_NUMBER,
'/no permission for/i' '/no permission for/i'

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's ifx extension * The PEAR DB driver for PHP's ifx extension
* for interacting with Informix databases * for interacting with Informix databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: ifx.php,v 1.75 2007/07/06 05:19:21 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -48,7 +48,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_ifx extends DB_common class DB_ifx extends DB_common
@ -536,7 +536,7 @@ class DB_ifx extends DB_common
*/ */
function errorCode($nativecode) function errorCode($nativecode)
{ {
if (ereg('SQLCODE=(.*)]', $nativecode, $match)) { if (preg_match('/SQLCODE=(.*)]/', $nativecode, $match)) {
$code = $match[1]; $code = $match[1];
if (isset($this->errorcode_map[$code])) { if (isset($this->errorcode_map[$code])) {
return $this->errorcode_map[$code]; return $this->errorcode_map[$code];

View File

@ -10,7 +10,7 @@
* 4.3.11 and 5.0.4. Make sure your version of PHP meets or exceeds * 4.3.11 and 5.0.4. Make sure your version of PHP meets or exceeds
* those versions. * those versions.
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -23,7 +23,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: msql.php,v 1.64 2007/09/21 13:40:41 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -47,7 +47,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
* @since Class not functional until Release 1.7.0 * @since Class not functional until Release 1.7.0
*/ */

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's mssql extension * The PEAR DB driver for PHP's mssql extension
* for interacting with Microsoft SQL Server databases * for interacting with Microsoft SQL Server databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: mssql.php,v 1.92 2007/09/21 13:40:41 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -49,7 +49,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_mssql extends DB_common class DB_mssql extends DB_common
@ -623,6 +623,27 @@ class DB_mssql extends DB_common
return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name)); return $this->query('DROP TABLE ' . $this->getSequenceName($seq_name));
} }
// }}}
// {{{ escapeSimple()
/**
* Escapes a string in a manner suitable for SQL Server.
*
* @param string $str the string to be escaped
* @return string the escaped string
*
* @see DB_common::quoteSmart()
* @since Method available since Release 1.6.0
*/
function escapeSimple($str)
{
return str_replace(
array("'", "\\\r\n", "\\\n"),
array("''", "\\\\\r\n\r\n", "\\\\\n\n"),
$str
);
}
// }}} // }}}
// {{{ quoteIdentifier() // {{{ quoteIdentifier()

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's mysql extension * The PEAR DB driver for PHP's mysql extension
* for interacting with MySQL databases * for interacting with MySQL databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: mysql.php,v 1.126 2007/09/21 13:32:52 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -41,7 +41,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_mysql extends DB_common class DB_mysql extends DB_common
@ -772,17 +772,6 @@ class DB_mysql extends DB_common
return '`' . str_replace('`', '``', $str) . '`'; return '`' . str_replace('`', '``', $str) . '`';
} }
// }}}
// {{{ quote()
/**
* @deprecated Deprecated in release 1.6.0
*/
function quote($str)
{
return $this->quoteSmart($str);
}
// }}} // }}}
// {{{ escapeSimple() // {{{ escapeSimple()

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's mysqli extension * The PEAR DB driver for PHP's mysqli extension
* for interacting with MySQL databases * for interacting with MySQL databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -19,7 +19,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: mysqli.php,v 1.82 2007/09/21 13:40:41 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -43,7 +43,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
* @since Class functional since Release 1.6.3 * @since Class functional since Release 1.6.3
*/ */
@ -993,7 +993,7 @@ class DB_mysqli extends DB_common
$got_string = false; $got_string = false;
} }
if (!is_a($id, 'mysqli_result')) { if (!is_object($id) || !is_a($id, 'mysqli_result')) {
return $this->mysqliRaiseError(DB_ERROR_NEED_MORE_DATA); return $this->mysqliRaiseError(DB_ERROR_NEED_MORE_DATA);
} }

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's oci8 extension * The PEAR DB driver for PHP's oci8 extension
* for interacting with Oracle databases * for interacting with Oracle databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: oci8.php,v 1.116 2007/11/28 02:22:39 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -47,7 +47,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_oci8 extends DB_common class DB_oci8 extends DB_common
@ -452,6 +452,7 @@ class DB_oci8 extends DB_common
if (isset($this->prepare_types[(int)$stmt])) { if (isset($this->prepare_types[(int)$stmt])) {
unset($this->prepare_types[(int)$stmt]); unset($this->prepare_types[(int)$stmt]);
unset($this->manip_query[(int)$stmt]); unset($this->manip_query[(int)$stmt]);
unset($this->_prepared_queries[(int)$stmt]);
} else { } else {
return false; return false;
} }
@ -670,7 +671,8 @@ class DB_oci8 extends DB_common
$tmp = $this->oci8RaiseError($stmt); $tmp = $this->oci8RaiseError($stmt);
return $tmp; return $tmp;
} }
$this->last_query = preg_replace("/:bind$i/",$this->quoteSmart($data[$key]),$this->last_query,1); $this->last_query = preg_replace("/:bind$i(?!\d)/",
$this->quoteSmart($data[$key]), $this->last_query, 1);
$i++; $i++;
} }
if ($this->autocommit) { if ($this->autocommit) {

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's odbc extension * The PEAR DB driver for PHP's odbc extension
* for interacting with databases via ODBC connections * for interacting with databases via ODBC connections
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -20,7 +20,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: odbc.php,v 1.81 2007/07/06 05:19:21 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -44,7 +44,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_odbc extends DB_common class DB_odbc extends DB_common
@ -480,18 +480,6 @@ class DB_odbc extends DB_common
} }
} }
// }}}
// {{{ quote()
/**
* @deprecated Deprecated in release 1.6.0
* @internal
*/
function quote($str)
{
return $this->quoteSmart($str);
}
// }}} // }}}
// {{{ nextId() // {{{ nextId()

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's pgsql extension * The PEAR DB driver for PHP's pgsql extension
* for interacting with PostgreSQL databases * for interacting with PostgreSQL databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -21,7 +21,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: pgsql.php,v 1.139 2007/11/28 02:19:44 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -43,7 +43,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_pgsql extends DB_common class DB_pgsql extends DB_common
@ -348,12 +348,12 @@ class DB_pgsql extends DB_common
* CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH, * CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,
* GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET, * GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET,
* REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW, * REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW,
* UNLISTEN, UPDATE, VACUUM * UNLISTEN, UPDATE, VACUUM, WITH
*/ */
if ($ismanip) { if ($ismanip) {
$this->affected = @pg_affected_rows($result); $this->affected = @pg_affected_rows($result);
return DB_OK; return DB_OK;
} elseif (preg_match('/^\s*\(*\s*(SELECT|EXPLAIN|FETCH|SHOW)\s/si', } elseif (preg_match('/^\s*\(*\s*(SELECT|EXPLAIN|FETCH|SHOW|WITH)\s/si',
$query)) $query))
{ {
$this->row[(int)$result] = 0; // reset the row counter. $this->row[(int)$result] = 0; // reset the row counter.
@ -465,18 +465,6 @@ class DB_pgsql extends DB_common
return false; return false;
} }
// }}}
// {{{ quote()
/**
* @deprecated Deprecated in release 1.6.0
* @internal
*/
function quote($str)
{
return $this->quoteSmart($str);
}
// }}} // }}}
// {{{ quoteBoolean() // {{{ quoteBoolean()

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's sqlite extension * The PEAR DB driver for PHP's sqlite extension
* for interacting with SQLite databases * for interacting with SQLite databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -21,7 +21,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0
* @version CVS: $Id: sqlite.php,v 1.118 2007/11/26 22:57:18 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -47,7 +47,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_sqlite extends DB_common class DB_sqlite extends DB_common
@ -829,6 +829,9 @@ class DB_sqlite extends DB_common
$flags = ''; $flags = '';
if ($id[$i]['pk']) { if ($id[$i]['pk']) {
$flags .= 'primary_key '; $flags .= 'primary_key ';
if (strtoupper($type) == 'INTEGER') {
$flags .= 'auto_increment ';
}
} }
if ($id[$i]['notnull']) { if ($id[$i]['notnull']) {
$flags .= 'not_null '; $flags .= 'not_null ';

View File

@ -5,7 +5,7 @@
/** /**
* Provides an object interface to a table row * Provides an object interface to a table row
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -18,7 +18,7 @@
* @author Stig Bakken <stig@php.net> * @author Stig Bakken <stig@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: storage.php,v 1.24 2007/08/12 05:27:25 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -38,7 +38,7 @@ require_once 'DB.php';
* @author Stig Bakken <stig@php.net> * @author Stig Bakken <stig@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_storage extends PEAR class DB_storage extends PEAR

View File

@ -6,7 +6,7 @@
* The PEAR DB driver for PHP's sybase extension * The PEAR DB driver for PHP's sybase extension
* for interacting with Sybase databases * for interacting with Sybase databases
* *
* PHP versions 4 and 5 * PHP version 5
* *
* LICENSE: This source file is subject to version 3.0 of the PHP license * LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI: * that is available through the world-wide-web at the following URI:
@ -21,7 +21,7 @@
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: sybase.php,v 1.87 2007/09/21 13:40:42 aharvey Exp $ * @version CVS: $Id$
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
@ -46,7 +46,7 @@ require_once 'DB/common.php';
* @author Daniel Convissor <danielc@php.net> * @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2007 The PHP Group * @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0 * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.7.14RC1 * @version Release: 1.8.2
* @link http://pear.php.net/package/DB * @link http://pear.php.net/package/DB
*/ */
class DB_sybase extends DB_common class DB_sybase extends DB_common