if (propertyName.equals("length")) { return new Integer(colNames.size()); } else { if (resultSet == null) { lastError = new SQLException("Attempt to access a released result set"); return null; } if (!firstRowSeen) { lastError = new SQLException("Attempt to access data before the first row is read"); return null;
case Types.TINYINT: case Types.BIGINT: case Types.SMALLINT: case Types.INTEGER: return new Long(resultSet.getLong(index));  case Types.REAL: case Types.FLOAT: case Types.DOUBLE: return new Double(resultSet.getDouble(index));  case Types.DECIMAL: case Types.NUMERIC: BigDecimal num = resultSet.getBigDecimal(index); if (num == null) { break; }  if (num.scale() > 0) { return new Double(num.doubleValue()); } else { return new Long(num.longValue()); }  case Types.VARBINARY: case Types.BINARY: return resultSet.getString(index);  case Types.LONGVARBINARY: case Types.LONGVARCHAR: try { return resultSet.getString(index); } catch (SQLException x) { Reader in = resultSet.getCharacterStream(index); char[] buffer = new char[2048]; int read = 0; int r = 0;  while ((r = in.read(buffer, read, buffer.length - read)) > -1) { read += r;  if (read == buffer.length) {  char[] newBuffer = new char[buffer.length * 2];  System.arraycopy(buffer, 0, newBuffer, 0, buffer.length); buffer = newBuffer; } } return new String(buffer, 0, read); }  case Types.DATE: case Types.TIME: case Types.TIMESTAMP: return resultSet.getTimestamp(index);  case Types.NULL: return null;  case Types.CLOB: Clob cl = resultSet.getClob(index); if (cl == null) { return null; } char[] c = new char[(int) cl.length()]; Reader isr = cl.getCharacterStream(); isr.read(c); return String.copyValueOf(c);  default: return resultSet.getString(index);
    public Object getProperty(String propertyName, int hash) {        //System.err.println(" &&& Getting property '" + propertyName + "'");        // Length property is firsy checked        // First return system or or prototype properties        if (propertyName.equals("length")) {             return new Integer(colNames.size());        } else {           if (resultSet == null) {                lastError = new SQLException("Attempt to access a released result set");                return null;           }            if (!firstRowSeen) {                lastError = new SQLException("Attempt to access data before the first row is read");                return null;            }           try {                int index = -1; // indicates not a valid index value                try {                    char c = propertyName.charAt(0);                    if ('0' <= c && c <= '9') {                       index = Integer.parseInt(propertyName);                    }                } catch (NumberFormatException e) {                } catch (StringIndexOutOfBoundsException e) { // for charAt                }                if (index>=0) {                    return getProperty(index);                }               Object value = resultSet.getObject(propertyName);               // IServer.getLogger().log("&& @VALUE : " + value);               lastError = null;               return value;           } catch (SQLException e) {              // System.err.println("##Cannot get property '" + propertyName + "' " + e);              // e.printStackTrace();              lastError = e;           }         }        return null;     }