cvs: php4 /pear/DB common.php

From: Date: Fri, 03 Aug 2001 14:17:33 +0000
Subject: cvs: php4 /pear/DB common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-414@lists.php.net to get a copy of this message
cox Fri Aug 3 10:17:33 2001 EDT Modified files: /php4/pear/DB common.php Log: setFetchmode now accepts a second optional param with the class type of the row object returned by the DB_FETCHMODE_OBJECT fetchmode. With that people can easily extend the functionality of a row object. Index: php4/pear/DB/common.php diff -u php4/pear/DB/common.php:1.56 php4/pear/DB/common.php:1.57 --- php4/pear/DB/common.php:1.56 Mon Jul 30 16:43:12 2001 +++ php4/pear/DB/common.php Fri Aug 3 10:17:31 2001 @@ -37,6 +37,7 @@ var $prepare_maxstmt = 0; var $last_query = ''; var $fetchmode = DB_FETCHMODE_ORDERED; + var $fetchmode_object_class = 'DB_row'; var $options = array( 'persistent' => false, // persistent connection? 'optimize' => 'performance', // 'performance' or 'portability' @@ -200,20 +201,29 @@ * DB_FETCHMODE_ASSOC, possibly bit-wise OR'ed with * DB_FETCHMODE_FLIPPED. * + * @param $object_class string optional The class of the object + * to be returned by the fetch methods when + * the DB_FETCHMODE_OBJECT mode is selected. + * * @see DB_FETCHMODE_ORDERED * @see DB_FETCHMODE_ASSOC * @see DB_FETCHMODE_FLIPPED + * @see DB_FETCHMODE_OBJECT */ - function setFetchMode($fetchmode) + function setFetchMode($fetchmode, $object_class = null) { switch ($fetchmode) { + case DB_FETCHMODE_OBJECT: + if ($object_class) { + $this->fetchmode_object_class = $object_class; + } case DB_FETCHMODE_ORDERED: case DB_FETCHMODE_ASSOC: $this->fetchmode = $fetchmode; break; default: - return $this->raiseError("invalid get mode"); + return $this->raiseError('invalid fetchmode mode'); } }

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