java.lang.Object
migratedb.v1.core.internal.database.base.BaseSchemaObject<D,S>
migratedb.v1.core.internal.database.base.BaseTable<D,S>
- All Implemented Interfaces:
SchemaObject<D,,S> Table<D,S>
- Direct Known Subclasses:
BigQueryTable,CockroachDBTable,DB2Table,DerbyTable,FirebirdTable,H2Table,HSQLDBTable,IgniteThinTable,InformixTable,MySQLTable,OracleTable,PostgreSQLTable,RedshiftTable,SAPHANATable,SnowflakeTable,SpannerTable,SQLiteTable,SQLServerTable,SybaseASETable
public abstract class BaseTable<D extends Database<?>,S extends Schema<?,?>>
extends BaseSchemaObject<D,S>
implements Table<D,S>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intKeeps track of the locks on a table since calls to lock the table can be nested.Fields inherited from class migratedb.v1.core.internal.database.base.BaseSchemaObject
database, jdbcTemplate, name, schema -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleandoExists()Checks whether this table exists.protected abstract voiddoLock()Locks this table in this schema using a read/write pessimistic lock until the end of the current transaction.protected voiddoUnlock()For databases that require an explicit unlocking, not an implicit end-of-transaction one.booleanexists()protected booleanChecks whether the database contains a table matching the given criteria.voidlock()Locks this table in this schema using a read/write pessimistic lock until the end of the current transaction.voidunlock()For databases that require an explicit unlocking, not an implicit end-of-transaction one.Methods inherited from class migratedb.v1.core.internal.database.base.BaseSchemaObject
doDrop, drop, getDatabase, getName, getSchema, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface migratedb.v1.core.api.internal.database.base.SchemaObject
drop, getDatabase, getName, getSchema, toString
-
Field Details
-
lockDepth
protected int lockDepthKeeps track of the locks on a table since calls to lock the table can be nested.
-
-
Constructor Details
-
BaseTable
- Parameters:
jdbcTemplate- The JDBC template for communicating with the DB.database- The database-specific support.schema- The schema this table lives in.name- The name of the table.
-
-
Method Details
-
exists
public boolean exists() -
doExists
Checks whether this table exists.- Throws:
SQLException- when the check failed.
-
exists
protected boolean exists(Schema<?, ?> catalog, Schema<?, throws SQLException?> schema, String table, String... tableTypes) Checks whether the database contains a table matching the given criteria.- Parameters:
catalog- The catalog where the table resides. (optional)schema- The schema where the table resides. (optional)table- The name of the table. (optional)tableTypes- The types of table to look for (e.g. TABLE). (optional)- Throws:
SQLException- when the check failed.
-
lock
public void lock()Description copied from interface:TableLocks this table in this schema using a read/write pessimistic lock until the end of the current transaction. Note thatunlock()still needs to be called even if your database unlocks the table implicitly (in which casedoUnlock()may be a no-op) in order to maintain the lock count correctly. -
doLock
Locks this table in this schema using a read/write pessimistic lock until the end of the current transaction. Note thatunlock()still needs to be called even if your database unlocks the table implicitly (in which casedoUnlock()may be a no-op) in order to maintain the lock count correctly.- Throws:
SQLException- when this table in this schema could not be locked.
-
unlock
public void unlock()Description copied from interface:TableFor databases that require an explicit unlocking, not an implicit end-of-transaction one. -
doUnlock
For databases that require an explicit unlocking, not an implicit end-of-transaction one.- Throws:
SQLException- when this table in this schema could not be unlocked.
-