Federico Di Gregorio wrote:
> Il giorno lun, 12/09/2005 alle 22.35 +0000, psycopg ha scritto:
>
>> The type registry is at module-scope which means multiple connections will
>> be sharing it. I think the type registry should be moved to the
>> connection.
>>
>> This could cause all sorts of interesting problems, affected by the
>> operating environment, if a single process accessed 2+ databases that have
>> different type oids for the same type.
>
>
> psycopg 2 will have per-cursor type maps. module-level type maps will
> remain as a 'default' for cursor without type maps (or would it be
> better to put the defaults in the connection?)
Hmm, I'm not sure I understand why each cursor would need a type map?
AFAIK, the type is global to the database. Other than that I think it
makes sense.
Just to clarify, this is the way I think of it ...
* PG has some standard types with fixed OIDs. These might as well be
hard-coded in psycopg in some sort of global registry. The global
registry should probably not be (easily) accessible to users.
* As each connection is created, the hard-coded registry gets
copied to the connection.
* New types can be registered for the connection using
new_type/register_type methods on the connection or perhaps
connection.registry.
Are adapters affected by this too? I haven't used them to know.
Cheers, Matt
--
__
/ \__ Matt Goodall, Pollenation Internet Ltd
\__/ \ w: http://www.pollenation.net
__/ \__/ e: matt-OIHT2ptovUgKF18QYN8mfw@xxxxxxxxxxxxxxxx
/ \__/ \ t: +44 (0)113 2252500
\__/ \__/
/ \ Any views expressed are my own and do not necessarily
\__/ reflect the views of my employer.
|