Top Description Inners Fields Constructors Methods
org.h2.result

public Class SimpleResult

extends Object
implements ResultInterface, ResultTarget
Class Inheritance
All Implemented Interfaces
org.h2.result.ResultTarget, org.h2.result.ResultInterface, java.lang.AutoCloseable
Imports
java.sql.ResultSetMetaData, java.util.ArrayList, .Comparator, org.h2.engine.Session, org.h2.util.Utils, org.h2.value.TypeInfo, .Value

Simple in-memory result.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
SimpleResult.Column

Column info for the simple result.

Field Summary

Modifier and TypeField and Description
private final ArrayList<SimpleResult.Column>
private int
private final ArrayList<Value[]>
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
SimpleResult()

Creates new instance of simple result.

public
SimpleResult(String
the name of the schema
schemaName
,
String
the name of the table
tableName
)

Creates new instance of simple result.

private
SimpleResult(ArrayList<SimpleResult.Column> columns, ArrayList<Value[]> rows, String schemaName, String tableName)

Method Summary

Modifier and TypeMethod and Description
public void
addColumn(String
Column's alias.
alias
,
String
Column's name.
columnName
,
int
Column's value type.
columnType
,
long
Column's precision.
columnPrecision
,
int
Column's scale.
columnScale
)

Add column to the result.

public void
addColumn(String
Column's name.
columnName
,
TypeInfo
Column's type.
columnType
)

Add column to the result.

public void
addColumn(String
Column's alias.
alias
,
String
Column's name.
columnName
,
TypeInfo
Column's type.
columnType
)

Add column to the result.

pack-priv void
addColumn(SimpleResult.Column
Column info.
column
)

Add column to the result.

public void
addRow(Value...
the values
values
)

Implements org.h2.result.ResultTarget.addRow.

Add the row to the result set.

public void
close()

Implements org.h2.result.ResultInterface.close.

Close the result and delete any temporary files

public SimpleResult
createShallowCopy(Session
the session of the copy
targetSession
)

Implements org.h2.result.ResultInterface.createShallowCopy.

Create a shallow copy of the result set.

public Value[]
currentRow()

Implements org.h2.result.ResultInterface.currentRow.

Get the current row.

public String
getAlias(int
the column number (starting with 0)
i
)

Implements org.h2.result.ResultInterface.getAlias.

Get the column alias name for the column.

public String
getColumnName(int
the column number (starting with 0)
i
)

Implements org.h2.result.ResultInterface.getColumnName.

Get the column name.

public TypeInfo
getColumnType(int
the column number (starting with 0)
i
)

Implements org.h2.result.ResultInterface.getColumnType.

Get the column data type.

public int
getFetchSize()

Implements org.h2.result.ResultInterface.getFetchSize.

Get the current fetch size for this result set.

public int
getNullable(int
the column number (starting with 0)
i
)

Implements org.h2.result.ResultInterface.getNullable.

Check if this column is nullable.

public long
public long
getRowId()

Implements org.h2.result.ResultInterface.getRowId.

Get the current row id, starting with 0.

public String
getSchemaName(int
the column number (starting with 0)
i
)

Implements org.h2.result.ResultInterface.getSchemaName.

Get the schema name for the column, if one exists.

public String
getTableName(int
the column number (starting with 0)
i
)

Implements org.h2.result.ResultInterface.getTableName.

Get the table name for the column, if one exists.

public int
getVisibleColumnCount()

Implements org.h2.result.ResultInterface.getVisibleColumnCount.

Get the number of visible columns.

public boolean
hasNext()

Implements org.h2.result.ResultInterface.hasNext.

Check if this result has more rows to fetch.

public boolean
isAfterLast()

Implements org.h2.result.ResultInterface.isAfterLast.

Check if the current position is after last row.

public boolean
isClosed()

Implements org.h2.result.ResultInterface.isClosed.

Check if this result set is closed.

public boolean
isIdentity(int
the column number (starting with 0)
i
)

Implements org.h2.result.ResultInterface.isIdentity.

Check if this is an identity column.

public boolean
isLazy()

Implements org.h2.result.ResultInterface.isLazy.

Check if this a lazy execution result.

public void
limitsWereApplied()

Implements org.h2.result.ResultTarget.limitsWereApplied.

A hint that sorting, offset and limit may be ignored by this result because they were applied during the query.

public boolean
needToClose()

Implements org.h2.result.ResultInterface.needToClose.

Check if this result set should be closed, for example because it is buffered using a temporary file.

public boolean
next()

Implements org.h2.result.ResultInterface.next.

Go to the next row.

public void
reset()

Implements org.h2.result.ResultInterface.reset.

Go to the beginning of the result, that means before the first row.

public void
setFetchSize(int
the new fetch size
fetchSize
)

Implements org.h2.result.ResultInterface.setFetchSize.

Set the fetch size for this result set.

public void
sortRows(Comparator<? super Value[]>
the comparator
comparator
)

Sort rows in the list.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnsback to summary
private final ArrayList<SimpleResult.Column> columns
rowIdback to summary
private int rowId
rowsback to summary
private final ArrayList<Value[]> rows
schemaNameback to summary
private final String schemaName
tableNameback to summary
private final String tableName

Constructor Detail

SimpleResultback to summary
public SimpleResult()

Creates new instance of simple result.

SimpleResultback to summary
public SimpleResult(String schemaName, String tableName)

Creates new instance of simple result.

Parameters
schemaName:String

the name of the schema

tableName:String

the name of the table

SimpleResultback to summary
private SimpleResult(ArrayList<SimpleResult.Column> columns, ArrayList<Value[]> rows, String schemaName, String tableName)

Method Detail

addColumnback to summary
public void addColumn(String alias, String columnName, int columnType, long columnPrecision, int columnScale)

Add column to the result.

Parameters
alias:String

Column's alias.

columnName:String

Column's name.

columnType:int

Column's value type.

columnPrecision:long

Column's precision.

columnScale:int

Column's scale.

addColumnback to summary
public void addColumn(String columnName, TypeInfo columnType)

Add column to the result.

Parameters
columnName:String

Column's name.

columnType:TypeInfo

Column's type.

addColumnback to summary
public void addColumn(String alias, String columnName, TypeInfo columnType)

Add column to the result.

Parameters
alias:String

Column's alias.

columnName:String

Column's name.

columnType:TypeInfo

Column's type.

addColumnback to summary
pack-priv void addColumn(SimpleResult.Column column)

Add column to the result.

Parameters
column:SimpleResult.Column

Column info.

addRowback to summary
public void addRow(Value... values)

Implements org.h2.result.ResultTarget.addRow.

Doc from org.h2.result.ResultTarget.addRow.

Add the row to the result set.

Parameters
values:Value[]

the values

Annotations
@Override
closeback to summary
public void close()

Implements org.h2.result.ResultInterface.close.

Doc from org.h2.result.ResultInterface.close.

Close the result and delete any temporary files

Annotations
@Override
createShallowCopyback to summary
public SimpleResult createShallowCopy(Session targetSession)

Implements org.h2.result.ResultInterface.createShallowCopy.

Doc from org.h2.result.ResultInterface.createShallowCopy.

Create a shallow copy of the result set. The data and a temporary table (if there is any) is not copied.

Parameters
targetSession:Session

the session of the copy

Returns:SimpleResult

the copy if possible, or null if copying is not possible

Annotations
@Override
currentRowback to summary
public Value[] currentRow()

Implements org.h2.result.ResultInterface.currentRow.

Doc from org.h2.result.ResultInterface.currentRow.

Get the current row.

Returns:Value[]

the row

Annotations
@Override
getAliasback to summary
public String getAlias(int i)

Implements org.h2.result.ResultInterface.getAlias.

Doc from org.h2.result.ResultInterface.getAlias.

Get the column alias name for the column.

Parameters
i:int

the column number (starting with 0)

Returns:String

the alias name

Annotations
@Override
getColumnNameback to summary
public String getColumnName(int i)

Implements org.h2.result.ResultInterface.getColumnName.

Doc from org.h2.result.ResultInterface.getColumnName.

Get the column name.

Parameters
i:int

the column number (starting with 0)

Returns:String

the column name

Annotations
@Override
getColumnTypeback to summary
public TypeInfo getColumnType(int i)

Implements org.h2.result.ResultInterface.getColumnType.

Doc from org.h2.result.ResultInterface.getColumnType.

Get the column data type.

Parameters
i:int

the column number (starting with 0)

Returns:TypeInfo

the column data type

Annotations
@Override
getFetchSizeback to summary
public int getFetchSize()

Implements org.h2.result.ResultInterface.getFetchSize.

Doc from org.h2.result.ResultInterface.getFetchSize.

Get the current fetch size for this result set.

Returns:int

the fetch size

Annotations
@Override
getNullableback to summary
public int getNullable(int i)

Implements org.h2.result.ResultInterface.getNullable.

Doc from org.h2.result.ResultInterface.getNullable.

Check if this column is nullable.

Parameters
i:int

the column number (starting with 0)

Returns:int

Column.NULLABLE_*

Annotations
@Override
getRowCountback to summary
public long getRowCount()

Implements org.h2.result.ResultInterface.getRowCount, org.h2.result.ResultTarget.getRowCount.

Doc from org.h2.result.ResultInterface.getRowCount.

Get the number of rows in this object.

Returns:long

the number of rows

Annotations
@Override
getRowIdback to summary
public long getRowId()

Implements org.h2.result.ResultInterface.getRowId.

