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) intCount of child results.private final MVTempResult.CloseImplCloseable to close the storage.(package private) booleanWhether 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 MVTempResultParent store for copies.(package private) final intTotal count of columns.(package private) intCount of rows.(package private) final MVStoreMVStore.private final TempFileDeleterTemporary file deleter.(package private) final intCount 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 TypeMethodDescriptionintaddRows(Collection<Value[]> rows) Add a number of rows to the result.voidclose()Close this object and delete the temporary file.private voidprivate voiddelete()static ResultExternalof(Database database, Expression[] expressions, boolean distinct, int[] distinctIndexes, int visibleColumnCount, int resultColumnCount, SortOrder sort) Creates MVStore-based temporary result.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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. Ifnullthis 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:ResultExternalAdd a number of rows to the result.- Specified by:
addRowsin 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:ResultExternalClose this object and delete the temporary file.- Specified by:
closein interfaceResultExternal
-
closeChild
private void closeChild() -
delete
private void delete()
-