W dniu 10 stycznia 2012 22:52 użytkownik David Johnston
napisał:
> If you are going to supply one parameter per "possible value" anyway skip the
> whole "ANY" and "ARRAY" and just say " 'bob' IN ($1, $2 [,...]) ";
true :-)
prepare($sql);
$stmt->execute($names);
?>
PHP from several years cries
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Filip Rembialkowski
Sent: Tuesday, January 10, 2012 4:27 PM
To: Andy Colson
Cc: PostgreSQL
Subject: Re: [GENERAL] string = any()
no, I meant array constructor with
W dniu 10 stycznia 2012 16:17 użytkownik Andy Colson
napisał:
>> 2012/1/10 Andy Colson:
>>> I am writing PHP where it prepares a statement like:
>>> $sql = 'select * from aTable where id = any($1)';
>>>
>>> then in php I create a string:
>>> $args = "{1,2,3}";
>>>
>>> And run it:
>>>
>>> $q = pg_q
On 01/10/12 8:18 AM, Andy Colson wrote:
clayia=# select '{''joe'', ''bob'' }';
?column?
-
{'joe', 'bob' }
(1 row)
It does return an array of string, or so it looks.
I'm pretty sure that's just a string, not an array.
--
john r pierceN 37, W 1
Andy Colson writes:
> My confusion was from:
> clayia=# select '{''joe'', ''bob'' }';
> ?column?
> -
> {'joe', 'bob' }
> (1 row)
> It does return an array of string, or so it looks.
Yeah, it's not obvious that those quote marks are really data
characters. I wonder whethe
On 1/10/2012 10:28 AM, David Johnston wrote:
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson
Sent: Tuesday, January 10, 2012 11:20 AM
To: David Johnston
Cc: 'PostgreSQL'
Subject: Re: [GENERAL] st
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson
Sent: Tuesday, January 10, 2012 11:20 AM
To: David Johnston
Cc: 'PostgreSQL'
Subject: Re: [GENERAL] string = any()
> This still does not work,
This still does not work, even in psql:
select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] )
$$ ^ This works for me just finethough I am not using psql; are
you having quoting issues? What error do you get?
It runs, but it returns false. I get false at least. I'm assuming you
On 1/10/2012 10:11 AM, Tom Lane wrote:
Andy Colson writes:
This still does not work, even in psql:
select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] )
You've got the array quoting rules wrong here (should be double quote
marks, not single quotes). You didn't show us your PHP code but I
su
Andy Colson writes:
> This still does not work, even in psql:
> select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] )
You've got the array quoting rules wrong here (should be double quote
marks, not single quotes). You didn't show us your PHP code but I
surmise that's got the same mistake. Rea
$$ My comments embedded below
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson
Sent: Tuesday, January 10, 2012 10:33 AM
To: David Johnston
Cc: 'PostgreSQL'
Subject: Re: [GENERAL] string = any()
On 1
On 1/10/2012 9:17 AM, David Johnston wrote:
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson
Sent: Tuesday, January 10, 2012 10:04 AM
To: PostgreSQL
Subject: [GENERAL] string = any()
Hi all.
I am writing PHP
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson
Sent: Tuesday, January 10, 2012 10:04 AM
To: PostgreSQL
Subject: [GENERAL] string = any()
Hi all.
I am writing PHP where it prepares a statement like:
$sql = 's
2012/1/10 Andy Colson:
Hi all.
I am writing PHP where it prepares a statement like:
$sql = 'select * from aTable where id = any($1)';
then in php I create a string:
$args = "{1,2,3}";
And run it:
$q = pg_query_params($db, $sql, $args);
This is not actual code, just a sample. And it works g
maybe try to use ARRAY constructor instead?
http://www.postgresql.org/docs/9.0/static/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS
2012/1/10 Andy Colson :
> Hi all.
>
> I am writing PHP where it prepares a statement like:
> $sql = 'select * from aTable where id = any($1)';
>
> then in php
15 matches
Mail list logo