Re: insert .. on duplicate key update for DB_DataObject

From: Date: Wed, 22 Jun 2005 15:12:14 +0000
Subject: Re: insert .. on duplicate key update for DB_DataObject
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19723@lists.php.net to get a copy of this message
On 6/21/05, Dan Rossi <pear@electroteque.org> wrote: > > On 22/06/2005, at 4:05 PM, Justin Patrin wrote: > > > On 6/21/05, Dan Rossi <pear@electroteque.org> wrote: > >> Hey there I was wondering if there is any chance doing this on an > >> insert ? I am needing to update records in a one to many table but > >> only > >> want to insert newer revised data and then possible update the current > >> ones there, any ideas ? > >> > > > > You can always override the insert and/or update methods in your DO. > > > > -- > > Justin Patrin > > > > > > I'm currently using the query method direct, I was just asking if there > is another way ? > As I said, yes, override the insert function. Make it check for a dupe key, if there is one do an update (with $this->update()) instead of doing an insert. -- Justin Patrin

« previous php.pear.general (#19723) next »