Re: Binding Parameters - Mailing list pgsql-admin

From Postgres User
Subject Re: Binding Parameters
Date
Msg-id 4143633C.3000800@productivitymedia.com
Whole thread Raw
In response to Re: Binding Parameters  (Andrew Hammond <ahammond@ca.afilias.info>)
List pgsql-admin
>
> Do you mean PREPARE / EXECUTE?
>
> /* ahammond@[local]:5432/ahammond =# */ \d foo
> ~                       Table "public.foo"
> ~ Column |  Type   |                  Modifiers
> - --------+---------+----------------------------------------------
> ~ foo_id | integer | not null default nextval('foo_id_seq'::text)
> ~ name   | text    | not null
> Indexes:
> ~    "foo_id_idx" unique, btree (foo_id)
> ~    "foo_name_idx" unique, btree (name)
>
> /* ahammond@[local]:5432/ahammond =# */ SELECT * FROM foo;
> ~ foo_id | name
> - --------+------
> ~      1 | a
> ~      2 | b
> ~      3 | c
> ~      4 | d
> ~      5 | f
> (5 rows)
>
> /* ahammond@[local]:5432/ahammond =# */ PREPARE foo_name (integer) AS
> SELECT name FROM foo WHERE foo_id = $1;
> PREPARE
> /* ahammond@[local]:5432/ahammond =# */ EXECUTE foo_name (1);
> ~ name
> - ------
> ~ a
> (1 row)
>
> /* ahammond@[local]:5432/ahammond =# */ EXECUTE foo_name (4);
> ~ name
> - ------
> ~ d
> (1 row)
>
Thanks for the short tutorial... I think that I've gotten the point.  I
was searching online and nothing proved useful.

Anymore more examples or direction on finding any of bind parameter is
appreciated.
J


pgsql-admin by date:

Previous
From: Andrew Hammond
Date:
Subject: Re: Binding Parameters
Next
From: "C. Bensend"
Date:
Subject: Memory exhausted in AllocSetAlloc