Justtechjobs.com Find a programming school near you






Online Campus Both


php4-beta | 199912

Re: [PHP4BETA] DB.php From: Andi Gutmans (andi <email protected>)
Date: 12/08/99

On Wed, 8 Dec 1999, Stig Bakken wrote:

> On Tue, 7 Dec 1999, Andrei Zmievski wrote:
>
> | I fail to understand the purpose of DB class in PEAR. Is it supposed
> | to be a factory class? Because it certainly does more than that. Why
> | does it have fetchRow() and DB_mysql class has fetchRow(), yet DB class
> | doesn't have query() method.
>
> There are two classes in DB.php: DB and DB_result. DB contains two
> factory methods (factory and connect) as well as a bunch of functions
> common to all of DB, such as rewriting error codes to messages. These
> should always be used with the "static" syntax: DB::isError().
>
> Then there's DB_common, which defines some default methods (sort-of
> virtual), as well as a bunch of common utility methods I started writing
> this morning. DB_common is only for inheritance from DB_[dbtype].
>
> DB_[dbtype] implements only the database-specific stuff. The query()
> method returns a DB_result object, which is defined DB.php (this is where
> the fetchRow() method you mention comes from).
>
> Example:
>
> $dbobj = DB::connect("mysql://user:pass <email protected>/mydb");
> // $dbobj is an instance of DB_mysql
> $robj = $dbobj->query('SELECT * FROM mytable');
> // $robj is an instance of DB_result
>
> There's a lot of stuff in the DB code that needs the "return references"
> rewrite though, just look for "XXX ADDREF". :-)

This will not happen before PHP 4.1 or Zend 1.1. It would take too much
time to stabalize.

Andi

-- 
PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
To unsubscribe, e-mail: php4beta-unsubscribe <email protected>
For additional commands, e-mail: php4beta-help <email protected>
To contact the list administrators, e-mail: php4beta-admin <email protected>