Package org.h2.result
Class LazyResult
- java.lang.Object
-
- org.h2.result.FetchedResult
-
- org.h2.result.LazyResult
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,ResultInterface
- Direct Known Subclasses:
Select.LazyResultSelect
,SelectUnion.LazyResultUnion
public abstract class LazyResult extends FetchedResult
Lazy execution support for queries.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
closed
private Expression[]
expressions
private long
limit
private SessionLocal
session
-
Fields inherited from class org.h2.result.FetchedResult
afterLast, currentRow, nextRow, rowId
-
-
Constructor Summary
Constructors Constructor Description LazyResult(SessionLocal session, Expression[] expressions)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Close the result and delete any temporary filesprotected abstract Value[]
fetchNextRow()
Fetch next row or null if none available.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.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.boolean
hasNext()
Check if this result has more rows to fetch.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.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.void
setLimit(long limit)
boolean
skip()
Go to the next row and skip it.protected boolean
skipNextRow()
Skip next row.-
Methods inherited from class org.h2.result.FetchedResult
createShallowCopy, currentRow, getRowId, isAfterLast, needToClose, next
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.h2.result.ResultInterface
getVisibleColumnCount
-
-
-
-
Field Detail
-
session
private final SessionLocal session
-
expressions
private final Expression[] expressions
-
closed
private boolean closed
-
limit
private long limit
-
-
Constructor Detail
-
LazyResult
public LazyResult(SessionLocal session, Expression[] expressions)
-
-
Method Detail
-
setLimit
public void setLimit(long limit)
-
isLazy
public boolean isLazy()
Description copied from interface:ResultInterface
Check if this a lazy execution result.- Returns:
- true if it is a lazy result
-
reset
public void reset()
Description copied from interface:ResultInterface
Go to the beginning of the result, that means before the first row.
-
skip
public boolean skip()
Go to the next row and skip it.- Returns:
- true if a row exists
-
hasNext
public boolean hasNext()
Description copied from interface:ResultInterface
Check if this result has more rows to fetch.- Returns:
- true if it has
-
fetchNextRow
protected abstract Value[] fetchNextRow()
Fetch next row or null if none available.- Returns:
- next row or null
-
skipNextRow
protected boolean skipNextRow()
Skip next row.- Returns:
- true if next row was available
-
getRowCount
public long getRowCount()
Description copied from interface:ResultInterface
Get the number of rows in this object.- Returns:
- the number of rows
-
isClosed
public boolean isClosed()
Description copied from interface:ResultInterface
Check if this result set is closed.- Returns:
- true if it is
-
close
public void close()
Description copied from interface:ResultInterface
Close the result and delete any temporary files
-
getAlias
public java.lang.String getAlias(int i)
Description copied from interface:ResultInterface
Get the column alias name for the column.- Parameters:
i
- the column number (starting with 0)- Returns:
- the alias name
-
getSchemaName
public java.lang.String getSchemaName(int i)
Description copied from interface:ResultInterface
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
public java.lang.String getTableName(int i)
Description copied from interface:ResultInterface
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
public java.lang.String getColumnName(int i)
Description copied from interface:ResultInterface
Get the column name.- Parameters:
i
- the column number (starting with 0)- Returns:
- the column name
-
getColumnType
public TypeInfo getColumnType(int i)
Description copied from interface:ResultInterface
Get the column data type.- Parameters:
i
- the column number (starting with 0)- Returns:
- the column data type
-
isIdentity
public boolean isIdentity(int i)
Description copied from interface:ResultInterface
Check if this is an identity column.- Parameters:
i
- the column number (starting with 0)- Returns:
- true for identity columns
-
getNullable
public int getNullable(int i)
Description copied from interface:ResultInterface
Check if this column is nullable.- Parameters:
i
- the column number (starting with 0)- Returns:
- Column.NULLABLE_*
-
setFetchSize
public void setFetchSize(int fetchSize)
Description copied from interface:ResultInterface
Set the fetch size for this result set.- Parameters:
fetchSize
- the new fetch size
-
getFetchSize
public int getFetchSize()
Description copied from interface:ResultInterface
Get the current fetch size for this result set.- Returns:
- the fetch size
-
-