[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] gmPG2

From: Karsten Hilbert
Subject: Re: [Gnumed-devel] gmPG2
Date: Mon, 5 Feb 2007 09:20:23 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Mon, Feb 05, 2007 at 08:57:52AM +0800, Syan Tan wrote:

> if a get_connection call succeeds with a dsn,
> is that added to the pool, and then business objects
> will find it, or does a handle to the conn object have
> to be passed somewhere ?

The get_connection() returns a connection authenticated for
the DSN passed in or for the DSN set as the default.

Eventually, I want to add pooling the connections so that
when get_connection() is called with pooled=True it will
return a connection from the pool - if one is available for
the DSN. I have not gotten around to figuring out all the
details (thread safety etc). The external interface won't
change, however: 

 conn = gmPG2.get_connection(...)
 curs = conn.cursor()

So, yes, you will have to pass in the connection to the
business objects.

However, since that would be very cumbersome, you can also
set a default DSN to use for connections and call methods
which require a <link_obj> parameter (such as
gmPG2.run_ro/rw_queries()) with a value of None. They will
then get their own connection from gmPG2 with the previously
set default DSN. This will start a lot of connections and
for that pooling should help tremendously. If you can help
me to figure out how to safely enable pooling I'd be
delighted to add it in.

BTW, thos <link_obj> parameters can take None, a connection,
or a cursor, for convenience.

GPG key ID E4071346 @
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

reply via email to

[Prev in Thread] Current Thread [Next in Thread]