Class MySQLSession
- java.lang.Object
-
- migratedb.v1.core.internal.database.base.BaseSession
-
- migratedb.v1.core.internal.database.mysql.MySQLSession
-
- All Implemented Interfaces:
AutoCloseable,Session
- Direct Known Subclasses:
TiDBSession
public class MySQLSession extends BaseSession
-
-
Field Summary
-
Fields inherited from class migratedb.v1.core.internal.database.base.BaseSession
jdbcTemplate, originalSchemaNameOrSearchPath
-
-
Constructor Summary
Constructors Constructor Description MySQLSession(MySQLDatabase database, Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanUseNamedLockTemplate()voiddoChangeCurrentSchemaOrSearchPathTo(String schema)protected SchemadoGetCurrentSchema()protected voiddoRestoreOriginalState()protected StringgetCurrentSchemaNameOrSearchPath()MySQLDatabasegetDatabase()SchemagetSchema(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.v1.core.internal.database.base.BaseSession
changeCurrentSchemaTo, close, getCurrentSchema, getJdbcConnection, getJdbcTemplate, restoreOriginalState
-
-
-
-
Constructor Detail
-
MySQLSession
public MySQLSession(MySQLDatabase database, Connection connection)
-
-
Method Detail
-
getDatabase
public MySQLDatabase getDatabase()
- Overrides:
getDatabasein classBaseSession
-
doRestoreOriginalState
protected void doRestoreOriginalState() throws SQLException- Overrides:
doRestoreOriginalStatein classBaseSession- Throws:
SQLException
-
getCurrentSchemaNameOrSearchPath
protected String getCurrentSchemaNameOrSearchPath() throws SQLException
- Specified by:
getCurrentSchemaNameOrSearchPathin classBaseSession- Throws:
SQLException- when the current schema name or search path could not be retrieved.
-
doChangeCurrentSchemaOrSearchPathTo
public void doChangeCurrentSchemaOrSearchPathTo(String schema) throws SQLException
- Overrides:
doChangeCurrentSchemaOrSearchPathToin classBaseSession- 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 classBaseSession- Throws:
SQLException
-
getSchema
public Schema getSchema(String name)
Description copied from interface:SessionRetrieves the schema with this name in the database.
-
lock
public <T> T lock(Table table, Callable<T> callable)
Description copied from interface:SessionLocks this table and executes this callable.- Specified by:
lockin interfaceSession- Overrides:
lockin classBaseSession- Returns:
- The result of the callable.
-
canUseNamedLockTemplate
protected boolean canUseNamedLockTemplate()
-
-