| version 1.1, 2005/06/05 12:14:08 |
version 1.2, 2005/11/07 20:37:24 |
| Line 42 require_once 'PEAR.php'; |
|
| Line 42 require_once 'PEAR.php'; |
|
| * @author Daniel Convissor <danielc@php.net> |
* @author Daniel Convissor <danielc@php.net> |
| * @copyright 1997-2005 The PHP Group |
* @copyright 1997-2005 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.4 |
* @version Release: 1.7.6 |
| * @link http://pear.php.net/package/DB |
* @link http://pear.php.net/package/DB |
| */ |
*/ |
| class DB_common extends PEAR |
class DB_common extends PEAR |
| Line 479 class DB_common extends PEAR |
|
| Line 479 class DB_common extends PEAR |
|
| /** |
/** |
| * Sets the fetch mode that should be used by default for query results |
* Sets the fetch mode that should be used by default for query results |
| * |
* |
| * @param integer $fetchmode DB_FETCHMODE_ORDERED or DB_FETCHMODE_ASSOC, |
* @param integer $fetchmode DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC |
| * possibly bit-wise OR'ed with |
* or DB_FETCHMODE_OBJECT |
| * DB_FETCHMODE_FLIPPED |
|
| * |
|
| * @param string $object_class the class name of the object to be returned |
* @param string $object_class the class name of the object to be returned |
| * by the fetch methods when the |
* by the fetch methods when the |
| * DB_FETCHMODE_OBJECT mode is selected. |
* DB_FETCHMODE_OBJECT mode is selected. |
| Line 491 class DB_common extends PEAR |
|
| Line 489 class DB_common extends PEAR |
|
| * done. There is also the posibility to use |
* done. There is also the posibility to use |
| * and extend the 'DB_row' class. |
* and extend the 'DB_row' class. |
| * |
* |
| * @see DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_FLIPPED, |
* @see DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT |
| * DB_FETCHMODE_OBJECT |
|
| */ |
*/ |
| function setFetchMode($fetchmode, $object_class = 'stdClass') |
function setFetchMode($fetchmode, $object_class = 'stdClass') |
| { |
{ |
| Line 804 class DB_common extends PEAR |
|
| Line 801 class DB_common extends PEAR |
|
| $where = false) |
$where = false) |
| { |
{ |
| $query = $this->buildManipSQL($table, $table_fields, $mode, $where); |
$query = $this->buildManipSQL($table, $table_fields, $mode, $where); |
| |
if (DB::isError($query)) { |
| |
return $query; |
| |
} |
| return $this->prepare($query); |
return $this->prepare($query); |
| } |
} |
| |
|
| Line 834 class DB_common extends PEAR |
|
| Line 834 class DB_common extends PEAR |
|
| { |
{ |
| $sth = $this->autoPrepare($table, array_keys($fields_values), $mode, |
$sth = $this->autoPrepare($table, array_keys($fields_values), $mode, |
| $where); |
$where); |
| |
if (DB::isError($sth)) { |
| |
return $sth; |
| |
} |
| $ret =& $this->execute($sth, array_values($fields_values)); |
$ret =& $this->execute($sth, array_values($fields_values)); |
| $this->freePrepared($sth); |
$this->freePrepared($sth); |
| return $ret; |
return $ret; |
| Line 876 class DB_common extends PEAR |
|
| Line 879 class DB_common extends PEAR |
|
| function buildManipSQL($table, $table_fields, $mode, $where = false) |
function buildManipSQL($table, $table_fields, $mode, $where = false) |
| { |
{ |
| if (count($table_fields) == 0) { |
if (count($table_fields) == 0) { |
| $this->raiseError(DB_ERROR_NEED_MORE_DATA); |
return $this->raiseError(DB_ERROR_NEED_MORE_DATA); |
| } |
} |
| $first = true; |
$first = true; |
| switch ($mode) { |
switch ($mode) { |
| Line 910 class DB_common extends PEAR |
|
| Line 913 class DB_common extends PEAR |
|
| } |
} |
| return $sql; |
return $sql; |
| default: |
default: |
| $this->raiseError(DB_ERROR_SYNTAX); |
return $this->raiseError(DB_ERROR_SYNTAX); |
| } |
} |
| } |
} |
| |
|
| Line 1565 class DB_common extends PEAR |
|
| Line 1568 class DB_common extends PEAR |
|
| * placeholders in query: meaning 1 |
* placeholders in query: meaning 1 |
| * placeholder for non-array parameters or |
* placeholder for non-array parameters or |
| * 1 placeholder per array element. |
* 1 placeholder per array element. |
| * @param int $fetchmode the fetch mode to use |
* @param int $fetchmode the fetch mode to use: |
| |
* + DB_FETCHMODE_ORDERED |
| |
* + DB_FETCHMODE_ASSOC |
| |
* + DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED |
| |
* + DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED |
| * |
* |
| * @return array the nested array. A DB_Error object on failure. |
* @return array the nested array. A DB_Error object on failure. |
| */ |
*/ |