Re: [Pgjdbc-commit] By jurka: Add some more synchronization

Lists: pgsql-jdbc
From: Markus Schaber <schabi(at)logix-tt(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [Pgjdbc-commit] By jurka: Add some more synchronization to the
Date: 2006-05-22 07:59:14
Message-ID: 44716F52.8080202@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hi, Till,

CVS User Account wrote:
> Make _pgNameToSQLType static.

> // pgname (String) -> java.sql.Types (Integer)
> - private Map _pgNameToSQLType;
> + private static final Map _pgNameToSQLType;

Are you shure this should be static, and not per connection?

AFAICS, it is possible to have two connections to different databases
having different extension types installed, leading to conflicting maps.

Thanks,
Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org


From: Kris Jurka <books(at)ejurka(dot)com>
To: Markus Schaber <schabi(at)logix-tt(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [Pgjdbc-commit] By jurka: Add some more synchronization
Date: 2006-05-22 08:09:10
Message-ID: Pine.BSO.4.63.0605220303360.21575@leary2.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Mon, 22 May 2006, Markus Schaber wrote:

>> // pgname (String) -> java.sql.Types (Integer)
>> - private Map _pgNameToSQLType;
>> + private static final Map _pgNameToSQLType;
>
> Are you shure this should be static, and not per connection?
>
> AFAICS, it is possible to have two connections to different databases
> having different extension types installed, leading to conflicting maps.
>

This maps betweeen a pg type name like varchar and a java.sql.Types value
like Types.VARCHAR. There is a hardcoded list of pg types that the driver
knows about and can assign a Types value. For types the driver doesn't
know anything about, all it can say is that it is Types.OTHER. Note also
that in initialization it does:

_pgNameToSQLType = Collections.unmodifiableMap(pgNameToSQLType);

So there's no way it can get bad information into it.

Kris Jurka


From: Markus Schaber <schabi(at)logix-tt(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [Pgjdbc-commit] By jurka: Add some more synchronization
Date: 2006-05-22 08:12:43
Message-ID: 4471727B.9040101@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hi, Kris,

Kris Jurka wrote:

> This maps betweeen a pg type name like varchar and a java.sql.Types
> value like Types.VARCHAR. There is a hardcoded list of pg types that
> the driver knows about and can assign a Types value. For types the
> driver doesn't know anything about, all it can say is that it is
> Types.OTHER.

OK, I see.

I confused this with the typename -> OID map.

Sorry.
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org