Skip site navigation (1) Skip section navigation (2)

getObject(<oid>) returns integer instead of LargeObject handle ?

From: Marc Herbert <Marc(dot)Herbert(at)emicnetworks(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: getObject(<oid>) returns integer instead of LargeObject handle ?
Date: 2005-07-22 13:56:40
Message-ID: 20050722135640.GM7394@emicnetworks.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hi,

 Is there some good reason for getObject(<some oid column>) to return the
bare oid integer instead of the actual LargeObject handle ?

 I slightly modified the driver as below and it fixed my Blob issues
without any other side-effects. Would have some extensive testing
shown some problems I missed ?  Sorry for not being very familiar with
Postgres' oids.

Thanks in advance.

Cheers,

Marc.


Index: postgresql/jdbc2/TypeInfoCache.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/TypeInfoCache.java,v
retrieving revision 1.1
diff -u -r1.1 TypeInfoCache.java
--- postgresql/jdbc2/TypeInfoCache.java	10 Apr 2005 21:54:16 -0000	1.1
+++ postgresql/jdbc2/TypeInfoCache.java	22 Jul 2005 13:45:35 -0000
@@ -51,7 +51,7 @@
     private static Object types[][] = {
         {"int2", new Integer(Oid.INT2), new Integer(Types.SMALLINT), "java.lang.Short"},
         {"int4", new Integer(Oid.INT4), new Integer(Types.INTEGER), "java.lang.Integer"},
-        {"oid", new Integer(Oid.OID), new Integer(Types.INTEGER), "java.lang.Integer"},
+        {"oid", new Integer(Oid.OID), new Integer(Types.BLOB), "java.sql.Blob"},
         {"int8", new Integer(Oid.INT8), new Integer(Types.BIGINT), "java.lang.Long"},
         {"money", new Integer(Oid.MONEY), new Integer(Types.DOUBLE), "java.lang.Double"},
         {"numeric", new Integer(Oid.NUMERIC), new Integer(Types.NUMERIC), "java.math.BigDecimal"},

Responses

pgsql-jdbc by date

Next:From: Dave CramerDate: 2005-07-22 14:13:16
Subject: Re: Timestamp Conversion Woes Redux
Previous:From: Tom LaneDate: 2005-07-22 13:45:17
Subject: Re: Timestamp Conversion Woes Redux

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group