com.github.mengweijin.flyway.database.dm.DmConnection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of db-migration Show documentation
Show all versions of db-migration Show documentation
Flyway、Liquibase 扩展支持达梦(DM)数据库、南大通用(GBase 8s)数据库。
package com.github.mengweijin.flyway.database.dm;
import org.flywaydb.core.internal.database.base.Connection;
import org.flywaydb.core.internal.database.base.Schema;
import java.sql.SQLException;
/**
* @author mengweijin
*/
public class DmConnection extends Connection {
DmConnection(DmDatabase database, java.sql.Connection connection) {
super(database, connection);
}
@Override
protected String getCurrentSchemaNameOrSearchPath() throws SQLException {
return jdbcTemplate.queryForString("SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') FROM DUAL");
}
@Override
public void doChangeCurrentSchemaOrSearchPathTo(String schema) throws SQLException {
jdbcTemplate.execute("ALTER SESSION SET CURRENT_SCHEMA=" + database.quote(schema));
}
@Override
public Schema getSchema(String name) {
return new DmSchema(jdbcTemplate, database, name);
}
}