Go to Google Groups Home    doctrine-user
Re: Issue with prepared statements using Doctrine_RawSql

eXtreme <jacek.jedrzejew...@gmail.com>

Because this process happens internally in PDO :P

On 7 Lip, 20:06, bmills <br...@millz.net> wrote:

> I'm having some issue using prepared statements in Doctrine_RawSql.
> Using a query like this:

>         $q = new Doctrine_RawSql();
>         $result = $q->select('{p.*}')
>                 ->from('photographers p')
>                 ->addComponent('p', 'Photographer')
>                 ->where('p.city_id = ?')
>                 ->orderBy('CASE WHEN p.lname < ? THEN 1 ELSE 0 END,
> p.lname ASC')
>                 ->execute(array(35, "foo%"));

> Yields SQL like this:
> echo $q->getSql();

> SELECT [list of fields]
> FROM photographers p
> WHERE p.city_id = ?
> ORDER BY
>    CASE WHEN p.lname < ? THEN 1 ELSE 0 END, p.lname ASC

> Any idea why my parameters aren't substituted into the query? Thanks!