Re: DB_DataObject multiple deletes

From: Date: Wed, 27 Jul 2005 23:43:56 +0000
Subject: Re: DB_DataObject multiple deletes
References: 1 2 3 4 5  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20169@lists.php.net to get a copy of this message
On 7/27/05, Etienne van Tonder <evt@infoware.com.au> wrote: > Hi Justin, > > I did, everything seems to work fine upto the code I sent you. I've traced > into the code a bit further and this is what seems to be happening: > > First get(52) works fine and $_query array contains all elements reset to '' > due to $this->_query = $query_before; > [snip] Thanks for delving into all of this. Ok, I'm just realizing that this is isn't a normal use (duh). Since you're calling get() on it it's basically assumed that this DO will not be re-used. If you did something like this instead: $do->whereAdd('conditions to get the records you want to delete'); if ($do->find()) { while ($do->fetch()) { $do->delete(); } } Then that *should* work. I'm pretty sure I'm using that in my own scripts. However if you still want to use get() I suggest you create a new DO every time within the loop. DB_DO objects are set up to work with *one* fetching query. If you use find()/fetch() as above it's ok, but if you do multiple get()s it gets strange. There really is no reason for you to use the same one here. If you think you have a fix for this please submit it in the bug tracker. > > > "Justin Patrin" <papercrane@gmail.com> wrote in message > news:432beae050727154656f61b78@mail.gmail.com... > On 7/27/05, Etienne van Tonder <evt@infoware.com.au> wrote: > > Hi Justin, > > > > It produces the following error and does not perform the find sql: > > > > Undefined index: data_select > [snip] > > Yes, I saw all that before. Did you try checking the debug output like I > asked? > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Justin Patrin

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