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

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 (view raw or flat)
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

pgsql-jdbc by date

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

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