TypeInfoCache.getPGArrayElement - determine if array

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: TypeInfoCache.getPGArrayElement - determine if array
Date: 2010-11-22 09:45:43
Message-ID: b4061baf630d6ebb766e790c1910b248@smogura-softworks.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

In TypeInfo.getPGArrayElement it is written "Returns: the base type's OID,
or 0 if unknown", but if given oid isn't array exception is thrown (empty
result set), if unknown doesn't means unspecified then following patch

ResultSet rs = _getArrayElementOidStatement.getResultSet();
if (!rs.next()) {
pgType = Integer.valueOf(0);
_pgArrayToPgType.put(new Integer(oid), pgType);
}else {
pgType = Integer.valueOf((int)rs.getLong(1));
_pgArrayToPgType.put(new Integer(oid), pgType);
_pgNameToOid.put(rs.getString(2), pgType);
_oidToPgName.put(pgType, rs.getString(2));
}

--
----------
Radosław Smogura
http://www.softperience.eu

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Lew 2010-11-22 13:14:42 Re: getTables() doesn't handle umlauts correctly
Previous Message Itagaki Takahiro 2010-11-22 06:37:31 Re: [JDBC] Support for JDBC setQueryTimeout, et al.