pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <pg@rbt.ca>
To: John DeSoi <desoi@pgedit.com>
Cc: chester c young <chestercyoung@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: sessions and prepared statements
Date: Fri, 16 Jun 2006 08:55:16 -0400
Message-ID: <1150462516.777.550.camel@home> (raw)
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>

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




view thread (6+ messages)  latest in thread

Message-ID: <1150462516.777.550.camel@home>
Permalink:  ../1150462516.777.550.camel@home/
Also on:    postgresql.org/message-id/1150462516.777.550.camel@home

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pg@rbt.ca, desoi@pgedit.com, chestercyoung@yahoo.com
  Subject: Re: sessions and prepared statements
  In-Reply-To: <1150462516.777.550.camel@home>

* 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