ResultSet getXXX methods

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: ResultSet getXXX methods
Date: 2003-09-23 02:39:46
Message-ID: bkobpe$h84$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2003-09-23 06:16:02 Re: Bug in the setTimestamp() method for Newfoundland time
Previous Message Barry Lind 2003-09-23 01:24:53 Re: Table Lock?