On Aug 30, 10:03 pm, Rafael Bandeira aka rafaelbandeira3
<[EMAIL PROTECTED]> wrote:
> > athttp://book.cakephp.org/view/73/retrieving-your-data, is some info
> > about usind find with regex (at conditions param). I can't find one
> > example of usage and there is nothing at the docs. Someone can give a
> > example of usage?
>
> I actually didn't understand what you want but if you want to use
> REGEXP in your query:
>
> $this->Project->find('all', array(
> 'conditions' => array(
> 'Project.title REGEXP' => '^ui'
> )
> ))
>
> Always when using operators in find conditions use them in the
> field's side, to avoid sql injections
Hi,
This is what i want, doing that (REGEXP) only work for a MySQL
database.
I am using PostgreSQL and to do a regex search i use '~' (Select *
FROM mytable WHERE field ~ my-regex-expression). If i put that at a
find conditions, this dont work.
at cake:
$this->Project->find('all', array(
'conditions' => array(
'Project.title ~' => '^ui'
)
))
but the sql statement looks like:
SELECT ... FROM my-table WHERE Project.title ~ = ^ui.
The REGEX search works only with MySQL?
thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---