X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 1B7099FA5FB for ; Fri, 16 Jun 2006 09:57:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 32988-01 for ; Fri, 16 Jun 2006 09:56:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from keymaster.look.ca (delta1.look.ca [207.136.80.9]) by postgresql.org (Postfix) with ESMTP id 372BC9FA42B for ; Fri, 16 Jun 2006 09:56:54 -0300 (ADT) Received: from 209-161-214-225.dsl.look.ca ([209.161.214.225]) by keymaster.look.ca with esmtp (Exim 4.20) id 1FrDsY-0000yh-RU; Fri, 16 Jun 2006 12:56:50 +0000 From: Rod Taylor To: John DeSoi Cc: chester c young , pgsql-sql@postgresql.org In-Reply-To: <4B156402-1B7D-46E2-8A4F-9DBD3F119CB7@pgedit.com> References: <20060615154930.44620.qmail@web54312.mail.yahoo.com> <4B156402-1B7D-46E2-8A4F-9DBD3F119CB7@pgedit.com> Date: Fri, 16 Jun 2006 08:55:16 -0400 Message-Id: <1150462516.777.550.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.6.2 FreeBSD GNOME Team Port X-SA-Exim-Mail-From: pg@rbt.ca Subject: Re: sessions and prepared statements Content-Type: text/plain Content-Transfer-Encoding: 7bit X-SA-Exim-Version: 3.1 (built Tue Feb 24 05:09:27 GMT 2004) X-SA-Exim-Scanned: Yes X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/202 X-Sequence-Number: 25438 On Fri, 2006-06-16 at 08:27 -0400, John DeSoi wrote: > On Jun 15, 2006, at 11:49 AM, chester c young wrote: > > > in PHP for example, where there are multiple sessions and which you > > get is random: > > > > how do you know if the session you're in has prepared a particular > > statement? > > > > and/or how do you get a list of prepared statements? > > > > last, is there any after login trigger that one could use to > > prepare statements the session would need? or is this a dumb idea? > > If you are using pooled connections, I don't think there is a > reasonable way you could managed prepared statements across requests. > You'll probably want to just prepare the ones you need for the > current request and discard them when the request ends. Temporary tables. BEGIN; SAVEPOINT; SELECT * FROM temporary_prepared_statement; ROLLBACK TO SAVEPOINT < on failure>; CREATE TEMPORARY TABLE temporary_prepared_statement ...; COMMIT; Now you have a place to store and retrieve prepared connection state for the lifetime of the database backend provided PHP doesn't remove temporary tables on the connection. > I have a short article where you might find some useful information > for managing prepared statements: > > http://pgedit.com/resource/php/pgfuncall > > You might also post your question to PostgreSQL PHP list -- probably > more PHP expertise there. > > Best, > > John > > > > > John DeSoi, Ph.D. > http://pgedit.com/ > Power Tools for PostgreSQL > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > --