use of org.jumpmind.db.sql.mapper.StringMapper in project symmetric-ds by JumpMind.
the class MsSqlDdlReader method getTableNames.
@Override
public List<String> getTableNames(final String catalog, final String schema, final String[] tableTypes) {
StringBuilder sql = new StringBuilder("select \"TABLE_NAME\" from \"INFORMATION_SCHEMA\".\"TABLES\" where \"TABLE_TYPE\"='BASE TABLE'");
List<Object> args = new ArrayList<Object>(2);
if (isNotBlank(catalog)) {
sql.append(" and \"TABLE_CATALOG\"=?");
args.add(catalog);
}
if (isNotBlank(schema)) {
sql.append(" and \"TABLE_SCHEMA\"=?");
args.add(schema);
}
return platform.getSqlTemplate().queryWithHandler(sql.toString(), new StringMapper(), new ChangeCatalogConnectionHandler(catalog), args.toArray(new Object[args.size()]));
}
use of org.jumpmind.db.sql.mapper.StringMapper in project symmetric-ds by JumpMind.
the class OutgoingBatchService method areAllLoadBatchesComplete.
public boolean areAllLoadBatchesComplete(String nodeId) {
NodeSecurity security = nodeService.findNodeSecurity(nodeId);
if (security == null || security.isInitialLoadEnabled()) {
return false;
}
List<String> statuses = (List<String>) sqlTemplate.query(getSql("initialLoadStatusSql"), new StringMapper(), nodeId, 1);
if (statuses == null || statuses.size() == 0) {
throw new RuntimeException("The initial load has not been started for " + nodeId);
}
for (String status : statuses) {
if (!Status.OK.name().equals(status)) {
return false;
}
}
return true;
}
use of org.jumpmind.db.sql.mapper.StringMapper in project symmetric-ds by JumpMind.
the class InterbaseSymmetricDialect method cleanupTriggers.
@Override
public void cleanupTriggers() {
List<String> names = platform.getSqlTemplate().query("select rdb$trigger_name from rdb$triggers where rdb$trigger_name like '" + parameterService.getTablePrefix().toUpperCase() + "_%'", new StringMapper());
for (String name : names) {
platform.getSqlTemplate().update("drop trigger " + name);
log.info("Dropped trigger {}", name);
}
}
use of org.jumpmind.db.sql.mapper.StringMapper in project symmetric-ds by JumpMind.
the class FirebirdSymmetricDialect method cleanupTriggers.
@Override
public void cleanupTriggers() {
List<String> names = platform.getSqlTemplate().query("select rdb$trigger_name from rdb$triggers where rdb$trigger_name like '" + parameterService.getTablePrefix().toUpperCase() + "_%'", new StringMapper());
int count = 0;
for (String name : names) {
count += platform.getSqlTemplate().update("drop trigger " + name);
}
if (count > 0) {
log.info("Remove {} triggers", count);
}
}
use of org.jumpmind.db.sql.mapper.StringMapper in project symmetric-ds by JumpMind.
the class H2SymmetricDialect method cleanupTriggers.
@Override
public void cleanupTriggers() {
List<String> names = platform.getSqlTemplate().query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = SCHEMA() AND TABLE_NAME LIKE '" + parameterService.getTablePrefix().toUpperCase() + "_%_CONFIG'", new StringMapper());
for (String name : names) {
platform.getSqlTemplate().update("drop table " + name);
log.info("Dropped table {}", name);
}
}
Aggregations