|
|||||||||
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.TableLink
public class TableLink
A linked table contains connection information for a table accessible by JDBC. The table may be stored in a different database.
Field Summary |
---|
Fields inherited from class org.h2.table.Table |
---|
columns, compareMode, EXTERNAL_TABLE_ENGINE, isHidden, 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 | |
---|---|
TableLink(Schema schema,
int id,
java.lang.String name,
java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String originalSchema,
java.lang.String originalTable,
boolean emitUpdates,
boolean force)
|
Method Summary | |
---|---|
Index |
addIndex(Session session,
java.lang.String indexName,
int indexId,
IndexColumn[] cols,
IndexType indexType,
boolean create,
java.lang.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 |
checkWritingAllowed()
Linked tables don't know if they are readonly. |
void |
close(Session session)
Close the table object and flush changes. |
TableLinkConnection |
getConnection()
|
java.lang.String |
getCreateSQL()
Build a SQL statement to re-create this object. |
Value |
getDefaultValue(Session session,
Column column)
Get or generate a default value for the given column. |
java.lang.String |
getDropSQL()
Build a SQL statement to drop this object. |
java.util.ArrayList<Index> |
getIndexes()
Get all indexes for this table. |
long |
getMaxDataModificationId()
Get the last data modification id. |
java.sql.PreparedStatement |
getPreparedStatement(java.lang.String sql,
boolean exclusive)
Get a prepared statement object for the given statement. |
java.lang.String |
getQualifiedTable()
|
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 |
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 |
isLockedExclusively()
Check if this table is locked exclusively. |
boolean |
isOracle()
|
void |
lock(Session session,
boolean exclusive,
boolean force)
Lock the table for the given session. |
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 |
reusePreparedStatement(java.sql.PreparedStatement prep,
java.lang.String sql)
Add this prepared statement to the list of cached statements. |
void |
setGlobalTemporary(boolean globalTemporary)
|
void |
setReadOnly(boolean readOnly)
|
void |
truncate(Session session)
Remove all rows from the table and indexes. |
void |
unlock(Session s)
Release the lock for this session. |
void |
updateRows(Prepared prepared,
Session session,
RowList rows)
Update a list of rows in this table. |
void |
validateConvertUpdateSequence(Session session,
Row row)
Convert the values if required. |
DbException |
wrapException(java.lang.String sql,
java.lang.Exception ex)
Wrap a SQL exception that occurred while accessing a linked table. |
Methods inherited from class org.h2.schema.SchemaObjectBase |
---|
getSchema, getSQL, initSchemaObjectBase |
Methods inherited from class org.h2.engine.DbObjectBase |
---|
getComment, getDatabase, 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, getId, getModificationId, getName, isTemporary, setComment, setModified, setTemporary |
Constructor Detail |
---|
public TableLink(Schema schema, int id, java.lang.String name, java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String originalSchema, java.lang.String originalTable, boolean emitUpdates, boolean force)
Method Detail |
---|
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 Index addIndex(Session session, java.lang.String indexName, int indexId, IndexColumn[] cols, IndexType indexType, boolean create, java.lang.String indexComment)
Table
addIndex
in class Table
session
- the sessionindexName
- the name of the indexindexId
- the idcols
- the index columnsindexType
- the index typecreate
- whether this is a new indexindexComment
- the comment
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 boolean isLockedExclusively()
Table
isLockedExclusively
in class Table
public Index getScanIndex(Session session)
Table
getScanIndex
in class Table
session
- the session
public void removeRow(Session session, Row row)
Table
removeRow
in class Table
session
- the sessionrow
- the rowpublic void addRow(Session session, Row row)
Table
addRow
in class Table
session
- the sessionrow
- the rowpublic void close(Session session)
Table
close
in class Table
session
- the sessionpublic long getRowCount(Session session)
Table
getRowCount
in class Table
session
- the session
public DbException wrapException(java.lang.String sql, java.lang.Exception ex)
sql
- the SQL statementex
- the exception from the remote database
public java.lang.String getQualifiedTable()
public java.sql.PreparedStatement getPreparedStatement(java.lang.String sql, boolean exclusive)
sql
- the SQL statementexclusive
- if the prepared statement must be removed from the map
until reusePreparedStatement is called (only required for queries)
public void unlock(Session s)
Table
unlock
in class Table
s
- the sessionpublic void checkRename()
DbObjectBase
checkRename
in interface DbObject
checkRename
in class DbObjectBase
public void checkSupportAlter()
Table
checkSupportAlter
in class Table
public void truncate(Session session)
Table
truncate
in class Table
session
- the sessionpublic 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)
DbObjectBase
removeChildrenAndResources
in interface DbObject
removeChildrenAndResources
in class Table
session
- the sessionpublic boolean isOracle()
public java.util.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 void updateRows(Prepared prepared, Session session, RowList rows)
Table
updateRows
in class Table
prepared
- the prepared statementsession
- the sessionrows
- a list of row pairs of the form old row, new row, old row,
new row,...public void setGlobalTemporary(boolean globalTemporary)
public void setReadOnly(boolean readOnly)
public TableLinkConnection getConnection()
public long getRowCountApproximation()
Table
getRowCountApproximation
in class Table
public void reusePreparedStatement(java.sql.PreparedStatement prep, java.lang.String sql)
prep
- the prepared statementsql
- the SQL statementpublic boolean isDeterministic()
Table
isDeterministic
in class Table
public void checkWritingAllowed()
checkWritingAllowed
in class Table
public void validateConvertUpdateSequence(Session session, Row row)
validateConvertUpdateSequence
in class Table
session
- the sessionrow
- the rowpublic Value getDefaultValue(Session session, Column column)
getDefaultValue
in class Table
session
- the sessioncolumn
- the column
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |