ResultSet getXXX methods

Поиск
Список
Период
Сортировка
Искать

ResultSet getXXX methods

От:
Joseph Shraibman <jks@selectacast.net>
Дата:
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.

FAQ