pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedBinding Parameters
3+ messages / 2 participants
[nested] [flat]
* Binding Parameters
@ 2004-09-10 19:29 Postgres User <postgres@productivitymedia.com>
2004-09-11 18:14 ` Re: Binding Parameters Andrew Hammond <ahammond@ca.afilias.info>
0 siblings, 1 reply; 3+ messages in thread
From: Postgres User @ 2004-09-10 19:29 UTC (permalink / raw)
To: pgsql-admin
I'm new to PostgreSQL, and am wondering for BindSQL is intergrated in
Postgres or in the future for version 8.
Example:
SELECT * FROM sample_table WHERE computer = :1;
Any pointers will help.
Thanks,
J
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Binding Parameters
2004-09-10 19:29 Binding Parameters Postgres User <postgres@productivitymedia.com>
@ 2004-09-11 18:14 ` Andrew Hammond <ahammond@ca.afilias.info>
2004-09-11 20:42 ` Re: Binding Parameters Postgres User <postgres@productivitymedia.com>
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Hammond @ 2004-09-11 18:14 UTC (permalink / raw)
To: Postgres User <postgres@productivitymedia.com>; +Cc: pgsql-admin
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Postgres User wrote:
| I'm new to PostgreSQL, and am wondering for BindSQL is intergrated in
| Postgres or in the future for version 8.
|
| Example:
|
| SELECT * FROM sample_table WHERE computer = :1;
|
| Any pointers will help.
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)
- --
Andrew Hammond 416-673-4138 ahammond@ca.afilias.info
Database Administrator, Afilias Canada Corp.
CB83 2838 4B67 D40F D086 3568 81FC E7E5 27AF 4A9A
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFBQ0CJgfzn5SevSpoRAqyPAKDPM6BGRBT24nUJvaDePgcsBKVHhgCgyH0d
/qANwzyTD/HyNbBYCxTOFic=
=B1y3
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Binding Parameters
2004-09-10 19:29 Binding Parameters Postgres User <postgres@productivitymedia.com>
2004-09-11 18:14 ` Re: Binding Parameters Andrew Hammond <ahammond@ca.afilias.info>
@ 2004-09-11 20:42 ` Postgres User <postgres@productivitymedia.com>
0 siblings, 0 replies; 3+ messages in thread
From: Postgres User @ 2004-09-11 20:42 UTC (permalink / raw)
To: Andrew Hammond <ahammond@ca.afilias.info>; +Cc: 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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-09-11 20:42 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-10 19:29 Binding Parameters Postgres User <postgres@productivitymedia.com>
2004-09-11 18:14 ` Andrew Hammond <ahammond@ca.afilias.info>
2004-09-11 20:42 ` Postgres User <postgres@productivitymedia.com>
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