| version 1.2, 2005/11/07 20:37:25 |
version 1.3, 2011/06/17 13:56:39 |
|
|
| * @category Database |
* @category Database |
| * @package DB |
* @package DB |
| * @author Daniel Convissor <danielc@php.net> |
* @author Daniel Convissor <danielc@php.net> |
| * @copyright 1997-2005 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$ |
* @version CVS: $Id$ |
| * @link http://pear.php.net/package/DB |
* @link http://pear.php.net/package/DB |
| Line 45 require_once 'DB/common.php'; |
|
| Line 45 require_once 'DB/common.php'; |
|
| * @category Database |
* @category Database |
| * @package DB |
* @package DB |
| * @author Daniel Convissor <danielc@php.net> |
* @author Daniel Convissor <danielc@php.net> |
| * @copyright 1997-2005 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.6 |
* @version Release: 1.7.14RC2 |
| * @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 |
| */ |
*/ |
| Line 153 class DB_msql extends DB_common |
|
| Line 153 class DB_msql extends DB_common |
|
| * '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()); |
| * } |
* } |
| Line 190 class DB_msql extends DB_common |
|
| Line 190 class DB_msql extends DB_common |
|
| $this->connection = @call_user_func_array($connect_function, |
$this->connection = @call_user_func_array($connect_function, |
| $params); |
$params); |
| } else { |
} else { |
| ini_set('track_errors', 1); |
@ini_set('track_errors', 1); |
| $this->connection = @call_user_func_array($connect_function, |
$this->connection = @call_user_func_array($connect_function, |
| $params); |
$params); |
| ini_set('track_errors', $ini); |
@ini_set('track_errors', $ini); |
| } |
} |
| |
|
| if (!$this->connection) { |
if (!$this->connection) { |
| Line 251 class DB_msql extends DB_common |
|
| Line 251 class DB_msql extends DB_common |
|
| } |
} |
| // Determine which queries that should return data, and which |
// Determine which queries that should return data, and which |
| // should return an error code only. |
// should return an error code only. |
| if (DB::isManip($query)) { |
if ($this->_checkManip($query)) { |
| $this->_result = $result; |
$this->_result = $result; |
| return DB_OK; |
return DB_OK; |
| } else { |
} else { |
| Line 350 class DB_msql extends DB_common |
|
| Line 350 class DB_msql extends DB_common |
|
| */ |
*/ |
| function freeResult($result) |
function freeResult($result) |
| { |
{ |
| return @msql_free_result($result); |
return is_resource($result) ? msql_free_result($result) : false; |
| } |
} |
| |
|
| // }}} |
// }}} |
| Line 443 class DB_msql extends DB_common |
|
| Line 443 class DB_msql extends DB_common |
|
| $repeat = false; |
$repeat = false; |
| do { |
do { |
| $this->pushErrorHandling(PEAR_ERROR_RETURN); |
$this->pushErrorHandling(PEAR_ERROR_RETURN); |
| $result =& $this->query("SELECT _seq FROM ${seqname}"); |
$result = $this->query("SELECT _seq FROM ${seqname}"); |
| $this->popErrorHandling(); |
$this->popErrorHandling(); |
| if ($ondemand && DB::isError($result) && |
if ($ondemand && DB::isError($result) && |
| $result->getCode() == DB_ERROR_NOSUCHTABLE) { |
$result->getCode() == DB_ERROR_NOSUCHTABLE) { |
| Line 531 class DB_msql extends DB_common |
|
| Line 531 class DB_msql extends DB_common |
|
| } |
} |
| |
|
| // }}} |
// }}} |
| |
// {{{ quoteFloat() |
| |
|
| |
/** |
| |
* Formats a float value for use within a query in a locale-independent |
| |
* manner. |
| |
* |
| |
* @param float the float value to be quoted. |
| |
* @return string the quoted string. |
| |
* @see DB_common::quoteSmart() |
| |
* @since Method available since release 1.7.8. |
| |
*/ |
| |
function quoteFloat($float) { |
| |
return $this->escapeSimple(str_replace(',', '.', strval(floatval($float)))); |
| |
} |
| |
|
| |
// }}} |
| // {{{ escapeSimple() |
// {{{ escapeSimple() |
| |
|
| /** |
/** |
| Line 598 class DB_msql extends DB_common |
|
| Line 614 class DB_msql extends DB_common |
|
| function errorCode($errormsg) |
function errorCode($errormsg) |
| { |
{ |
| static $error_regexps; |
static $error_regexps; |
| |
|
| |
// PHP 5.2+ prepends the function name to $php_errormsg, so we need |
| |
// this hack to work around it, per bug #9599. |
| |
$errormsg = preg_replace('/^msql[a-z_]+\(\): /', '', $errormsg); |
| |
|
| if (!isset($error_regexps)) { |
if (!isset($error_regexps)) { |
| $error_regexps = array( |
$error_regexps = array( |
| '/^Access to database denied/i' |
'/^Access to database denied/i' |