Doc from org.h2.result.ResultInterface.getRowId.

Get the current row id, starting with 0. -1 is returned when next() was not called yet.

Returns:long

the row id

Annotations
@Override
getSchemaNameback to summary
public String getSchemaName(int i)

Implements org.h2.result.ResultInterface.getSchemaName.

Doc from org.h2.result.ResultInterface.getSchemaName.

Get the schema name for the column, if one exists.

Parameters
i:int

the column number (starting with 0)

Returns:String

the schema name or null

Annotations
@Override
getTableNameback to summary
public String getTableName(int i)

Implements org.h2.result.ResultInterface.getTableName.

Doc from org.h2.result.ResultInterface.getTableName.

Get the table name for the column, if one exists.

Parameters
i:int

the column number (starting with 0)

Returns:String

the table name or null

Annotations
@Override
getVisibleColumnCountback to summary
public int getVisibleColumnCount()

Implements org.h2.result.ResultInterface.getVisibleColumnCount.

Doc from org.h2.result.ResultInterface.getVisibleColumnCount.

Get the number of visible columns. More columns may exist internally for sorting or grouping.

Returns:int

the number of columns

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements org.h2.result.ResultInterface.hasNext.

Doc from org.h2.result.ResultInterface.hasNext.

Check if this result has more rows to fetch.

Returns:boolean

true if it has

Annotations
@Override
isAfterLastback to summary
public boolean isAfterLast()

Implements org.h2.result.ResultInterface.isAfterLast.

Doc from org.h2.result.ResultInterface.isAfterLast.

Check if the current position is after last row.

Returns:boolean

true if after last

Annotations
@Override
isClosedback to summary
public boolean isClosed()

Implements org.h2.result.ResultInterface.isClosed.

Doc from org.h2.result.ResultInterface.isClosed.

Check if this result set is closed.

Returns:boolean

true if it is

Annotations
@Override
isIdentityback to summary
public boolean isIdentity(int i)

Implements org.h2.result.ResultInterface.isIdentity.

Doc from org.h2.result.ResultInterface.isIdentity.

Check if this is an identity column.

Parameters
i:int

the column number (starting with 0)

Returns:boolean

true for identity columns

Annotations
@Override
isLazyback to summary
public boolean isLazy()

Implements org.h2.result.ResultInterface.isLazy.

Doc from org.h2.result.ResultInterface.isLazy.

Check if this a lazy execution result.

Returns:boolean

true if it is a lazy result

Annotations
@Override
limitsWereAppliedback to summary
public void limitsWereApplied()

Implements org.h2.result.ResultTarget.limitsWereApplied.

Doc from org.h2.result.ResultTarget.limitsWereApplied.

A hint that sorting, offset and limit may be ignored by this result because they were applied during the query. This is useful for WITH TIES clause because result may contain tied rows above limit.

Annotations
@Override
needToCloseback to summary
public boolean needToClose()

Implements org.h2.result.ResultInterface.needToClose.

Doc from org.h2.result.ResultInterface.needToClose.

Check if this result set should be closed, for example because it is buffered using a temporary file.

Returns:boolean

true if close should be called.

Annotations
@Override
nextback to summary
public boolean next()

Implements org.h2.result.ResultInterface.next.

Doc from org.h2.result.ResultInterface.next.

Go to the next row.

Returns:boolean

true if a row exists

Annotations
@Override
resetback to summary
public void reset()

Implements org.h2.result.ResultInterface.reset.

Doc from org.h2.result.ResultInterface.reset.

Go to the beginning of the result, that means before the first row.

Annotations
@Override
setFetchSizeback to summary
public void setFetchSize(int fetchSize)

Implements org.h2.result.ResultInterface.setFetchSize.

Doc from org.h2.result.ResultInterface.setFetchSize.

Set the fetch size for this result set.

Parameters
fetchSize:int

the new fetch size

Annotations
@Override
sortRowsback to summary
public void sortRows(Comparator<? super Value[]> comparator)

Sort rows in the list.

Parameters
comparator:Comparator<? super Value[]>

the comparator

org.h2.result back to summary

pack-priv final Class SimpleResult.Column

extends Object
Class Inheritance

Column info for the simple result.

Field Summary

Modifier and TypeField and Description
pack-priv final String
alias

Column alias.

pack-priv final String
columnName

Column name.

pack-priv final TypeInfo
columnType

Column type.

Constructor Summary

AccessConstructor and Description
pack-priv
Column(String alias, String columnName, TypeInfo columnType)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

aliasback to summary
pack-priv final String alias

Column alias.

columnNameback to summary
pack-priv final String columnName

Column name.

columnTypeback to summary
pack-priv final TypeInfo columnType

Column type.

Constructor Detail

Columnback to summary
pack-priv Column(String alias, String columnName, TypeInfo columnType)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override