Skip to content

Commit

Permalink
0002936: Provide additional DB2 debug logging around global variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mmichalek committed Dec 7, 2016
1 parent dead650 commit 8b6f2b0
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -47,11 +47,11 @@ public Db2SymmetricDialect(IParameterService parameterService, IDatabasePlatform
public boolean createOrAlterTablesIfNecessary(String... tables) {
boolean tablesCreated = super.createOrAlterTablesIfNecessary(tables);
if (tablesCreated) {
log.info("Resetting auto increment columns for {}", parameterService.getTablePrefix() + "_data");
long dataId = platform.getSqlTemplate().queryForLong("select max(data_id) from " + parameterService.getTablePrefix()
+ "_data") + 1;
platform.getSqlTemplate().update("alter table " + parameterService.getTablePrefix()
+ "_data alter column data_id restart with " + dataId);
log.info("Resetting auto increment columns for {}", parameterService.getTablePrefix() + "_data");
}
return tablesCreated;
}
Expand Down Expand Up @@ -83,18 +83,20 @@ protected String getSystemSchemaName() {

@Override
public void createRequiredDatabaseObjects() {
String sql = "select " + getSourceNodeExpression() + " from " + parameterService.getTablePrefix() + "_node_identity";
try {
String sql = "select " + getSourceNodeExpression() + " from " + parameterService.getTablePrefix() + "_node_identity";
platform.getSqlTemplate().query(sql);
}
catch (Exception e) {
log.debug("Failed checking for variable (usually means it doesn't exist yet) '" + sql + "'", e);
platform.getSqlTemplate().update("create variable " + getSourceNodeExpression() + " varchar(50)");
}
sql = "select " + parameterService.getTablePrefix() + VAR_TRIGGER_DISABLED + " from " + parameterService.getTablePrefix() + "_node_identity";
try {
String sql = "select " + parameterService.getTablePrefix() + VAR_TRIGGER_DISABLED + " from " + parameterService.getTablePrefix() + "_node_identity";
platform.getSqlTemplate().query(sql);
}
catch (Exception e) {
log.debug("Failed checking for variable (usually means it doesn't exist yet) '" + sql + "'", e);
platform.getSqlTemplate().update("create variable " + parameterService.getTablePrefix() + VAR_TRIGGER_DISABLED + " varchar(50)");
}
}
Expand Down

0 comments on commit 8b6f2b0

Please sign in to comment.