Re: DB / autoprepare() ?

From: Date: Tue, 04 Jun 2002 12:27:32 +0000
Subject: Re: DB / autoprepare() ?
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6732@lists.php.net to get a copy of this message
(Fabien) >> One thing I feel borring is to write my sql queries to insert or update >> records in database. [...] (Markus) > That would be a great addition - and even better if it also dealt with > UPDATE statements. > Something like > $db->autoPrepare($table,$valueArray,DB_AUTOQUERY_INSERT); > $db->autoPrepare($table,$valueArray,DB_AUTOQUERY_UPDATE); Yes, it would be perfect. Only one thing to add : for update queries, we need a new param, the where statement. Example : $db->autoPrepare('table', $array, DB_AUTOQUERY_UPDATE, 'id = 5'); And the autoPrepare() method will make : UPDATE table SET field1=?, field2=?, ... WHERE id=5 Why to give the where statement ? Because of flexibility. I don't like solutions based only on primary keys for instance. Fabien

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