Package org.h2.mvstore.db
Class MVTempResult
java.lang.Object
org.h2.mvstore.db.MVTempResult
- All Implemented Interfaces:
ResultExternal
- Direct Known Subclasses:
MVPlainTempResult
,MVSortedTempResult
Temporary result.
A separate MVStore in a temporary file is used for each result. The file is
removed when this result and all its copies are closed.
TempFileDeleter
is also used to delete this file if results are not
closed properly.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
Count of child results.private final MVTempResult.CloseImpl
Closeable to close the storage.(package private) boolean
Whether this result is closed.private final Database
(package private) final Expression[]
Column expressions.private final Reference
<?> Reference to the record in the temporary file deleter.(package private) final MVTempResult
Parent store for copies.(package private) final int
Total count of columns.(package private) int
Count of rows.(package private) final MVStore
MVStore.private final TempFileDeleter
Temporary file deleter.(package private) final int
Count of visible columns. -
Constructor Summary
ConstructorsConstructorDescriptionMVTempResult
(Database database, Expression[] expressions, int visibleColumnCount, int resultColumnCount) Creates a new temporary result.MVTempResult
(MVTempResult parent) Creates a shallow copy of the result. -
Method Summary
Modifier and TypeMethodDescriptionint
addRows
(Collection<Value[]> rows) Add a number of rows to the result.void
close()
Close this object and delete the temporary file.private void
private void
delete()
static ResultExternal
of
(Database database, Expression[] expressions, boolean distinct, int[] distinctIndexes, int visibleColumnCount, int resultColumnCount, SortOrder sort) Creates MVStore-based temporary result.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.ResultExternal
addRow, contains, createShallowCopy, next, removeRow, reset
-
Field Details
-
database
-
store
MVStore. -
expressions
Column expressions. -
visibleColumnCount
final int visibleColumnCountCount of visible columns. -
resultColumnCount
final int resultColumnCountTotal count of columns. -
rowCount
int rowCountCount of rows. Used only in a root results, copies always have 0 value. -
parent
Parent store for copies. Ifnull
this result is a root result. -
childCount
int childCountCount of child results. -
closed
boolean closedWhether this result is closed. -
tempFileDeleter
Temporary file deleter. -
closeable
Closeable to close the storage. -
fileRef
Reference to the record in the temporary file deleter.
-
-
Constructor Details
-
MVTempResult
MVTempResult(MVTempResult parent) Creates a shallow copy of the result.- Parameters:
parent
- parent result
-
MVTempResult
MVTempResult(Database database, Expression[] expressions, int visibleColumnCount, int resultColumnCount) Creates a new temporary result.- Parameters:
database
- databaseexpressions
- column expressionsvisibleColumnCount
- count of visible columnsresultColumnCount
- total count of columns
-
-
Method Details
-
of
public static ResultExternal of(Database database, Expression[] expressions, boolean distinct, int[] distinctIndexes, int visibleColumnCount, int resultColumnCount, SortOrder sort) Creates MVStore-based temporary result.- Parameters:
database
- databaseexpressions
- expressionsdistinct
- is output distinctdistinctIndexes
- indexes of distinct columns for DISTINCT ON resultsvisibleColumnCount
- count of visible columnsresultColumnCount
- the number of columns including visible columns and additional virtual columns for ORDER BY and DISTINCT ON clausessort
- sort order, ornull
- Returns:
- temporary result
-
addRows
Description copied from interface:ResultExternal
Add a number of rows to the result.- Specified by:
addRows
in interfaceResultExternal
- Parameters:
rows
- the list of rows to add- Returns:
- the new number of rows in this object
-
close
public void close()Description copied from interface:ResultExternal
Close this object and delete the temporary file.- Specified by:
close
in interfaceResultExternal
-
closeChild
private void closeChild() -
delete
private void delete()
-