Top Description Fields Constructors Methods
org.h2.table

public abstract Class MetaTable

extends Table
Class Inheritance
Known Direct Subclasses
org.h2.mode.PgCatalogTable, org.h2.table.InformationSchemaTable, org.h2.table.InformationSchemaTableLegacy
Imports
java.util.ArrayList, .Objects, java.util.stream.Stream, org.h2.constraint.Constraint, org.h2.engine.SessionLocal, org.h2.index.Index, .IndexType, .MetaIndex, org.h2.message.DbException, org.h2.result.Row, .SearchRow, org.h2.schema.Schema, org.h2.util.StringUtils, org.h2.value.TypeInfo, .Value, .ValueNull, .ValueVarchar, .ValueVarcharIgnoreCase

This class is responsible to build the database meta data pseudo tables.

Field Summary

Modifier and TypeField and Description
protected int
indexColumn

The indexed column.

protected MetaIndex
metaIndex

The index for this table.

public static final long
ROW_COUNT_APPROXIMATION

The approximate number of rows of a meta table.

protected final int
type

The table type.

Inherited from org.h2.table.Table:
columnscompareModeEXCLUSIVE_LOCKREAD_LOCKTYPE_CACHEDTYPE_MEMORYWRITE_LOCK

Constructor Summary

AccessConstructor and Description
protected
MetaTable(Schema
the schema
schema
,
int
the object id
id
,
int
the meta table type
type
)

Create a new metadata table.

Method Summary

Modifier and TypeMethod and Description
protected final void
add(SessionLocal
the session
session
,
ArrayList<Row>
the original row list
rows
,
Object...
the values, or strings
stringsOrValues
)

Add a row to a list.

public final Index
addIndex(SessionLocal
the session
session
,
String
the name of the index
indexName
,
int
the id
indexId
,
IndexColumn[]
the index columns
cols
,
int
the count of unique columns
uniqueColumnCount
,
IndexType
the index type
indexType
,
boolean
whether this is a new index
create
,
String
the comment
indexComment
)

Implements abstract org.h2.table.Table.addIndex.

Create an index for this table

public final void
addRow(SessionLocal
the session
session
,
Row
the row
row
)

Implements abstract org.h2.table.Table.addRow.

Add a row to the table and all indexes.

public final boolean
canDrop()

Implements abstract org.h2.table.Table.canDrop.

Check if this table can be dropped.

public boolean
canGetRowCount(SessionLocal
the session
session
)

Implements abstract org.h2.table.Table.canGetRowCount.

Check if the row count can be retrieved quickly.

public final boolean
canReference()

Overrides org.h2.table.Table.canReference.

Check if this table can be referenced.

protected final boolean

Returns:

whether row should be included into result
checkIndex
(SessionLocal
the session
session
,
String
the value
value
,
Value
the lower bound of value, or null
indexFrom
,
Value
the higher bound of value, or null
indexTo
)

Checks index conditions.

public final void
checkRename()

Overrides org.h2.engine.DbObject.checkRename.

Check if renaming is allowed.

public final void
checkSupportAlter()

Implements abstract org.h2.table.Table.checkSupportAlter.

Check if this table supports ALTER TABLE.

public final void
close(SessionLocal
the session
session
)

Implements abstract org.h2.table.Table.close.

Close the table object and flush changes.

pack-priv final Column

Returns:

the column
column
(String
the uppercase column name
name
)

Creates a column with the specified name and character string data type.

protected final Column

Returns:

the column
column
(String
the uppercase column name
name
,
TypeInfo
the data type
type
)

Creates a column with the specified name and data type.

public abstract ArrayList<Row>

Returns:

the generated rows
generateRows
(SessionLocal
the session
session
,
SearchRow
the first row to return
first
,
SearchRow
the last row to return
last
)

Generate the data for the given metadata table using the given first and last row filters.

protected final Stream<Constraint>

Returns:

the stream of constraints
getAllConstraints
(SessionLocal
the session
session
)

Get all constraints of this database, including constraints of local temporary tables for the session.

protected final Stream<Table>

