Message from discussion
Issue with prepared statements using Doctrine_RawSql
MIME-Version: 1.0
Received: by 10.150.91.20 with SMTP id o20mr1766251ybb.23.1246994923922; Tue,
07 Jul 2009 12:28:43 -0700 (PDT)
Date: Tue, 7 Jul 2009 12:28:43 -0700 (PDT)
In-Reply-To: <760aba8c-daed-49f5-9e42-07add580c6bf@l31g2000yqb.googlegroups.com>
X-IP: 173.15.156.186
References: <a4ccc3c6-5b64-4653-be55-b08fb582e405@k19g2000yqn.googlegroups.com>
<760aba8c-daed-49f5-9e42-07add580c6bf@l31g2000yqb.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us)
AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17,gzip(gfe),gzip(gfe)
Message-ID: <378da02a-13b1-4ae4-9ec9-35597cb5d63c@h2g2000yqg.googlegroups.com>
Subject: Re: Issue with prepared statements using Doctrine_RawSql
From: bmills <br...@millz.net>
To: doctrine-user <doctrine-user@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
So you're saying Doctrine_RawSql() bypasses PDO all together? Would I
be better off working with a PDO object directly?
An an aside, is there anyway to use the '->orderBy(CASE WHEN .. )'
statement in DQL without getting an Unkown Aggregate exception?
On Jul 7, 2:52=A0pm, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> 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=
ELSE 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
>