pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Postgres User <postgres@productivitymedia.com>
To: Andrew Hammond <ahammond@ca.afilias.info>
Cc: pgsql-admin@postgresql.org
Subject: Re: Binding Parameters
Date: Sat, 11 Sep 2004 16:42:36 -0400
Message-ID: <4143633C.3000800@productivitymedia.com> (raw)
In-Reply-To: <4143408B.7040604@ca.afilias.info>
References: <4142008A.2010108@productivitymedia.com>
	<4143408B.7040604@ca.afilias.info>


>
> 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




view thread (3+ messages)

Message-ID: <4143633C.3000800@productivitymedia.com>
Permalink:  ../4143633C.3000800@productivitymedia.com/
Also on:    postgresql.org/message-id/4143633C.3000800@productivitymedia.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: postgres@productivitymedia.com, ahammond@ca.afilias.info
  Subject: Re: Binding Parameters
  In-Reply-To: <4143633C.3000800@productivitymedia.com>
  References: <4142008A.2010108@productivitymedia.com> <4143408B.7040604@ca.afilias.info> <4143633C.3000800@productivitymedia.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox