Thursday, November 25, 2010

Re: CakePHP Model uses the wrong fields in SQL statements!

On Nov 25, 6:33 am, John Steele <john.david.ste...@gmail.com> wrote:
> I've now confirmed this bug on two machines. Different Linux Dist,
> different kernel, different hardware, slightly newer version of PHP.
> The output is identical.
> I also forgot to disable the cache on this instance of CakePHP, so
> I've ruled that out.
>
> second machine:
> Ubuntu Linux 2.6.35-23-server #37-Ubuntu SMP Fri Nov 5 20:33:07 UTC
> 2010 x86_64 GNU/Linux
> PHP 5.3.3-1ubuntu9.1 with Suhosin-Patch (cli) (built: Oct 15 2010
> 14:00:18)
> Server version: Apache/2.2.16 (Ubuntu)
> cakephp/maverick uptodate 1.3.2-1
>
> add this line to the end of the for loop to get the correct query log:
>                         $dbo->_queriesLog = array_slice($dbo->_queriesLog, -100);
>
> The tail end of the query log:
>     [17]=>
>     array(5) {
>       ["query"]=>
>       string(57) "INSERT INTO `foos` (`bar`, `baz`) VALUES (128921,
> 128922)"
>       ["error"]=>
>       NULL
>       ["affected"]=>
>       int(1)
>       ["numRows"]=>
>       NULL
>       ["took"]=>
>       float(0)
>     }
>     [18]=>
>     array(5) {
>       ["query"]=>
>       string(35) "SELECT LAST_INSERT_ID() AS insertID"
>       ["error"]=>
>       NULL
>       ["affected"]=>
>       int(1)
>       ["numRows"]=>
>       int(1)
>       ["took"]=>
>       float(0)
>     }
>     [19]=>
>     array(5) {
>       ["query"]=>
>       string(115) "SELECT `Foo`.`id`, `Foo`.`bar`, `Foo`.`baz` FROM
> `foos` AS `Foo`   WHERE `bar` = 86111 AND `baz` = 86112    LIMIT 1"
>       ["error"]=>
>       NULL
>       ["affected"]=>
>       int(1)
>       ["numRows"]=>
>       int(1)
>       ["took"]=>
>       float(6)
>     }
>   }
>
>
>
> }

What a lot of noise in this thread (and most likely FUD) :)

all the above proves is that the 100th - 200th sql query you
launched .... are irrelevant. The sql query log doesn't log anything
more than the first 200 queries and you aren't clearing it so you are /
not/ looking at the last 100 queries you launched - as you've
apparently noted but still posted the irrelvant sql.

I find the numbers you present supicious - e.g. are you running out of
auto increment ids - that'd be my start point.

"my best guess would be a memory leak or overflow somewhere within PHP
itself. "

why would you conclude that? Extraordinary claims require
extraordinary irrefutable proof - which is missing.

FWIW/For info I've (as I'm sure have many) run many batch processes
inserting hundreds of thousands or millions of rows at a time.

hth,

AD

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: