Top Description Inners Fields Constructors Methods
org.h2.mvstore.db

public abstract Class MVTempResult

extends Object
implements ResultExternal
Class Inheritance
All Implemented Interfaces
org.h2.result.ResultExternal
Known Direct Subclasses
org.h2.mvstore.db.MVPlainTempResult, org.h2.mvstore.db.MVSortedTempResult
Imports
java.io.IOException, java.lang.ref.Reference, java.util.Collection, org.h2.engine.Constants, .Database, org.h2.expression.Expression, org.h2.message.DbException, org.h2.mvstore.FileStore, .MVStore, org.h2.result.ResultExternal, .SortOrder, org.h2.store.fs.FileUtils, org.h2.util.TempFileDeleter, org.h2.value.Value

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 and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
pack-priv int
childCount

Count of child results.

private final MVTempResult.CloseImpl
closeable

Closeable to close the storage.

pack-priv boolean
closed

Whether this result is closed.

private final Database
pack-priv final Expression[]
expressions

Column expressions.

private final Reference<?>
fileRef

Reference to the record in the temporary file deleter.

pack-priv final MVTempResult
parent

Parent store for copies.

pack-priv final int
resultColumnCount

Total count of columns.

pack-priv int
rowCount

Count of rows.

pack-priv final MVStore
store

MVStore.

private final TempFileDeleter
tempFileDeleter

Temporary file deleter.

pack-priv final int
visibleColumnCount

Count of visible columns.

Constructor Summary

AccessConstructor and Description
pack-priv
MVTempResult(MVTempResult
parent result
parent
)

Creates a shallow copy of the result.

pack-priv
MVTempResult(Database
database
database
,
Expression[]
column expressions
expressions
,
int
count of visible columns
visibleColumnCount
,
int
total count of columns
resultColumnCount
)

Creates a new temporary result.

Method Summary

Modifier and TypeMethod and Description
public int
addRows(Collection<Value[]>
the list of rows to add
rows
)

Implements org.h2.result.ResultExternal.addRows.

Add a number of rows to the result.

public synchronized void
close()

Implements org.h2.result.ResultExternal.close.

Close this object and delete the temporary file.

private synchronized void
private void
public static ResultExternal

Returns:

temporary result
of
(Database
database
database
,
Expression[]
expressions
expressions
,
boolean
is output distinct
distinct
,
int[]
indexes of distinct columns for DISTINCT ON results
distinctIndexes
,
int
count of visible columns
visibleColumnCount
,
int
the number of columns including visible columns and additional virtual columns for ORDER BY and DISTINCT ON clauses
resultColumnCount
,
SortOrder
sort order, or null
sort
)

Creates MVStore-based temporary result.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

childCountback to summary
pack-priv int childCount

Count of child results.

closeableback to summary
private final MVTempResult.CloseImpl closeable

Closeable to close the storage.

closedback to summary
pack-priv boolean closed

Whether this result is closed.

databaseback to summary
private final Database database
expressionsback to summary
pack-priv final Expression[] expressions

Column expressions.

fileRefback to summary
private final Reference<?> fileRef

Reference to the record in the temporary file deleter.

parentback to summary
pack-priv final MVTempResult parent

Parent store for copies. If null this result is a root result.

resultColumnCountback to summary
pack-priv final int resultColumnCount

Total count of columns.

rowCountback to summary
pack-priv int rowCount

Count of rows. Used only in a root results, copies always have 0 value.

storeback to summary
pack-priv final MVStore store

MVStore.

tempFileDeleterback to summary
private final TempFileDeleter tempFileDeleter

Temporary file deleter.

visibleColumnCountback to summary
pack-priv final int visibleColumnCount

Count of visible columns.

Constructor Detail

MVTempResultback to summary
pack-priv MVTempResult(MVTempResult parent)

Creates a shallow copy of the result.

Parameters
parent:MVTempResult

parent result

MVTempResultback to summary
pack-priv MVTempResult(Database database, Expression[] expressions, int visibleColumnCount, int resultColumnCount)

Creates a new temporary result.

Parameters
database:Database

database

expressions:Expression[]

column expressions

visibleColumnCount:int

count of visible columns

resultColumnCount:int

total count of columns

Method Detail

addRowsback to summary
public int addRows(Collection<Value[]> rows)

Implements org.h2.result.ResultExternal.addRows.

Doc from org.h2.result.ResultExternal.addRows.

Add a number of rows to the result.

Parameters
rows:Collection<Value[]>

the list of rows to add

Returns:int

the new number of rows in this object

Annotations
@Override
closeback to summary
public synchronized void close()

Implements org.h2.result.ResultExternal.close.

Doc from org.h2.result.ResultExternal.close.

Close this object and delete the temporary file.

Annotations
@Override
closeChildback to summary
private synchronized void closeChild()
deleteback to summary
private void delete()
ofback to summary
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:Database

database

expressions:Expression[]

expressions

distinct:boolean

is output distinct

distinctIndexes:int[]

indexes of distinct columns for DISTINCT ON results

visibleColumnCount:int

count of visible columns

resultColumnCount:int

the number of columns including visible columns and additional virtual columns for ORDER BY and DISTINCT ON clauses

sort:SortOrder

sort order, or null

Returns:ResultExternal

temporary result

org.h2.mvstore.db back to summary

private final Class MVTempResult.CloseImpl

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable

Field Summary

Modifier and TypeField and Description
private final String
fileName

File name.

private final MVStore
store

MVStore.

Constructor Summary

AccessConstructor and Description
pack-priv
CloseImpl(MVStore store, String fileName)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fileNameback to summary
private final String fileName

File name.

storeback to summary
private final MVStore store

MVStore.

Constructor Detail

CloseImplback to summary
pack-priv CloseImpl(MVStore store, String fileName)

Method Detail

closeback to summary
public void close() throws Exception

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
Exceptions
Exception:
if this resource cannot be closed