Message from discussion
Issue with prepared statements using Doctrine_RawSql
MIME-Version: 1.0
Received: by 10.100.131.13 with SMTP id e13mr1726745and.6.1246992751195; Tue,
07 Jul 2009 11:52:31 -0700 (PDT)
Date: Tue, 7 Jul 2009 11:52:31 -0700 (PDT)
In-Reply-To: <a4ccc3c6-5b64-4653-be55-b08fb582e405@k19g2000yqn.googlegroups.com>
X-IP: 84.38.85.66
References: <a4ccc3c6-5b64-4653-be55-b08fb582e405@k19g2000yqn.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Opera/9.80 (Windows NT 5.1; U; pl) Presto/2.2.15
Version/10.00,gzip(gfe),gzip(gfe)
Message-ID: <760aba8c-daed-49f5-9e42-07add580c6bf@l31g2000yqb.googlegroups.com>
Subject: Re: Issue with prepared statements using Doctrine_RawSql
From: eXtreme <jacek.jedrzejew...@gmail.com>
To: doctrine-user <doctrine-user@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
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:
>
> =A0 =A0 =A0 =A0 $q =3D new Doctrine_RawSql();
> =A0 =A0 =A0 =A0 $result =3D $q->select('{p.*}')
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->from('photographers p')
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->addComponent('p', 'Photographer')
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->where('p.city_id =3D ?')
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->orderBy('CASE WHEN p.lname < ? THEN 1 E=
LSE 0 END,
> p.lname ASC')
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ->execute(array(35, "foo%"));
>
> Yields SQL like this:
> echo $q->getSql();
>
> SELECT [list of fields]
> FROM photographers p
> WHERE p.city_id =3D ?
> ORDER BY
> =A0 =A0CASE WHEN p.lname < ? THEN 1 ELSE 0 END, p.lname ASC
>