Wednesday, September 29, 2010

Re: model->delete error

We've found the reason of the error. CakePHP bug reopened:
http://cakephp.lighthouseapp.com/projects/42648/tickets/250-model-delete-bug

On 28 сен, 12:36, Frobozz <e.taychenac...@gmail.com> wrote:
> We have exactly the same problem on production server now with CakePHP
> 1.3.x applications. Did you succeed in solving this issue?
>
> On 27 авг, 03:20, lloydhome <david.lloydh...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I have v1.3.2 running on a production site that has in a controller:
> > (effectively, some non-related code removed)
>
> > $results = $this->Pipe->find('all', array('conditions'=>$conditions));
> > if(sizeof($results) > 1) {
> >         $pipes = sizeof($results);
> >         for($i = 0; $i < $pipes - 1; $i++) {
> >                 $this->Pipe->id = $results[$i]['Pipe']['p_id'];
> >                 $this->Pipe->delete();
> >                 unset($results[$i]);
> >         }
>
> > }
>
> > so that all but one matching record remains.
>
> > Typically, for months now and even within seconds of the error, the
> > SQL generated by this code was:
> >         DELETE FROM `pipe` WHERE `pipe`.`p_id` = 12345;
>
> > until the one time on yesterday it issued:
> >         DELETE FROM `pipe` WHERE 1 = 1;
>
> > (There went 360000+ records) I see this in the MySQL binlog but cannot
> > tell what value for id was set.  It is my understanding that in no
> > reasonable case should this cause this SQL to be generated.
>
> > Does anyone have an alternate understanding or insight into what went
> > wrong?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: