Class MySQLConnection
- java.lang.Object
-
- migratedb.core.internal.database.base.BaseConnection<MySQLDatabase>
-
- migratedb.core.internal.database.mysql.MySQLConnection
-
- All Implemented Interfaces:
AutoCloseable,Connection<MySQLDatabase>
- Direct Known Subclasses:
TiDBConnection
public class MySQLConnection extends BaseConnection<MySQLDatabase>
-
-
Field Summary
-
Fields inherited from class migratedb.core.internal.database.base.BaseConnection
database, jdbcTemplate, originalSchemaNameOrSearchPath
-
-
Constructor Summary
Constructors Constructor Description MySQLConnection(MySQLDatabase database, Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanUseNamedLockTemplate()voiddoChangeCurrentSchemaOrSearchPathTo(String schema)protected Schema<?,?>doGetCurrentSchema()protected voiddoRestoreOriginalState()protected StringgetCurrentSchemaNameOrSearchPath()Schema<?,?>getSchema(String name)Retrieves the schema with this name in the database.<T> Tlock(Table<?,?> table, Callable<T> callable)Locks this table and executes this callable.-
Methods inherited from class migratedb.core.internal.database.base.BaseConnection
changeCurrentSchemaTo, close, getCurrentSchema, getJdbcConnection, getJdbcTemplate, restoreOriginalState
-
-
-
-
Constructor Detail
-
MySQLConnection
public MySQLConnection(MySQLDatabase database, Connection connection)
-
-
Method Detail
-
doRestoreOriginalState
protected void doRestoreOriginalState() throws SQLException- Overrides:
doRestoreOriginalStatein classBaseConnection<MySQLDatabase>- Throws:
SQLException
-
getCurrentSchemaNameOrSearchPath
protected String getCurrentSchemaNameOrSearchPath() throws SQLException
- Specified by:
getCurrentSchemaNameOrSearchPathin classBaseConnection<MySQLDatabase>- Throws:
SQLException- when the current schema name or search path could not be retrieved.
-
doChangeCurrentSchemaOrSearchPathTo
public void doChangeCurrentSchemaOrSearchPathTo(String schema) throws SQLException
- Overrides:
doChangeCurrentSchemaOrSearchPathToin classBaseConnection<MySQLDatabase>- Parameters:
schema- The new current schema for this connection.- Throws:
SQLException- when the current schema could not be set.
-
doGetCurrentSchema
protected Schema<?,?> doGetCurrentSchema() throws SQLException
- Overrides:
doGetCurrentSchemain classBaseConnection<MySQLDatabase>- Throws:
SQLException
-
getSchema
public Schema<?,?> getSchema(String name)
Description copied from interface:ConnectionRetrieves the schema with this name in the database.
-
lock
public <T> T lock(Table<?,?> table, Callable<T> callable)
Description copied from interface:ConnectionLocks this table and executes this callable.- Specified by:
lockin interfaceConnection<MySQLDatabase>- Overrides:
lockin classBaseConnection<MySQLDatabase>- Returns:
- The result of the callable.
-
canUseNamedLockTemplate
protected boolean canUseNamedLockTemplate()
-
-