And from the documentation, the params aren't sanitized since I'm not
using Cake's ORM?! Anyway to get the Pg object and prepare the
statement instead?

On Nov 19, 1:26 pm, Dan <[email protected]> wrote:
> I figured passing an array for one of the parameters would do the
> trick, but alas :)
>
> You know where the code related to query is situated in Cake? Maybe
> something could be hacked for this?
>
> On Nov 19, 1:02 pm, cricket <[email protected]> wrote:
>
> > I don't believe that query() takes more than a single param. If it
> > does, though, I'd think that probably should be:
>
> > $params = array(1,2) ;
>
> > On Fri, Nov 19, 2010 at 11:49 AM, Dan <[email protected]> wrote:
> > > I'm looking at running a custom parametrized query. Here's my test
> > > model:
>
> > > class Project extends AppModel {
> > >    var $name = 'Project';
> > >    var $primaryKey = 'project_id';
>
> > >        function testInClause(){
> > >                $sql = <<<XSQL
> > >                select project_id, project_name
> > >                from tsdmgr_projects projects
> > >                where project_id in (?)
> > > XSQL;
> > >                $params = array( array(1,2) );
> > >                return $this->query($sql, $params);
> > >        }
> > > }
>
> > > I get the following error:
> > > Warning (2): strlen() expects parameter 1 to be string, array given
>
> > > The SQL that gets executed:
> > > select project_id, project_name from tsdmgr_projects projects where
> > > project_id in (1)
>
> > > I've tried this also without success:
> > > $params = array(1,2);
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > > with their CakePHP related questions.
>
> > > 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 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to