From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | rod(at)iol(dot)ie |
Cc: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Prepared statements with a variable number of parameters |
Date: | 2009-10-10 17:52:10 |
Message-ID: | 162867790910101052y612bf1d1i29dd064a8d3ad294@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
2009/10/10 Raymond O'Donnell <rod(at)iol(dot)ie>:
> I'm using PDO in PHP for database access (actually Zend Framework), and
> following best practice by using parameters in prepared statements.
>
> My question is, what do people normally do when there's a variable
> number of parameters? - for example:
>
> select ..... where item_id in ( ... );
>
You can use arrays here.
select ... where item_id = ANY(string_to_array($1, ','))
Regards
Pavel Stehule
> In this case, I mightn't know how many values will go inside the
> parentheses.
>
> Thanks,
>
> Ray.
>
> ------------------------------------------------------------------
> Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
> rod(at)iol(dot)ie
> Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
> ------------------------------------------------------------------
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-10-10 18:53:19 | Re: Building PG 8.4.1 with ossp-uuid on Centos 5.3 |
Previous Message | Raymond O'Donnell | 2009-10-10 17:24:51 | Prepared statements with a variable number of parameters |