Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Issue with prepared statements using Doctrine_RawSql

View Parsed - Show only message text

MIME-Version: 1.0
Received: by 10.150.91.20 with SMTP id o20mr1748093ybb.23.1246989984620; Tue, 
	07 Jul 2009 11:06:24 -0700 (PDT)
Date: Tue, 7 Jul 2009 11:06:24 -0700 (PDT)
X-IP: 173.15.156.186
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: <a4ccc3c6-5b64-4653-be55-b08fb582e405@k19g2000yqn.googlegroups.com>
Subject: 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: 7bit

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


Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google