|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.engine.DbObjectBase
org.h2.schema.SchemaObjectBase
org.h2.table.Table
org.h2.table.TableView
public class TableView
A view is a virtual table that is defined by a query.
Field Summary |
---|
Fields inherited from class org.h2.table.Table |
---|
columns, compareMode, memoryPerRow, SYSTEM_TABLE, TABLE, TABLE_LINK, TYPE_CACHED, TYPE_MEMORY, VIEW |
Fields inherited from class org.h2.engine.DbObjectBase |
---|
comment, database, trace |
Fields inherited from interface org.h2.engine.DbObject |
---|
AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE |
Constructor Summary | |
---|---|
TableView(Schema schema,
int id,
java.lang.String name,
java.lang.String querySQL,
ObjectArray<Parameter> params,
java.lang.String[] columnNames,
Session session,
boolean recursive)
|
Method Summary | |
---|---|
Index |
addIndex(Session session,
java.lang.String indexName,
int indexId,
IndexColumn[] cols,
IndexType indexType,
int headPos,
java.lang.String comment)
Create an index for this table |
void |
addRow(Session session,
Row row)
Add a row to the table and all indexes. |
boolean |
canDrop()
Check if this table can be dropped. |
boolean |
canGetRowCount()
Check if the row count can be retrieved quickly. |
void |
checkRename()
Check if this object can be renamed. |
void |
checkSupportAlter()
Check if this table supports ALTER TABLE. |
void |
close(Session session)
Close the table object and flush changes. |
static TableView |
createTempView(Session session,
User owner,
java.lang.String name,
Query query,
Query topQuery)
Create a temporary view out of the given query. |
PlanItem |
getBestPlanItem(Session session,
int[] masks)
Get the best plan for the given search mask. |
java.lang.String |
getCreateSQL()
Build a SQL statement to re-create this object. |
java.lang.String |
getDropSQL()
Build a SQL statement to drop this object. |
ObjectArray<Index> |
getIndexes()
Get all indexes for this table. |
long |
getMaxDataModificationId()
Get the last data modification id. |
User |
getOwner()
|
int |
getParameterOffset()
|
long |
getRowCount(Session session)
Get the row count for this table. |
long |
getRowCountApproximation()
Get the approximated row count for this table. |
Index |
getScanIndex(Session session)
Get the scan index to iterate through all rows. |
java.lang.String |
getSQL()
Get the SQL name of this object (may be quoted). |
java.lang.String |
getTableType()
Get the table type name |
Index |
getUniqueIndex()
Get any unique index for this table if one exists. |
boolean |
isDeterministic()
Check if the table is deterministic. |
boolean |
isInvalid()
Check if this view is currently invalid. |
boolean |
isLockedExclusively()
Check if this table is locked exclusively. |
void |
lock(Session session,
boolean exclusive,
boolean force)
Lock the table for the given session. |
void |
recompile(Session session)
Re-compile the view query. |
Query |
recompileQuery(Session session)
Re-compile the query, updating the SQL statement. |
void |
removeChildrenAndResources(Session session)
Remove all dependent objects and free all resources (files, blocks in files) of this object. |
void |
removeRow(Session session,
Row row)
Remove a row from the table and all indexes. |
void |
truncate(Session session)
Remove all rows from the table and indexes. |
void |
unlock(Session s)
Release the lock for this session. |
Methods inherited from class org.h2.schema.SchemaObjectBase |
---|
getSchema, initSchemaObjectBase |
Methods inherited from class org.h2.engine.DbObjectBase |
---|
getComment, getDatabase, getHeadPos, getId, getModificationId, getName, initDbObjectBase, invalidate, isTemporary, setComment, setModified, setObjectName, setTemporary, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.h2.engine.DbObject |
---|
getComment, getDatabase, getHeadPos, getId, getModificationId, getName, isTemporary, setComment, setModified, setTemporary |
Constructor Detail |
---|
public TableView(Schema schema, int id, java.lang.String name, java.lang.String querySQL, ObjectArray<Parameter> params, java.lang.String[] columnNames, Session session, boolean recursive) throws java.sql.SQLException
java.sql.SQLException
Method Detail |
---|
public Query recompileQuery(Session session) throws java.sql.SQLException
session
- the session
java.sql.SQLException
public boolean isInvalid()
public PlanItem getBestPlanItem(Session session, int[] masks) throws java.sql.SQLException
Table
getBestPlanItem
in class Table
session
- the sessionmasks
- null means 'always false'
java.sql.SQLException
public java.lang.String getDropSQL()
DbObjectBase
getDropSQL
in interface DbObject
getDropSQL
in class DbObjectBase
public java.lang.String getCreateSQL()
DbObjectBase
getCreateSQL
in interface DbObject
getCreateSQL
in class DbObjectBase
public void checkRename()
DbObjectBase
checkRename
in interface DbObject
checkRename
in class DbObjectBase
public void lock(Session session, boolean exclusive, boolean force)
Table
lock
in class Table
session
- the sessionexclusive
- true for write locks, false for read locksforce
- lock even in the MVCC modepublic void close(Session session)
Table
close
in class Table
session
- the sessionpublic void unlock(Session s)
Table
unlock
in class Table
s
- the sessionpublic boolean isLockedExclusively()
Table
isLockedExclusively
in class Table
public Index addIndex(Session session, java.lang.String indexName, int indexId, IndexColumn[] cols, IndexType indexType, int headPos, java.lang.String comment) throws java.sql.SQLException
Table
addIndex
in class Table
session
- the sessionindexName
- the name of the indexindexId
- the idcols
- the index columnsindexType
- the index typeheadPos
- the position of the head (if the index already exists)comment
- the comment
java.sql.SQLException
public void removeRow(Session session, Row row) throws java.sql.SQLException
Table
removeRow
in class Table
session
- the sessionrow
- the row
java.sql.SQLException
public void addRow(Session session, Row row) throws java.sql.SQLException
Table
addRow
in class Table
session
- the sessionrow
- the row
java.sql.SQLException
- if a constraint was violatedpublic void checkSupportAlter() throws java.sql.SQLException
Table
checkSupportAlter
in class Table
java.sql.SQLException
- if it is not supportedpublic void truncate(Session session) throws java.sql.SQLException
Table
truncate
in class Table
session
- the session
java.sql.SQLException
public long getRowCount(Session session)
Table
getRowCount
in class Table
session
- the session
public boolean canGetRowCount()
Table
canGetRowCount
in class Table
public boolean canDrop()
Table
canDrop
in class Table
public java.lang.String getTableType()
Table
getTableType
in class Table
public void removeChildrenAndResources(Session session) throws java.sql.SQLException
DbObjectBase
removeChildrenAndResources
in interface DbObject
removeChildrenAndResources
in class Table
session
- the session
java.sql.SQLException
public java.lang.String getSQL()
DbObject
getSQL
in interface DbObject
getSQL
in class SchemaObjectBase
public Index getScanIndex(Session session) throws java.sql.SQLException
Table
getScanIndex
in class Table
session
- the session
java.sql.SQLException
public ObjectArray<Index> getIndexes()
Table
getIndexes
in class Table
public void recompile(Session session) throws java.sql.SQLException
session
- the session
java.sql.SQLException
public long getMaxDataModificationId()
Table
getMaxDataModificationId
in class Table
public Index getUniqueIndex()
Table
getUniqueIndex
in class Table
public User getOwner()
public static TableView createTempView(Session session, User owner, java.lang.String name, Query query, Query topQuery) throws java.sql.SQLException
session
- the sessionowner
- the owner of the queryname
- the view namequery
- the querytopQuery
- the top level query
java.sql.SQLException
public long getRowCountApproximation()
Table
getRowCountApproximation
in class Table
public int getParameterOffset()
public boolean isDeterministic()
Table
isDeterministic
in class Table
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |