Re: SQL_Wrapper Class

From: Date: Wed, 10 Jul 2002 07:47:41 +0000
Subject: Re: SQL_Wrapper Class
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-7616@lists.php.net to get a copy of this message
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. If you have problems with autoExecute() or autoPrepare(), ask me, I will send to you the complete doc. Best Regards Fabien

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