ResultSet getXXX methods - Mailing list pgsql-jdbc

From Joseph Shraibman
Subject ResultSet getXXX methods
Date
Msg-id bkobpe$h84$1@news.hub.org
Whole thread Raw
List pgsql-jdbc
Each getXXX() method in AbstractJdbc1ResultSet first calls getString(), which decodes the
bypte[] into a String, then operates on that String.  For example:

    public boolean getBoolean(int columnIndex) throws SQLException
    {
        return toBoolean( getString(columnIndex) );
    }
    public static boolean toBoolean(String s)
    {
        if (s != null)
        {
            int c = s.charAt(0);
            return ((c == 't') || (c == 'T') || (c == '1'));
        }
        return false;        // SQL NULL
    }

Is there any encoding there t, T, and the number chars are not the same?  I was under the
impression that all encodings are the same for bytes <= 127.  If there isn't then for
getBoolean() we can just get the first byte and compare it to t,T, and 1.


pgsql-jdbc by date:

Previous
From: Bjørn T Johansen
Date:
Subject: Table Lock?
Next
From: Barry Lind
Date:
Subject: Re: Table Lock?