class NeoviewDatabaseMeta extends BaseDatabaseMeta implements DatabaseInterface {

  @Override
  public Object getValueFromResultSet( ResultSet rs, ValueMetaInterface val, int i ) throws KettleDatabaseException {
    Object data = null;

    try {
      switch ( val.getType() ) {
        case ValueMetaInterface.TYPE_BOOLEAN:
          data = Boolean.valueOf( rs.getBoolean( i + 1 ) );
          break;
        case ValueMetaInterface.TYPE_NUMBER:
          data = new Double( rs.getDouble( i + 1 ) );
          break;
        case ValueMetaInterface.TYPE_BIGNUMBER:
          data = rs.getBigDecimal( i + 1 );
          break;
        case ValueMetaInterface.TYPE_INTEGER:
          data = Long.valueOf( rs.getLong( i + 1 ) );
          break;
        case ValueMetaInterface.TYPE_STRING:
          if ( val.isStorageBinaryString() ) {
            data = rs.getBytes( i + 1 );
          } else {
            data = rs.getString( i + 1 );
          }
          break;
        case ValueMetaInterface.TYPE_BINARY:
          if ( supportsGetBlob() ) {
            Blob blob = rs.getBlob( i + 1 );
            if ( blob != null ) {
              data = blob.getBytes( 1L, (int) blob.length() );
            } else {
              data = null;
            }
          } else {
            data = rs.getBytes( i + 1 );
          }
          break;
        case ValueMetaInterface.TYPE_TIMESTAMP:
        case ValueMetaInterface.TYPE_DATE:
          if ( val.getOriginalColumnType() == java.sql.Types.TIME ) {
            // Neoview can not handle getDate / getTimestamp for a Time column
            data = rs.getTime( i + 1 );
            break; // Time is a subclass of java.util.Date, the default date
                   // will be 1970-01-01
          } else if ( val.getPrecision() != 1 && supportsTimeStampToDateConversion() ) {
            data = rs.getTimestamp( i + 1 );
            break; // Timestamp extends java.util.Date
          } else {
            data = rs.getDate( i + 1 );
            break;
          }
        default:
          break;
      }
      if ( rs.wasNull() ) {
        data = null;
      }
    } catch ( SQLException e ) {
      throw new KettleDatabaseException( "Unable to get value '"
        + val.toStringMeta() + "' from database resultset, index " + i, e );
    }

    return data;
  }

}