• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DbSupportFactory类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.flywaydb.core.internal.dbsupport.DbSupportFactory的典型用法代码示例。如果您正苦于以下问题:Java DbSupportFactory类的具体用法?Java DbSupportFactory怎么用?Java DbSupportFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DbSupportFactory类属于org.flywaydb.core.internal.dbsupport包,在下文中一共展示了DbSupportFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

点赞 2

import org.flywaydb.core.internal.dbsupport.DbSupportFactory; //导入依赖的package包/类
@Override
public Map<String, String> init() throws SchemaInitializationException {
  final Map<String, String> initResult = new HashMap<>();
  try (final Connection conn = dataSource.getConnection()) {
    final Flyway flyway = new Flyway();
    flyway.setDataSource(dataSource);
    flyway.setLocations(locations);
    flyway.setClassLoader(Thread.currentThread().getContextClassLoader());
    final DbSupport dbSupport = DbSupportFactory.createDbSupport(conn, true);
    final MetaDataTable mt =
        new MetaDataTableImpl(
            dbSupport,
            dbSupport.getOriginalSchema().getTable(flyway.getTable()),
            flyway.getInstalledBy());
    initResult.put(BARE_DB_INIT_PROPERTY_NAME, String.valueOf(!mt.hasAppliedMigrations()));
    final String productName = conn.getMetaData().getDatabaseProductName().toLowerCase();
    flyway.setResolvers(
        new CustomSqlMigrationResolver(productName, dbSupport, placeholderReplacer));
    flyway.setSkipDefaultResolvers(true);
    flyway.setBaselineOnMigrate(baselineOnMigrate);
    if (baselineOnMigrate) {
      flyway.setBaselineVersionAsString(baselineVersion);
    }
    flyway.setSqlMigrationSeparator(versionSeparator);
    flyway.setSqlMigrationSuffix(scriptsSuffix);
    flyway.setSqlMigrationPrefix(scriptsPrefix);
    flyway.migrate();
  } catch (SQLException | RuntimeException x) {
    throw new SchemaInitializationException(x.getLocalizedMessage(), x);
  }
  return initResult;
}
 

开发者ID:eclipse,
项目名称:che,
代码行数:33,
代码来源:FlywaySchemaInitializer.java

示例2: dollarQuotedString

点赞 2

import org.flywaydb.core.internal.dbsupport.DbSupportFactory; //导入依赖的package包/类
@Test
  public void dollarQuotedString() throws SQLException {
  	OpenConnectionCountDriverDataSource dataSource = OpenConnectionCountDriverDataSource.getInstance(null);

DbSupport dbSupport = DbSupportFactory.createDbSupport(dataSource.getConnection(), true);
  	JdbcTemplate jdbcTemplate = dbSupport.getJdbcTemplate();
  	
  	System.out.println(dataSource.getOpenConnectionCount());
  	
  	Flyway flyway = new Flyway();
  	flyway.setDataSource(dataSource);
  	flyway.setLocations("migration/sql/h2");
      flyway.migrate();

      MigrationVersion version = flyway.info().current().getVersion();
      System.out.println(version.toString());
      System.out.println(flyway.info().current().getDescription());
      // 'Mr. Semicolon+Linebreak;\nanother line'
      jdbcTemplate.execute("INSERT INTO test_user (name) VALUES (?)", "martin.zhou");
      List<String> strings = jdbcTemplate.query("select name from test_user", null);
      if (null != strings && strings.size() > 0) {
      	for (String string : strings) {
		System.out.println("string = " + string);
	}
}else {
	System.out.println("no data.");
}
      System.out.println(jdbcTemplate.queryForString("select name from test_user where name like '%line'''"));
  }
 

开发者ID:zhoushineyoung,
项目名称:zookeeper-edit,
代码行数:30,
代码来源:H2DaoTest.java

示例3: afterPropertiesSet

点赞 2

import org.flywaydb.core.internal.dbsupport.DbSupportFactory; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
    Connection connection = this.dataSource.getConnection();
    this.dbSupport = DbSupportFactory.createDbSupport(connection, true);
}
 

开发者ID:PkayJava,
项目名称:MBaaS,
代码行数:6,
代码来源:DbSupportFactoryBean.java

示例4: execute

点赞 2

import org.flywaydb.core.internal.dbsupport.DbSupportFactory; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void execute(Connection connection) {
    SqlScript sqlScript = new SqlScript(info.getApplyDdl(), DbSupportFactory.createDbSupport(connection, true));
    sqlScript.execute(new JdbcTemplate(connection, 0));
}
 

开发者ID:icode,
项目名称:ameba,
代码行数:8,
代码来源:SqlMigrationExecutor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)