Returns:

the stream of tables
getAllTables
(SessionLocal
the session
session
,
Value
first value or null
indexFrom
,
Value
last value or null
indexTo
)

Get all tables of this database, including local temporary tables for the session.

public final String
getCreateSQL()

Implements abstract org.h2.engine.DbObject.getCreateSQL.

Construct the CREATE ...

public final ArrayList<Index>
getIndexes()

Implements abstract org.h2.table.Table.getIndexes.

Get all indexes for this table.

public long
getRowCount(SessionLocal
the session
session
)

Implements abstract org.h2.table.Table.getRowCount.

Get the row count for this table.

public long
getRowCountApproximation(SessionLocal
the session
session
)

Implements abstract org.h2.table.Table.getRowCountApproximation.

Get the approximated row count for this table.

public final Index
getScanIndex(SessionLocal
the session
session
)

Implements abstract org.h2.table.Table.getScanIndex.

Get the scan index to iterate through all rows.

public final TableType
getTableType()

Implements abstract org.h2.table.Table.getTableType.

Get the table type name

protected final String

Returns:

the converted identifier
identifier
(String
the identifier to convert
s
)

If needed, convert the identifier to lower case.

public final boolean
isDeterministic()

Implements abstract org.h2.table.Table.isDeterministic.

Check if the table is deterministic.

public boolean
isInsertable()

Overrides org.h2.table.Table.isInsertable.

Returns whether this table is insertable.

public final void
removeChildrenAndResources(SessionLocal
the session
session
)

Overrides org.h2.table.Table.removeChildrenAndResources.

Delete all dependent children objects and resources of this object.

public final void
removeRow(SessionLocal
the session
session
,
Row
the row
row
)

Implements abstract org.h2.table.Table.removeRow.

Remove a row from the table and all indexes.

protected final void
public final long
truncate(SessionLocal
the session
session
)

Implements abstract org.h2.table.Table.truncate.

Remove all rows from the table and indexes.

Inherited from org.h2.table.Table:
addConstraintaddDependenciesaddDependentMaterializedViewaddDependentViewaddSequenceaddSynonymaddTriggercanTruncatecheckDeadlockcheckWritingAllowedcompareValuesconvertInsertRowconvertUpdateRowcreateRowdoesColumnExistdropMultipleColumnsConstraintsAndIndexesfindColumnfindPrimaryKeyfirefireAfterRowfireBeforeRowfireRowgetBestPlanItemgetCheckForeignKeyConstraintsgetChildrengetColumngetColumngetColumngetColumnsgetCompareModegetConstraintsgetDependentMaterializedViewsgetDependentViewsgetDiskSpaceUsedgetIdentityColumngetIndexgetIndexForColumngetMainIndexColumngetMaxDataModificationIdgetNullRowgetOnCommitDropgetOnCommitTruncategetPrimaryKeygetRowgetRowFactorygetRowIdColumngetScanIndexgetSQLTableTypegetTemplateRowgetTemplateSimpleRowgetTriggersgetTypegetVisibleColumnshasSelectTriggerisGlobalTemporaryisLockedExclusivelyisLockedExclusivelyByisPersistDataisPersistIndexesisQueryComparableisRowLockableisViewlocklockRowremoveColumnExpressionsDependenciesremoveConstraintremoveDependentMaterializedViewremoveDependentViewremoveIndexremoveIndexOrTransferOwnershipremoveSequenceremoveSynonymremoveTriggerrenamerenameColumnsetCheckForeignKeyConstraintssetColumnssetOnCommitDropsetOnCommitTruncateunlockupdateRowupdateRows

Field Detail

indexColumnback to summary
protected int indexColumn

The indexed column.

metaIndexback to summary
protected MetaIndex metaIndex

The index for this table.

ROW_COUNT_APPROXIMATIONback to summary
public static final long ROW_COUNT_APPROXIMATION

The approximate number of rows of a meta table.

typeback to summary
protected final int type

The table type.

Constructor Detail

MetaTableback to summary
protected MetaTable(Schema schema, int id, int type)

Create a new metadata table.

Parameters
schema:Schema

the schema

id:int

the object id

type:int

the meta table type

Method Detail

addback to summary
protected final void add(SessionLocal session, ArrayList<Row> rows, Object... stringsOrValues)

Add a row to a list.

Parameters
session:SessionLocal

the session

rows:ArrayList<Row>

the original row list

stringsOrValues:Object[]

the values, or strings

addIndexback to summary
public final Index addIndex(SessionLocal session, String indexName, int indexId, IndexColumn[] cols, int uniqueColumnCount, IndexType indexType, boolean create, String indexComment)

Implements abstract org.h2.table.Table.addIndex.

Doc from org.h2.table.Table.addIndex.

Create an index for this table

Parameters
session:SessionLocal

the session

indexName:String

the name of the index

indexId:int

the id

cols:IndexColumn[]

the index columns

uniqueColumnCount:int

the count of unique columns

indexType:IndexType

the index type

create:boolean

whether this is a new index

indexComment:String

the comment

Returns:Index

the index

Annotations
@Override
addRowback to summary
public final void addRow(SessionLocal session, Row row)

Implements abstract org.h2.table.Table.addRow.

Doc from org.h2.table.Table.addRow.

Add a row to the table and all indexes.

Parameters
session:SessionLocal

the session

row:Row

the row

Annotations
@Override
canDropback to summary
public final boolean canDrop()

Implements abstract org.h2.table.Table.canDrop.

Doc from org.h2.table.Table.canDrop.

Check if this table can be dropped.

Returns:boolean

true if it can

Annotations
@Override
canGetRowCountback to summary
public boolean canGetRowCount(SessionLocal session)

Implements abstract org.h2.table.Table.canGetRowCount.

Doc from org.h2.table.Table.canGetRowCount.

Check if the row count can be retrieved quickly.

Parameters
session:SessionLocal

the session

Returns:boolean

true if it can

Annotations
@Override
canReferenceback to summary
public final boolean canReference()

Overrides org.h2.table.Table.canReference.

Doc from org.h2.table.Table.canReference.

Check if this table can be referenced.

Returns:boolean

true if it can

Annotations
@Override
checkIndexback to summary
protected final boolean checkIndex(SessionLocal session, String value, Value indexFrom, Value indexTo)

Checks index conditions.

Parameters
session:SessionLocal

the session

value:String

the value

indexFrom:Value

the lower bound of value, or null

indexTo:Value

the higher bound of value, or null

Returns:boolean

whether row should be included into result

checkRenameback to summary
public final void checkRename()

Overrides org.h2.engine.DbObject.checkRename.

Doc from org.h2.engine.DbObject.checkRename.

Check if renaming is allowed. Does nothing when allowed.

Annotations
@Override
checkSupportAlterback to summary
public final void checkSupportAlter()

Implements abstract org.h2.table.Table.checkSupportAlter.

Doc from org.h2.table.Table.checkSupportAlter.

Check if this table supports ALTER TABLE.

Annotations
@Override
closeback to summary
public final void close(SessionLocal session)

Implements abstract org.h2.table.Table.close.

Doc from org.h2.table.Table.close.

Close the table object and flush changes.

Parameters
session:SessionLocal

the session

Annotations
@Override
columnback to summary
pack-priv final Column column(String name)

Creates a column with the specified name and character string data type.

Parameters
name:String

the uppercase column name

Returns:Column

the column

columnback to summary
protected final Column column(String name, TypeInfo type)

Creates a column with the specified name and data type.

Parameters
name:String

the uppercase column name

type:TypeInfo

the data type

Returns:Column

the column

generateRowsback to summary
public abstract ArrayList<Row> generateRows(SessionLocal session, SearchRow first, SearchRow last)

Generate the data for the given metadata table using the given first and last row filters.

Parameters
session:SessionLocal

the session

first:SearchRow

the first row to return

last:SearchRow

the last row to return

Returns:ArrayList<Row>

the generated rows

getAllConstraintsback to summary
protected final Stream<Constraint> getAllConstraints(SessionLocal session)

