| version 1.2, 2005/11/07 20:37:24 |
version 1.3, 2011/06/17 13:56:38 |
|
|
| * @package DB |
* @package DB |
| * @author Tomas V.V. Cox <cox@idecnet.com> |
* @author Tomas V.V. Cox <cox@idecnet.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 Tomas V.V. Cox <cox@idecnet.com> |
* @author Tomas V.V. Cox <cox@idecnet.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 |
| */ |
*/ |
| class DB_dbase extends DB_common |
class DB_dbase extends DB_common |
| Line 188 class DB_dbase extends DB_common |
|
| Line 188 class DB_dbase 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 214 class DB_dbase extends DB_common |
|
| Line 214 class DB_dbase extends DB_common |
|
| * Turn track_errors on for entire script since $php_errormsg |
* Turn track_errors on for entire script since $php_errormsg |
| * is the only way to find errors from the dbase extension. |
* is the only way to find errors from the dbase extension. |
| */ |
*/ |
| ini_set('track_errors', 1); |
@ini_set('track_errors', 1); |
| $php_errormsg = ''; |
$php_errormsg = ''; |
| |
|
| if (!file_exists($dsn['database'])) { |
if (!file_exists($dsn['database'])) { |
| Line 273 class DB_dbase extends DB_common |
|
| Line 273 class DB_dbase extends DB_common |
|
| { |
{ |
| // emulate result resources |
// emulate result resources |
| $this->res_row[(int)$this->result] = 0; |
$this->res_row[(int)$this->result] = 0; |
| $tmp =& new DB_result($this, $this->result++); |
$tmp = new DB_result($this, $this->result++); |
| return $tmp; |
return $tmp; |
| } |
} |
| |
|
| Line 326 class DB_dbase extends DB_common |
|
| Line 326 class DB_dbase extends DB_common |
|
| } |
} |
| |
|
| // }}} |
// }}} |
| |
// {{{ freeResult() |
| |
|
| |
/** |
| |
* Deletes the result set and frees the memory occupied by the result set. |
| |
* |
| |
* This method is a no-op for dbase, as there aren't result resources in |
| |
* the same sense as most other database backends. |
| |
* |
| |
* @param resource $result PHP's query result resource |
| |
* |
| |
* @return bool TRUE on success, FALSE if $result is invalid |
| |
* |
| |
* @see DB_result::free() |
| |
*/ |
| |
function freeResult($result) |
| |
{ |
| |
return true; |
| |
} |
| |
|
| |
// }}} |
| // {{{ numCols() |
// {{{ numCols() |
| |
|
| /** |
/** |
| Line 368 class DB_dbase extends DB_common |
|
| Line 388 class DB_dbase 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 = <samp>T</samp> if true or |
|
| * <samp>F</samp> if false. Use the <kbd>Logical</kbd> |
|
| * data type. |
|
| * + integer or double = the unquoted number |
|
| * + other (including strings and numeric strings) = |
|
| * the data with single quotes escaped by preceeding |
|
| * single quotes then the whole string is 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 ? 'T' : 'F'; |
| if (is_int($in) || is_double($in)) { |
|
| return $in; |
|
| } elseif (is_bool($in)) { |
|
| return $in ? 'T' : 'F'; |
|
| } elseif (is_null($in)) { |
|
| return 'NULL'; |
|
| } else { |
|
| return "'" . $this->escapeSimple($in) . "'"; |
|
| } |
|
| } |
} |
| |
|
| // }}} |
// }}} |
| // {{{ tableInfo() |
// {{{ tableInfo() |
| |
|