People looking for the answer to " defining limit row in oracle " :

in the model , use the
        'conditions' => ' WHERE ROWNUM <= 3 '
option.

Limit is the implementation in mySQL.
Hope this helps someone...

On 8 dec, 01:53, sanderken <[EMAIL PROTECTED]> wrote:
> Maybe I should mention I'm using oracle for DBMS.
>
> On 7 dec, 21:54, sanderken <[EMAIL PROTECTED]> wrote:
>
> > Hey,
>
> > I defined a "user" (named Gebruiker in my native language ) model
> > where when I call a $this->find() , needs to retrieve only a limited
> > amount of related information.
>
> > When I add the 'limit' => '10' to the association info, it doesn't
> > work. For example: I call
> >    $gebruiker = $this->find(
> >         array("Gebruiker.id" => $gebruikerid)
> >     );
> >  in the model and it retrieves 11 'kommentaars'.
>
> > Does anyone know why this happens? I searched the internet for model
> > information, and even the example 
> > onhttp://manual.cakephp.org/chapter/modelsshowthe same way of doing
> > this. But it works in their example and not in my situation ;)
>
> > Does anyone know how to solve this problem?
>
> > Thanks,
>
> > Here's the code:
>
> > class Gebruiker extends AppModel
> > {
> >         var $name = 'Gebruiker';
>
> >                 var $hasMany = array(
> >                 'Blog' => array(
> >                     'className'     => 'Blog',
> >                                 'order' => 'Blog.created DESC',
> >                                 'limit' => '10',
> >                                 'foreignKey' => 'gebruiker_id',
>
> >                         ),
> >                         'Kommentaar' => array(
> >                                 'className'     => 'Kommentaar',
> >                                 'order' => 'Kommentaar.created DESC',
> >                                 'limit' => '5',
> >                                 'foreignKey' => 'gebruiker_id'
> >                         ),
> >                         'Message_sent' => array(
> >                                 'className' => 'Message',
> >                                 'order'    => 'Message_sent.created DESC',
> >                                 'limit'        => '10',
> >                                 'foreignKey'    => 'sender_id',
> >                         ),
> >                         'Message_received' => array(
> >                                 'className' => 'Message',
> >                                 'order'    =>
> > 'Message_received.created DESC',
> >                                 'limit'   => '10',
> >                                 'foreignKey'    => 'receiver_id',
> >                         )
> >                 );
> >  <!-- Model logic here -->
>
> > }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to