Create a view or a stored procedure in your database and call it instead of
using find.

On Fri, Sep 17, 2010 at 5:40 PM, may_...@bk.ru <yakot...@gmail.com> wrote:

> Hi there.
>
> My model uses multiply tables, not single one. Those tables have
> unique CHAR strings as primary key, so they don't intersect.
>
> I need my model to search through all of these tables. But cake's FIND
> method doesn't allow to specify table to search in. And also doesn't
> allow to use mysql's UNITE constructions.
> So, I should use such an monster construction like
>
> __________________________________________
> $this->setSource($table1);
> $r=$this->find(....);
> if (! $r)
> {
> $this->setSource($table2);
> $r=$this->find(....);
> }
> if (! $r)
> {
> $this->setSource($table3);
> $r=$this->find(....);
> }
> & etc
> __________________________________________
>
> It seems to me to be at least extreamly slow. All this job can be mady
> with only one MySQL query like:
>
> __________________________________________
> SELECT <..> FROM `<table1>` WHERE <..> ORDER <..> <...>
> UNITE
> SELECT <..> FROM `<table2>` WHERE <..> ORDER <..> <...>
> UNITE
> SELECT <..> FROM `<table3>` WHERE <..> ORDER <..> <...>
> & etc
> __________________________________________
>
> Do you have idea, how to do it? It seems to me, that the only way is
> copypasting cake's "find" method and changing it my situation.
> Maybee there is another way?
>
> 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+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Regards,
Zaky Katalan-Ezra
QA Administrator
www.IGeneriX.com
Sites.IGeneriX.com
054-7762312

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to