Package org.h2.result
Interface ResultInterface
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
FetchedResult
,LazyResult
,LocalResult
,ResultRemote
,ResultWithPaddedStrings
,Select.LazyResultGroupSorted
,Select.LazyResultQueryFlat
,Select.LazyResultSelect
,SelectUnion.LazyResultUnion
,SimpleResult
public interface ResultInterface extends java.lang.AutoCloseable
The result interface is used by the LocalResult and ResultRemote class. A result may contain rows, or just an update count.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close the result and delete any temporary filesResultInterface
createShallowCopy(Session targetSession)
Create a shallow copy of the result set.Value[]
currentRow()
Get the current row.java.lang.String
getAlias(int i)
Get the column alias name for the column.java.lang.String
getColumnName(int i)
Get the column name.TypeInfo
getColumnType(int i)
Get the column data type.int
getFetchSize()
Get the current fetch size for this result set.int
getNullable(int i)
Check if this column is nullable.long
getRowCount()
Get the number of rows in this object.long
getRowId()
Get the current row id, starting with 0.java.lang.String
getSchemaName(int i)
Get the schema name for the column, if one exists.java.lang.String
getTableName(int i)
Get the table name for the column, if one exists.int
getVisibleColumnCount()
Get the number of visible columns.boolean
hasNext()
Check if this result has more rows to fetch.boolean
isAfterLast()
Check if the current position is after last row.boolean
isClosed()
Check if this result set is closed.boolean
isIdentity(int i)
Check if this is an identity column.boolean
isLazy()
Check if this a lazy execution result.boolean
needToClose()
Check if this result set should be closed, for example because it is buffered using a temporary file.boolean
next()
Go to the next row.void
reset()
Go to the beginning of the result, that means before the first row.void
setFetchSize(int fetchSize)
Set the fetch size for this result set.
-
-
-
Method Detail
-
reset
void reset()
Go to the beginning of the result, that means before the first row.
-
currentRow
Value[] currentRow()
Get the current row.- Returns:
- the row
-
next
boolean next()
Go to the next row.- Returns:
- true if a row exists
-
getRowId
long getRowId()
Get the current row id, starting with 0. -1 is returned when next() was not called yet.- Returns:
- the row id
-
isAfterLast
boolean isAfterLast()
Check if the current position is after last row.- Returns:
- true if after last
-
getVisibleColumnCount
int getVisibleColumnCount()
Get the number of visible columns. More columns may exist internally for sorting or grouping.- Returns:
- the number of columns
-
getRowCount
long getRowCount()
Get the number of rows in this object.- Returns:
- the number of rows
-
hasNext
boolean hasNext()
Check if this result has more rows to fetch.- Returns:
- true if it has
-
needToClose
boolean needToClose()
Check if this result set should be closed, for example because it is buffered using a temporary file.- Returns:
- true if close should be called.
-
close
void close()
Close the result and delete any temporary files- Specified by:
close
in interfacejava.lang.AutoCloseable
-
getAlias
java.lang.String getAlias(int i)
Get the column alias name for the column.- Parameters:
i
- the column number (starting with 0)- Returns:
- the alias name
-
getSchemaName
java.lang.String getSchemaName(int i)
Get the schema name for the column, if one exists.- Parameters:
i
- the column number (starting with 0)- Returns:
- the schema name or null
-
getTableName
java.lang.String getTableName(int i)
Get the table name for the column, if one exists.- Parameters:
i
- the column number (starting with 0)- Returns:
- the table name or null
-
getColumnName
java.lang.String getColumnName(int i)
Get the column name.- Parameters:
i
- the column number (starting with 0)- Returns:
- the column name
-
getColumnType
TypeInfo getColumnType(int i)
Get the column data type.- Parameters:
i
- the column number (starting with 0)- Returns:
- the column data type
-
isIdentity
boolean isIdentity(int i)
Check if this is an identity column.- Parameters:
i
- the column number (starting with 0)- Returns:
- true for identity columns
-
getNullable
int getNullable(int i)
Check if this column is nullable.- Parameters:
i
- the column number (starting with 0)- Returns:
- Column.NULLABLE_*
-
setFetchSize
void setFetchSize(int fetchSize)
Set the fetch size for this result set.- Parameters:
fetchSize
- the new fetch size
-
getFetchSize
int getFetchSize()
Get the current fetch size for this result set.- Returns:
- the fetch size
-
isLazy
boolean isLazy()
Check if this a lazy execution result.- Returns:
- true if it is a lazy result
-
isClosed
boolean isClosed()
Check if this result set is closed.- Returns:
- true if it is
-
createShallowCopy
ResultInterface createShallowCopy(Session targetSession)
Create a shallow copy of the result set. The data and a temporary table (if there is any) is not copied.- Parameters:
targetSession
- the session of the copy- Returns:
- the copy if possible, or null if copying is not possible
-
-