Re: cvs: php4 /pear/Cache DB.php
| From: | Sebastian Bergmann | Date: | Tue, 14 Aug 2001 16:17:01 +0000 |
| Subject: | Re: cvs: php4 /pear/Cache DB.php | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1480@lists.php.net to get a copy of this message | ||
Sebastian Bergmann wrote:
> sebastian Tue Aug 14 12:05:16 2001 EDT
>
> Added files:
> /php4/pear/Cache DB.php
> Log:
> Initial version of the PEAR DB Cache.
Some comments: Cache_DB->query() returns an Cache_DB_Result
object. I'm trying to make Cache_DB_Result as compatible with
DB_Result as much as possible, so they can be used
interchangebly. This won't work for special cases, for instance
when someone wants to use DB_Result->dbh for something, as it
can not be available in Cache_DB_Result for the obvious reasons.
Right now Cache_DB_Result->fetchRow() works, but only when it is
called with either DB_FETCHMODE_ASSOC or DB_FETCHMODE_ORDERED as
parameter. I have to figure out a way to access
DB_FETCHMODE_DEFAULT from within this method.
The following example already wors fine here:
<?php
require_once 'Cache/DB.php';
$db = new Cache_DB();
$db->connect('mysql://joshua@wopr-mobile.spacecom.af.mil/foo');
$result = $db->query('select * from bar');
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) { // ... }
?>
I'm open for feedback, especially for suggestions regarding what
should be done in Cache_DB_Result->free() and how to access the
default fetchmode setting from within fetchRow().
--
Sebastian Bergmann Measure Traffic & Usability
http://sebastian-bergmann.de/ http://phpOpenTracker.de/