X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 95193329E7E for ; Sat, 11 Sep 2004 21:38:25 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14533-09 for ; Sat, 11 Sep 2004 20:38:22 +0000 (GMT) Received: from ns2.instrumentalyst.com (blk-222-55-203.eastlink.ca [24.222.55.203]) by svr1.postgresql.org (Postfix) with SMTP id 2B623329E5C for ; Sat, 11 Sep 2004 21:38:22 +0100 (BST) Received: (qmail 20947 invoked by uid 6002); 11 Sep 2004 20:42:46 -0000 Received: from postgres@productivitymedia.com by ns2.instrumentalyst.com by uid 4002 with qmail-scanner-1.21 (clamscan: 0.70-rc. spamassassin: 2.63. Clear:RC:1(68.56.170.170):. Processed in 3.534467 secs); 11 Sep 2004 20:42:46 -0000 Received: from unknown (HELO ?192.168.2.2?) (68.56.170.170) by blk-222-55-203.eastlink.ca with SMTP; 11 Sep 2004 20:42:42 -0000 Message-ID: <4143633C.3000800@productivitymedia.com> Date: Sat, 11 Sep 2004 16:42:36 -0400 From: Postgres User User-Agent: Mozilla Thunderbird 0.8 (Macintosh/20040910) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrew Hammond Cc: pgsql-admin@postgresql.org Subject: Re: Binding Parameters References: <4142008A.2010108@productivitymedia.com> <4143408B.7040604@ca.afilias.info> In-Reply-To: <4143408B.7040604@ca.afilias.info> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/106 X-Sequence-Number: 14809 > > 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