cvs: php4 /pear/Cache DB.php

From: Date: Wed, 15 Aug 2001 07:51:33 +0000
Subject: cvs: php4 /pear/Cache DB.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-524@lists.php.net to get a copy of this message
sebastian Wed Aug 15 03:51:33 2001 EDT Modified files: /php4/pear/Cache DB.php Log: Stramlining a bit. Index: php4/pear/Cache/DB.php diff -u php4/pear/Cache/DB.php:1.6 php4/pear/Cache/DB.php:1.7 --- php4/pear/Cache/DB.php:1.6 Tue Aug 14 17:16:12 2001 +++ php4/pear/Cache/DB.php Wed Aug 15 03:51:33 2001 @@ -15,7 +15,7 @@ // | Authors: Sebastian Bergmann <sb@sebastian-bergmann.de> | // +----------------------------------------------------------------------+ // -// $Id: DB.php,v 1.6 2001/08/14 21:16:12 sebastian Exp $ +// $Id: DB.php,v 1.7 2001/08/15 07:51:33 sebastian Exp $ require_once 'Cache.php'; require_once 'DB.php'; @@ -27,7 +27,7 @@ * @module Cache_DB * @modulegroup Cache_DB * @package Cache -* @version $Revision: 1.6 $ +* @version $Revision: 1.7 $ * @access public */ class Cache_DB extends Cache { @@ -134,12 +134,11 @@ * Sets which fetch mode should be used by default on queries * on this connection. * - * @param integer DB_FETCHMODE_ORDERED or - * DB_FETCHMODE_ASSOC, possibly bit-wise OR'ed - * with DB_FETCHMODE_FLIPPED. + * @param integer DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT or + * DB_FETCHMODE_ORDERED * - * @param string The class of the object to be returned by the - * fetch methods when the DB_FETCHMODE_OBJECT + * @param string The class of the object to be returned by + * the fetch methods when the DB_FETCHMODE_OBJECT * mode is selected. */ function setFetchMode($fetchmode, $object_class = null) { @@ -227,7 +226,7 @@ * @module Cache_DB * @modulegroup Cache_DB * @package Cache -* @version $Revision: 1.6 $ +* @version $Revision: 1.7 $ * @access public */ class Cache_DB_Result { @@ -317,38 +316,38 @@ } if ($rownum < sizeof($this->rows)) { - $_row = $this->rows[$rownum]; + $row = $this->rows[$rownum]; } else { return false; } switch ($fetchmode) { case DB_FETCHMODE_ASSOC: { - $row =& $_row; + if (isset($return_object)) { + $class = $this->fetchmode_object_class; + $object =& new $class($row); + + return $object; + } else { + return $row; + } } break; case DB_FETCHMODE_ORDERED: { - $row = array(); + $_row = array(); foreach ($this->column_names as $column_name) { - $row[] = $_row[$column_name]; + $_row[] = $row[$column_name]; } + + return $_row; } break; default: { return false; } - } - - if (isset($return_object)) { - $class = $this->fetchmode_object_class; - $object =& new $class($row); - - return $object; - } else { - return $row; } }

« previous php.pear.cvs (#524) next »