public class TableView extends Table
columns, compareMode, EXTERNAL_TABLE_ENGINE, isHidden, SYSTEM_TABLE, TABLE, TABLE_LINK, TYPE_CACHED, TYPE_MEMORY, VIEW
comment, database, trace
AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE
Constructor and Description |
---|
TableView(Schema schema,
int id,
String name,
String querySQL,
ArrayList<Parameter> params,
String[] columnNames,
Session session,
boolean recursive) |
Modifier and Type | Method and Description |
---|---|
Index |
addIndex(Session session,
String indexName,
int indexId,
IndexColumn[] cols,
IndexType indexType,
boolean create,
String indexComment)
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,
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.
|
String |
getCreateSQL()
Build a SQL statement to re-create this object.
|
String |
getCreateSQL(boolean orReplace,
boolean force)
Generate "CREATE" SQL statement for the view.
|
String |
getCreateSQLForCopy(Table table,
String quotedName)
Build a SQL statement to re-create the object, or to create a copy of the
object with a different name or referencing a different table
|
String |
getDropSQL()
Build a SQL statement to drop this object.
|
ArrayList<Index> |
getIndexes()
Get all indexes for this table.
|
long |
getMaxDataModificationId()
Get the last data modification id.
|
User |
getOwner() |
int |
getParameterOffset() |
String |
getQuery() |
ResultInterface |
getRecursiveResult() |
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.
|
String |
getSQL()
Get the SQL name of this object (may be quoted).
|
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.
|
boolean |
isTableExpression() |
void |
lock(Session session,
boolean exclusive,
boolean force)
Lock the table for the given session.
|
DbException |
recompile(Session session,
boolean force)
Re-compile the view query and all views that depend on this object.
|
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 |
replace(String querySQL,
String[] columnNames,
Session session,
boolean recursive,
boolean force)
Try to replace the SQL statement of the view and re-compile this and all
dependent views.
|
void |
setRecursiveResult(LocalResult value) |
void |
setTableExpression(boolean tableExpression) |
void |
truncate(Session session)
Remove all rows from the table and indexes.
|
void |
unlock(Session s)
Release the lock for this session.
|
addConstraint, addDependencies, addSequence, addTrigger, addView, canReference, canTruncate, checkDeadlock, checkWritingAllowed, commit, compareTypeSave, doesColumnExist, dropSingleColumnConstraintsAndIndexes, findPrimaryKey, fire, fireAfterRow, fireBeforeRow, fireRow, getCheckForeignKeyConstraints, getChildren, getColumn, getColumn, getColumns, getCompareMode, getConstraints, getDefaultValue, getIndexForColumn, getOnCommitDrop, getOnCommitTruncate, getPrimaryKey, getRowIdColumn, getTemplateRow, getTemplateSimpleRow, getType, getViews, hasSelectTrigger, isGlobalTemporary, isHidden, isLockedExclusivelyBy, isPersistData, isPersistIndexes, removeConstraint, removeIndex, removeIndexOrTransferOwnership, removeSequence, removeTrigger, removeView, rename, renameColumn, setCheckForeignKeyConstraints, setColumns, setHidden, setOnCommitDrop, setOnCommitTruncate, updateRows, validateConvertUpdateSequence
getSchema, initSchemaObjectBase
getComment, getDatabase, getId, getModificationId, getName, initDbObjectBase, invalidate, isTemporary, setComment, setModified, setObjectName, setTemporary, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComment, getDatabase, getId, getName, isTemporary, setComment, setTemporary
public void replace(String querySQL, String[] columnNames, Session session, boolean recursive, boolean force)
querySQL
- the SQL statementcolumnNames
- the column namessession
- the sessionrecursive
- whether this is a recursive viewforce
- if errors should be ignoredpublic DbException recompile(Session session, boolean force)
session
- the sessionforce
- if exceptions should be ignoredpublic boolean isInvalid()
public PlanItem getBestPlanItem(Session session, int[] masks)
Table
getBestPlanItem
in class Table
session
- the sessionmasks
- null means 'always false'public String getDropSQL()
DbObjectBase
getDropSQL
in interface DbObject
getDropSQL
in class DbObjectBase
public String getCreateSQLForCopy(Table table, String quotedName)
DbObject
getCreateSQLForCopy
in interface DbObject
getCreateSQLForCopy
in class Table
table
- the new tablequotedName
- the quoted namepublic String getCreateSQL()
DbObjectBase
getCreateSQL
in interface DbObject
getCreateSQL
in class DbObjectBase
public String getCreateSQL(boolean orReplace, boolean force)
orReplace
- if true, then include the OR REPLACE clauseforce
- if true, then include the FORCE clausepublic void checkRename()
DbObjectBase
checkRename
in interface DbObject
checkRename
in class DbObjectBase
public void lock(Session session, boolean exclusive, boolean force)
Table
public void close(Session session)
Table
public void unlock(Session s)
Table
public boolean isLockedExclusively()
Table
isLockedExclusively
in class Table
public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType, boolean create, String indexComment)
Table
public void removeRow(Session session, Row row)
Table
public void addRow(Session session, Row row)
Table
public void checkSupportAlter()
Table
checkSupportAlter
in class Table
public void truncate(Session session)
Table
public long getRowCount(Session session)
Table
getRowCount
in class Table
session
- the sessionpublic boolean canGetRowCount()
Table
canGetRowCount
in class Table
public boolean canDrop()
Table
public String getTableType()
Table
getTableType
in class Table
public void removeChildrenAndResources(Session session)
DbObjectBase
removeChildrenAndResources
in interface DbObject
removeChildrenAndResources
in class Table
session
- the sessionpublic String getSQL()
DbObject
getSQL
in interface DbObject
getSQL
in class SchemaObjectBase
public String getQuery()
public Index getScanIndex(Session session)
Table
getScanIndex
in class Table
session
- the sessionpublic ArrayList<Index> getIndexes()
Table
getIndexes
in class Table
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, String name, Query query, Query topQuery)
session
- the sessionowner
- the owner of the queryname
- the view namequery
- the querytopQuery
- the top level querypublic long getRowCountApproximation()
Table
getRowCountApproximation
in class Table
public int getParameterOffset()
public boolean isDeterministic()
Table
isDeterministic
in class Table
public void setRecursiveResult(LocalResult value)
public ResultInterface getRecursiveResult()
public void setTableExpression(boolean tableExpression)
public boolean isTableExpression()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.