[Seaside] Re: Application/Session Objects

Yanni Chiu yanni at rogers.com
Wed Feb 22 18:43:07 UTC 2006


Richard Huxton wrote:
> Hmm - that's useful, but what if I want to re-use the connection after 
> the request?

I'm not sure I understand you. The connection is still open,
and would be reachable via the session. Note that a WASession is
longer lived than a single http request/response cycle.

 > That is, I'd like to be able to do:
> 1. hook a request start, claim a DB connection from the pool
> 2. do some database queries
> 3. hook the request end, return connection to the pool
> 
> Crucially, #3 might restrict that connection for this session only or 
> allow any session to re-use it.

Currently, for postgres, I connect with fixed (by configuration)
username/password. Then, on the connection, I send:

   SET SESSION AUTHORIZATION username

But I'm not entirely sure this the "right" thing, since I've
not fully tested things with multiple users.

> I'd hate to have an open transaction floating around for an hour while I 
> wait for the session to expire.

Why would a transaction be open, unless you designed your
application flow in that way. Normally, you'd accumulated
user responses in your application model, through multiple
interactions with the user. Then when they hit "Save", the
transaction would be started, the database changes sent,
and the transaction commited.



More information about the Seaside mailing list