Package org.h2.result
Class ResultWithPaddedStrings
java.lang.Object
org.h2.result.ResultWithPaddedStrings
- All Implemented Interfaces:
AutoCloseable
,ResultInterface
Result with padded fixed length strings.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Creates new instance of result. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the result and delete any temporary filescreateShallowCopy
(Session targetSession) Create a shallow copy of the result set.Value[]
Get the current row.static ResultInterface
get
(ResultInterface source) Returns wrapped result if necessary, or original result if it does not contain visible CHAR columns.getAlias
(int i) Get the column alias name for the column.getColumnName
(int i) Get the column name.getColumnType
(int i) Get the column data type.int
Get the current fetch size for this result set.int
getNullable
(int i) Check if this column is nullable.long
Get the number of rows in this object.long
getRowId()
Get the current row id, starting with 0.getSchemaName
(int i) Get the schema name for the column, if one exists.getTableName
(int i) Get the table name for the column, if one exists.int
Get the number of visible columns.boolean
hasNext()
Check if this result has more rows to fetch.boolean
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
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.private static String
rightPadWithSpaces
(String s, int length) void
setFetchSize
(int fetchSize) Set the fetch size for this result set.
-
Field Details
-
source
-
-
Constructor Details
-
ResultWithPaddedStrings
Creates new instance of result.- Parameters:
source
- the source result
-
-
Method Details
-
get
Returns wrapped result if necessary, or original result if it does not contain visible CHAR columns.- Parameters:
source
- source result- Returns:
- wrapped result or original result
-
reset
public void reset()Description copied from interface:ResultInterface
Go to the beginning of the result, that means before the first row.- Specified by:
reset
in interfaceResultInterface
-
currentRow
Description copied from interface:ResultInterface
Get the current row.- Specified by:
currentRow
in interfaceResultInterface
- Returns:
- the row
-
rightPadWithSpaces
-
next
public boolean next()Description copied from interface:ResultInterface
Go to the next row.- Specified by:
next
in interfaceResultInterface
- Returns:
- true if a row exists
-
getRowId
public long getRowId()Description copied from interface:ResultInterface
Get the current row id, starting with 0. -1 is returned when next() was not called yet.- Specified by:
getRowId
in interfaceResultInterface
- Returns:
- the row id
-
isAfterLast
public boolean isAfterLast()Description copied from interface:ResultInterface
Check if the current position is after last row.- Specified by:
isAfterLast
in interfaceResultInterface
- Returns:
- true if after last
-
getVisibleColumnCount
public int getVisibleColumnCount()Description copied from interface:ResultInterface
Get the number of visible columns. More columns may exist internally for sorting or grouping.- Specified by:
getVisibleColumnCount
in interfaceResultInterface
- Returns:
- the number of columns
-
getRowCount
public long getRowCount()Description copied from interface:ResultInterface
Get the number of rows in this object.- Specified by:
getRowCount
in interfaceResultInterface
- Returns:
- the number of rows
-
hasNext
public boolean hasNext()Description copied from interface:ResultInterface
Check if this result has more rows to fetch.- Specified by:
hasNext
in interfaceResultInterface
- Returns:
- true if it has
-
needToClose
public boolean needToClose()Description copied from interface:ResultInterface
Check if this result set should be closed, for example because it is buffered using a temporary file.- Specified by:
needToClose
in interfaceResultInterface
- Returns:
- true if close should be called.
-
close
public void close()Description copied from interface:ResultInterface
Close the result and delete any temporary files- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceResultInterface
-
getAlias
Description copied from interface:ResultInterface
Get the column alias name for the column.- Specified by:
getAlias
in interfaceResultInterface
- Parameters:
i
- the column number (starting with 0)- Returns:
- the alias name
-
getSchemaName
Description copied from interface:ResultInterface
Get the schema name for the column, if one exists.- Specified by:
getSchemaName
in interfaceResultInterface
- Parameters:
i
- the column number (starting with 0)- Returns:
- the schema name or null
-
getTableName
Description copied from interface:ResultInterface
Get the table name for the column, if one exists.- Specified by:
getTableName
in interfaceResultInterface
- Parameters:
i
- the column number (starting with 0)- Returns:
- the table name or null
-
getColumnName
Description copied from interface:ResultInterface
Get the column name.- Specified by:
getColumnName
in interfaceResultInterface
- Parameters:
i
- the column number (starting with 0)- Returns:
- the column name
-
getColumnType
Description copied from interface:ResultInterface
Get the column data type.- Specified by:
getColumnType
in interfaceResultInterface
- 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.- Specified by:
isIdentity
in interfaceResultInterface
- 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.- Specified by:
getNullable
in interfaceResultInterface
- 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.- Specified by:
setFetchSize
in interfaceResultInterface
- Parameters:
fetchSize
- the new fetch size
-
getFetchSize
public int getFetchSize()Description copied from interface:ResultInterface
Get the current fetch size for this result set.- Specified by:
getFetchSize
in interfaceResultInterface
- Returns:
- the fetch size
-
isLazy
public boolean isLazy()Description copied from interface:ResultInterface
Check if this a lazy execution result.- Specified by:
isLazy
in interfaceResultInterface
- Returns:
- true if it is a lazy result
-
isClosed
public boolean isClosed()Description copied from interface:ResultInterface
Check if this result set is closed.- Specified by:
isClosed
in interfaceResultInterface
- Returns:
- true if it is
-
createShallowCopy
Description copied from interface:ResultInterface
Create a shallow copy of the result set. The data and a temporary table (if there is any) is not copied.- Specified by:
createShallowCopy
in interfaceResultInterface
- Parameters:
targetSession
- the session of the copy- Returns:
- the copy if possible, or null if copying is not possible
-