Package com.tableau.hyperapi
Class Result
java.lang.Object
com.tableau.hyperapi.Result
- All Implemented Interfaces:
- AutoCloseable
A query result.
 
 Executing a query returns a result (see Connection.executeQuery(String)). The rows of a result can be
 iterated via nextRow(). The value of each column can be accessed via a type-specific getter such as
 getInt(int).
 
 This is an AutoCloseable class since it maintains native resources. The close()
 method must always be called when the result is no longer needed. The best way to guarantee this is to use a
 try-with-resources block.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes this result object, relinquishing the underlying native handles.Gets the number of rows affected by the SQL command.getBigDecimal(int position) Gets the value of column `position` for the current row as BigDecimal.booleangetBool(int position) Gets the value of column `position` for the current row as boolean.byte[]getByteArray(int position) Gets the value of column `position` for the current row as byte array.Gets the connection of the SQL statement that yielded this result.doublegetDouble(int position) Gets the value of column `position` for the current row as double.floatgetFloat(int position) Gets the value of column `position` for the current row as float.intgetInt(int position) Gets the value of column `position` for the current row as integer.getInterval(int position) Gets the value of column `position` for the current row as interval.getLocalDate(int position) Gets the value of column `position` for the current row as local date.getLocalDateTime(int position) Gets the value of column `position` for the current row as local date time.getLocalTime(int position) Gets the value of column `position` for the current row as local time.longgetLong(int position) Gets the value of column `position` for the current row as long.getObject(int position) Gets the value of column `position` for the current row as Object.getOffsetDateTime(int position) Gets the value of column `position` for the current row as an offset date time in UTC.byte[]getRaw(int position) Gets the value of column `position` for the current row as a raw value.Gets the schema of the result.shortgetShort(int position) Gets the value of column `position` for the current row as short.getString(int position) Gets the value of column `position` for the current row as string.getZonedDateTime(int position) Gets the value of column `position` for the current row as a zoned date time in UTC.booleanisNull(int position) Returns whether the value of column `position` is null for the current row.booleanisOpen()Returns whether the result is open.booleannextRow()Gets the next row of the result.
- 
Method Details- 
closepublic void close()Closes this result object, relinquishing the underlying native handles.- Specified by:
- closein interface- AutoCloseable
 
- 
isOpenpublic boolean isOpen()Returns whether the result is open.- Returns:
- Whether the result is open.
 
- 
getSchemaGets the schema of the result.- Returns:
- The schema of the result.
 
- 
getAffectedRowCountGets the number of rows affected by the SQL command.- Returns:
- The modified row count of the SQL command if it has one.
 
- 
getConnectionGets the connection of the SQL statement that yielded this result.- Returns:
- The connection.
 
- 
nextRowpublic boolean nextRow()Gets the next row of the result. Returns false if there is no next row.- Returns:
- Whether there is a next row.
 
- 
isNullpublic boolean isNull(int position) Returns whether the value of column `position` is null for the current row.- Parameters:
- position- The column position.
- Returns:
- Whether the value is null.
 
- 
getShortpublic short getShort(int position) Gets the value of column `position` for the current row as short. Can be used for columns with the SQL type "SMALLINT".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getIntpublic int getInt(int position) Gets the value of column `position` for the current row as integer. Can be used for columns with SQL types: "INTEGER", "OID" and "SMALLINT.- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getLongpublic long getLong(int position) Gets the value of column `position` for the current row as long. Can be used for columns with SQL types: "BIGINTEGER", "INTEGER", "NUMERIC" and "SMALLINT.- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getFloatpublic float getFloat(int position) Gets the value of column `position` for the current row as float. Can be used for columns with SQL types: "REAL", "DOUBLE PRECISION", "BIGINTEGER", "INTEGER", "NUMERIC" and "SMALLINT.- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getDoublepublic double getDouble(int position) Gets the value of column `position` for the current row as double. Can be used for columns with SQL types: "REAL", "DOUBLE PRECISION", "BIGINTEGER", "INTEGER", "NUMERIC" and "SMALLINT.- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getStringGets the value of column `position` for the current row as string. Can be used for columns with SQL types: "TEXT", "CHAR", "VARCHAR" and "JSON".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getBoolpublic boolean getBool(int position) Gets the value of column `position` for the current row as boolean. Can be used for columns with SQL type "BOOLEAN".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getBigDecimalGets the value of column `position` for the current row as BigDecimal. Can be used for columns with SQL types: "NUMERIC", "BIGINT", "INT" and "SMALLINT".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getByteArraypublic byte[] getByteArray(int position) Gets the value of column `position` for the current row as byte array. Can be used for columns with SQL types: "BYTES" and "GEOGRAPHY".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getLocalDateGets the value of column `position` for the current row as local date. Can be used for columns with SQL type "DATE".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getIntervalGets the value of column `position` for the current row as interval. Can be used for columns with SQL type "INTERVAL".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getLocalTimeGets the value of column `position` for the current row as local time. Can be used for columns with SQL type "TIME".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getLocalDateTimeGets the value of column `position` for the current row as local date time. Can be used for columns with SQL types "TIMESTAMP".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getZonedDateTimeGets the value of column `position` for the current row as a zoned date time in UTC. Can be used for columns with SQL type "TIMESTAMPTZ".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getOffsetDateTimeGets the value of column `position` for the current row as an offset date time in UTC. Can be used for columns with SQL type "TIMESTAMPTZ".- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value.
- Throws:
- HyperException- If the column has an incompatible type.
 
- 
getRawpublic byte[] getRaw(int position) Gets the value of column `position` for the current row as a raw value.- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value as raw value.
 
- 
getObjectGets the value of column `position` for the current row as Object.- Parameters:
- position- The column for which to retrieve the value.
- Returns:
- The value as Object.
- Throws:
- HyperException- If the column has an unsupported type.
 
 
-