Saturday, September 11, 2010

Re: Duplicate Count Records on Update

Oops, my previous comment was incorrect. taking off validation does
not prevent the double count from happening. The second one is called
none the less.

On Sep 11, 2:15 pm, Wilhelm <wilhelm.ellm...@gmail.com> wrote:
> Hi,
>
> thanks for your response, I will make sure that MySql cache is
> enabled. I have also done some research into this ( I took some time
> to look through the model code )
> and found that if you disable validation, the second Count query will
> not occur.
>
> Kind Regards
> Wilhelm
>
> On Sep 11, 12:45 am, francky06l <franckl...@gmail.com> wrote:
>
> > Well, that's the way cake's handles it ... Now if you have the query
> > cache enabled on MySql, the second COUNT should cost 0 ..
> > You can try using updateAll ... that should not make extra query ..
>
> > On Sep 10, 3:10 pm, Wilhelm <wilhelm.ellm...@gmail.com> wrote:
>
> > > Hi,
>
> > > I would like to first of all apologize if this has been answered
> > > before by all my searching I could not find out, ( possible google
> > > skills lacking )
>
> > > So I am busy running CakePHP 1.3.3 and noticed something a little
> > > strange when performing a update. Looking at the run queries I have
> > > noticed that there are two Select Count(*) queries. Do some research I
> > > did find out that there is a reason for the one to have better error
> > > detection but I think the second one is a little excessive. I have
> > > stopped short of reporting this as a bug as I would would first like
> > > to check that I am not missing something in my implementation.
>
> > > The php script
> > > $this->Campaign->Mo->id = $moId;
> > > $this->Campaign->Mo->save( array( 'Mo' =>
> > > array( 'field_one'=>1,'field_two'=>2 ) ) );
>
> > > Debug Report
> > > SELECT COUNT(*) AS `count` FROM `mos` AS `Mo` WHERE `Mo`.`id` = 91
> > > SELECT COUNT(*) AS `count` FROM `mos` AS `Mo` WHERE `Mo`.`id` = 91
> > > UPDATE `mos` SET `field_one` = 1, `field_two` = 2, `modified` =
> > > '2010-09-10 12:56:28' WHERE `mos`.`id` = 91
>
> > > Any help will greatly be appreciated.
>
> > > Kind Regards
> > > Wilhelm

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate