Re: SQL_Wrapper Class

From: Date: Wed, 10 Jul 2002 15:50:40 +0000
Subject: Re: SQL_Wrapper Class
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-7641@lists.php.net to get a copy of this message
MARTY Fabien wrote: > > Le mer 10/07/2002 à 09:28, l.woods@swissart.net a écrit : > > Hello, > > > > I am new to this list and new to the PHP/PEAR community. I am writing > > an SQL wrapper class which will use the DB class from PEAR for the > > Database connection. The class will provide methods for the most > > common database interactions; i.e. $sqlObj->insert(array()); where the > > keys of the array are the fieldnames and the values of the array are > > rowvalues. > > Yes in DB itself, in CVS. The doc is updated but not released. So I give > you an example : > > $db = ... (DB object) > > $array = array( > 'field1' => 'value1', > 'field2' => 'value2', > 'field3' => 'value3' > ); > > $db->autoExecute('table', $array, DB_AUTOQUERY_INSERT); > // will make the following query : > // INSERT INTO table (field1, field2, field3) VALUES ('value1', > 'value2', 'value3') > // and will send it > > $db->autoExecute('table', $array, DB_AUTOQUERY_UPDATE, 'id=5'); > // will make the following query : > // UPDATE table SET field1='value1', field2='value2', > field3='value3' > WHERE id=5 > // and will send it > > It's a simple facility, not a real SQL wrapper and it's only in DB CVS > for the moment. Nop, it's already in DB-1.3. You didn't see the announcement because of some technical problems with the emails, now solved. Tomas V.V.Cox

« previous php.pear.dev (#7641) next »