I think there is an explanation to this. To me it seems just imposibile to generate this. Something somewhere is certainly wrong. And I don't thing cake is. Why not check the core ?
For example try: recursive => -1 See if happens again. Does this happens on every call ? On Tue, Nov 16, 2010 at 7:50 PM, [email protected] <[email protected]> wrote: > Hi, > > I have a bunch of models with various associations set up between them > and seems like Cakephp at times executes incorrect SQL statement and > cause MySQL to barf. > > Please refer the the "EDIT" followed by this to see some examples of > the problem. > > It doesn't happen all the time but it eventually happens since I am > doing everything in a tight loop. > > Please help. This really makes me question my decision to go with Cake > since this sounds bad. > > Thanks. > > EDIT 1 I just ran into the problem and here is the faulty SQL: > > SELECT COUNT(*) AS `count` FROM `albums_songs` AS `AlbumSong` WHERE > `ArtistGenre`.`id` = 26482 > > AlbumSong and ArtistGenre are two completely separate tables and they > are not related at all. > > EDIT 2 Just ran into another failure. The code is: > > $this->Song->find('first', array('conditions' => > array('Song.artist_id' => 30188, 'Song.name' => 'Pal Pal > (By.Tarkhanz)'), 'fields' => array('Song.id'))) > > While the generated SQL is: > > SELECT `Song`.`id` FROM `songs` AS `Song` WHERE `Artist`.`name` = > 'Annie Villeneuve' LIMIT 1 > > As you can see no were in the conditions do I specify an Artist.name > yet the SQL generated is looking at it. > > EDIT 3 Another example failure. Call is as followed: > > $this->Song->id = $song_id; > $library_count = $this->Song->field('Song.library_count'); > > Yet the SQL is: > > SELECT `Song`.`library_count` FROM `songs` AS `Song` WHERE > `Artist`.`name` = 'Mazikana_Ragheb_Allama' LIMIT 1 > > where Artist.name is not a column of Song as it belongs to the Artist > model. > > Thanks. > > 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 [email protected] > To unsubscribe from this group, send email to > [email protected]<cake-php%[email protected]>For > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Thanks, Bogdan Iulian Bursuc 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
