Class PostgreSQLConnection
- java.lang.Object
-
- migratedb.core.internal.database.base.BaseConnection<PostgreSQLDatabase>
-
- migratedb.core.internal.database.postgresql.PostgreSQLConnection
-
- All Implemented Interfaces:
AutoCloseable,Connection<PostgreSQLDatabase>
- Direct Known Subclasses:
YugabyteDBConnection
public class PostgreSQLConnection extends BaseConnection<PostgreSQLDatabase>
PostgreSQL connection.
-
-
Field Summary
-
Fields inherited from class migratedb.core.internal.database.base.BaseConnection
database, jdbcTemplate, originalSchemaNameOrSearchPath
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPostgreSQLConnection(Configuration configuration, PostgreSQLDatabase database, Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeCurrentSchemaTo(Schema<?,?> schema)voiddoChangeCurrentSchemaOrSearchPathTo(String schema)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
close, getCurrentSchema, getJdbcConnection, getJdbcTemplate, restoreOriginalState
-
-
-
-
Constructor Detail
-
PostgreSQLConnection
protected PostgreSQLConnection(Configuration configuration, PostgreSQLDatabase database, Connection connection)
-
-
Method Detail
-
doRestoreOriginalState
protected void doRestoreOriginalState() throws SQLException- Overrides:
doRestoreOriginalStatein classBaseConnection<PostgreSQLDatabase>- Throws:
SQLException
-
doGetCurrentSchema
public Schema<?,?> doGetCurrentSchema() throws SQLException
- Overrides:
doGetCurrentSchemain classBaseConnection<PostgreSQLDatabase>- Throws:
SQLException
-
getCurrentSchemaNameOrSearchPath
protected String getCurrentSchemaNameOrSearchPath() throws SQLException
- Specified by:
getCurrentSchemaNameOrSearchPathin classBaseConnection<PostgreSQLDatabase>- Throws:
SQLException- when the current schema name or search path could not be retrieved.
-
changeCurrentSchemaTo
public void changeCurrentSchemaTo(Schema<?,?> schema)
- Specified by:
changeCurrentSchemaToin interfaceConnection<PostgreSQLDatabase>- Overrides:
changeCurrentSchemaToin classBaseConnection<PostgreSQLDatabase>
-
doChangeCurrentSchemaOrSearchPathTo
public void doChangeCurrentSchemaOrSearchPathTo(String schema) throws SQLException
- Overrides:
doChangeCurrentSchemaOrSearchPathToin classBaseConnection<PostgreSQLDatabase>- Parameters:
schema- The new current schema for this connection.- Throws:
SQLException- when the current schema could not be set.
-
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<PostgreSQLDatabase>- Overrides:
lockin classBaseConnection<PostgreSQLDatabase>- Returns:
- The result of the callable.
-
-