Get all constraints of this database, including constraints of local temporary tables for the session.

Parameters
session:SessionLocal

the session

Returns:Stream<Constraint>

the stream of constraints

getAllTablesback to summary
protected final Stream<Table> getAllTables(SessionLocal session, Value indexFrom, Value indexTo)

Get all tables of this database, including local temporary tables for the session.

Parameters
session:SessionLocal

the session

indexFrom:Value

first value or null

indexTo:Value

last value or null

Returns:Stream<Table>

the stream of tables

getCreateSQLback to summary
public final String getCreateSQL()

Implements abstract org.h2.engine.DbObject.getCreateSQL.

Doc from org.h2.engine.DbObject.getCreateSQL.

Construct the CREATE ... SQL statement for this object.

Returns:String

the SQL statement

Annotations
@Override
getIndexesback to summary
public final ArrayList<Index> getIndexes()

Implements abstract org.h2.table.Table.getIndexes.

Doc from org.h2.table.Table.getIndexes.

Get all indexes for this table.

Returns:ArrayList<Index>

the list of indexes

Annotations
@Override
getRowCountback to summary
public long getRowCount(SessionLocal session)

Implements abstract org.h2.table.Table.getRowCount.

Doc from org.h2.table.Table.getRowCount.

Get the row count for this table.

Parameters
session:SessionLocal

the session

Returns:long

the row count

Annotations
@Override
getRowCountApproximationback to summary
public long getRowCountApproximation(SessionLocal session)

Implements abstract org.h2.table.Table.getRowCountApproximation.

Doc from org.h2.table.Table.getRowCountApproximation.

Get the approximated row count for this table.

Parameters
session:SessionLocal

the session

Returns:long

the approximated row count

Annotations
@Override
getScanIndexback to summary
public final Index getScanIndex(SessionLocal session)

Implements abstract org.h2.table.Table.getScanIndex.

Doc from org.h2.table.Table.getScanIndex.

Get the scan index to iterate through all rows.

Parameters
session:SessionLocal

the session

Returns:Index

the index

Annotations
@Override
getTableTypeback to summary
public final TableType getTableType()

Implements abstract org.h2.table.Table.getTableType.

Doc from org.h2.table.Table.getTableType.

Get the table type name

Returns:TableType

the table type name

Annotations
@Override
identifierback to summary
protected final String identifier(String s)

If needed, convert the identifier to lower case.

Parameters
s:String

the identifier to convert

Returns:String

the converted identifier

isDeterministicback to summary
public final boolean isDeterministic()

Implements abstract org.h2.table.Table.isDeterministic.

Doc from org.h2.table.Table.isDeterministic.

Check if the table is deterministic.

Returns:boolean

true if it is

Annotations
@Override
isInsertableback to summary
public boolean isInsertable()

Overrides org.h2.table.Table.isInsertable.

Doc from org.h2.table.Table.isInsertable.

Returns whether this table is insertable.

Returns:boolean

whether this table is insertable

Annotations
@Override
removeChildrenAndResourcesback to summary
public final void removeChildrenAndResources(SessionLocal session)

Overrides org.h2.table.Table.removeChildrenAndResources.

Doc from org.h2.engine.DbObject.removeChildrenAndResources.

Delete all dependent children objects and resources of this object.

Parameters
session:SessionLocal

the session

Annotations
@Override
removeRowback to summary
public final void removeRow(SessionLocal session, Row row)

Implements abstract org.h2.table.Table.removeRow.

Doc from org.h2.table.Table.removeRow.

Remove a row from the table and all indexes.

Parameters
session:SessionLocal

the session

row:Row

the row

Annotations
@Override
setMetaTableNameback to summary
protected final void setMetaTableName(String upperName)
truncateback to summary
public final long truncate(SessionLocal session)

Implements abstract org.h2.table.Table.truncate.

Doc from org.h2.table.Table.truncate.

Remove all rows from the table and indexes.

Parameters
session:SessionLocal

the session

Returns:long

number of removed rows, possibly including uncommitted rows

Annotations
@Override