| version 1.2, 2005/11/07 20:37:24 |
version 1.3, 2011/06/17 13:56:38 |
|
|
| * @package DB |
* @package DB |
| * @author Frank M. Kromann <frank@frontbase.com> |
* @author Frank M. Kromann <frank@frontbase.com> |
| * @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 39 require_once 'DB/common.php'; |
|
| Line 39 require_once 'DB/common.php'; |
|
| * @package DB |
* @package DB |
| * @author Frank M. Kromann <frank@frontbase.com> |
* @author Frank M. Kromann <frank@frontbase.com> |
| * @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 functional since Release 1.7.0 |
* @since Class functional since Release 1.7.0 |
| */ |
*/ |
| Line 171 class DB_fbsql extends DB_common |
|
| Line 171 class DB_fbsql 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 229 class DB_fbsql extends DB_common |
|
| Line 229 class DB_fbsql 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)) { |
| return DB_OK; |
return DB_OK; |
| } |
} |
| return $result; |
return $result; |
| Line 320 class DB_fbsql extends DB_common |
|
| Line 320 class DB_fbsql extends DB_common |
|
| */ |
*/ |
| function freeResult($result) |
function freeResult($result) |
| { |
{ |
| return @fbsql_free_result($result); |
return is_resource($result) ? fbsql_free_result($result) : false; |
| } |
} |
| |
|
| // }}} |
// }}} |
| Line 353 class DB_fbsql extends DB_common |
|
| Line 353 class DB_fbsql extends DB_common |
|
| */ |
*/ |
| function commit() |
function commit() |
| { |
{ |
| @fbsql_commit(); |
@fbsql_commit($this->connection); |
| } |
} |
| |
|
| // }}} |
// }}} |
| Line 366 class DB_fbsql extends DB_common |
|
| Line 366 class DB_fbsql extends DB_common |
|
| */ |
*/ |
| function rollback() |
function rollback() |
| { |
{ |
| @fbsql_rollback(); |
@fbsql_rollback($this->connection); |
| } |
} |
| |
|
| // }}} |
// }}} |
| Line 431 class DB_fbsql extends DB_common |
|
| Line 431 class DB_fbsql extends DB_common |
|
| */ |
*/ |
| function affectedRows() |
function affectedRows() |
| { |
{ |
| if (DB::isManip($this->last_query)) { |
if ($this->_last_query_manip) { |
| $result = @fbsql_affected_rows($this->connection); |
$result = @fbsql_affected_rows($this->connection); |
| } else { |
} else { |
| $result = 0; |
$result = 0; |
| Line 543 class DB_fbsql extends DB_common |
|
| Line 543 class DB_fbsql extends DB_common |
|
| */ |
*/ |
| function modifyLimitQuery($query, $from, $count, $params = array()) |
function modifyLimitQuery($query, $from, $count, $params = array()) |
| { |
{ |
| if (DB::isManip($query)) { |
if (DB::isManip($query) || $this->_next_query_manip) { |
| return preg_replace('/^([\s(])*SELECT/i', |
return preg_replace('/^([\s(])*SELECT/i', |
| "\\1SELECT TOP($count)", $query); |
"\\1SELECT TOP($count)", $query); |
| } else { |
} else { |
| Line 553 class DB_fbsql extends DB_common |
|
| Line 553 class DB_fbsql extends DB_common |
|
| } |
} |
| |
|
| // }}} |
// }}} |
| // {{{ quoteSmart() |
// {{{ quoteBoolean() |
| |
|
| /** |
/** |
| * Formats input so it can be safely used in a query |
* Formats a boolean value for use within a query in a locale-independent |
| * |
* manner. |
| * @param mixed $in the data to be formatted |
|
| * |
|
| * @return mixed the formatted data. The format depends on the input's |
|
| * PHP type: |
|
| * + null = the string <samp>NULL</samp> |
|
| * + boolean = string <samp>TRUE</samp> or <samp>FALSE</samp> |
|
| * + integer or double = the unquoted number |
|
| * + other (including strings and numeric strings) = |
|
| * the data escaped according to FrontBase's settings |
|
| * then encapsulated between single quotes |
|
| * |
* |
| |
* @param boolean the boolean value to be quoted. |
| |
* @return string the quoted string. |
| * @see DB_common::quoteSmart() |
* @see DB_common::quoteSmart() |
| * @since Method available since Release 1.6.0 |
* @since Method available since release 1.7.8. |
| */ |
*/ |
| function quoteSmart($in) |
function quoteBoolean($boolean) { |
| { |
return $boolean ? 'TRUE' : 'FALSE'; |
| if (is_int($in) || is_double($in)) { |
|
| return $in; |
|
| } elseif (is_bool($in)) { |
|
| return $in ? 'TRUE' : 'FALSE'; |
|
| } elseif (is_null($in)) { |
|
| return 'NULL'; |
|
| } else { |
|
| return "'" . $this->escapeSimple($in) . "'"; |
|
| } |
|
| } |
} |
| |
|
| |
// }}} |
| |
// {{{ 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)))); |
| |
} |
| |
|
| // }}} |
// }}} |
| // {{{ fbsqlRaiseError() |
// {{{ fbsqlRaiseError() |
| |
|