use of org.jumpmind.db.sql.SqlException in project symmetric-ds by JumpMind.
the class DerbyDatabasePlatform method getCreateSymTriggerPermission.
@Override
public PermissionResult getCreateSymTriggerPermission() {
String delimiter = getDatabaseInfo().getDelimiterToken();
delimiter = delimiter != null ? delimiter : "";
String triggerSql = "CREATE TRIGGER TEST_TRIGGER AFTER UPDATE ON " + delimiter + PERMISSION_TEST_TABLE_NAME + delimiter + " FOR EACH ROW MODE DB2SQL INSERT INTO " + delimiter + PERMISSION_TEST_TABLE_NAME + delimiter + " VALUES(NULL,NULL)";
PermissionResult result = new PermissionResult(PermissionType.CREATE_TRIGGER, Status.FAIL);
try {
getSqlTemplate().update(triggerSql);
result.setStatus(Status.PASS);
} catch (SqlException e) {
result.setException(e);
result.setSolution("Grant CREATE TRIGGER permission or TRIGGER permission");
}
return result;
}
use of org.jumpmind.db.sql.SqlException in project symmetric-ds by JumpMind.
the class Db2DatabasePlatform method getCreateSymTriggerPermission.
@Override
public PermissionResult getCreateSymTriggerPermission() {
String delimiter = getDatabaseInfo().getDelimiterToken();
delimiter = delimiter != null ? delimiter : "";
String triggerSql = "CREATE TRIGGER TEST_TRIGGER AFTER UPDATE ON " + delimiter + PERMISSION_TEST_TABLE_NAME + delimiter + " FOR EACH ROW BEGIN ATOMIC END";
PermissionResult result = new PermissionResult(PermissionType.CREATE_TRIGGER, Status.FAIL);
try {
getSqlTemplate().update(triggerSql);
result.setStatus(Status.PASS);
} catch (SqlException e) {
result.setException(e);
result.setSolution("Grant CREATE TRIGGER permission or TRIGGER permission");
}
return result;
}
use of org.jumpmind.db.sql.SqlException in project symmetric-ds by JumpMind.
the class AseDatabasePlatform method getCreateSymTriggerPermission.
@Override
public PermissionResult getCreateSymTriggerPermission() {
String delimiter = getDatabaseInfo().getDelimiterToken();
delimiter = delimiter != null ? delimiter : "";
String triggerSql = "create trigger TEST_TRIGGER on " + delimiter + PERMISSION_TEST_TABLE_NAME + delimiter + " for insert as begin select 1 end";
PermissionResult result = new PermissionResult(PermissionType.CREATE_TRIGGER, Status.FAIL);
try {
getSqlTemplate().update(triggerSql);
result.setStatus(Status.PASS);
} catch (SqlException e) {
result.setException(e);
result.setSolution("Grant CREATE TRIGGER permission or TRIGGER permission");
}
return result;
}
use of org.jumpmind.db.sql.SqlException in project symmetric-ds by JumpMind.
the class AbstractSymmetricDialect method createDdlTrigger.
public void createDdlTrigger(final String tablePrefix, StringBuilder sqlBuffer, String triggerName) {
if (parameterService.is(ParameterConstants.AUTO_SYNC_TRIGGERS)) {
String triggerSql = triggerTemplate.createDdlTrigger(tablePrefix, platform.getDefaultCatalog(), platform.getDefaultSchema(), triggerName);
log.info("Creating DDL trigger " + triggerName);
if (triggerSql != null) {
ISqlTransaction transaction = null;
try {
transaction = this.platform.getSqlTemplate().startSqlTransaction(platform.getDatabaseInfo().isRequiresAutoCommitForDdl());
try {
log.debug("Running: {}", triggerSql);
logSql(triggerSql, sqlBuffer);
transaction.execute(triggerSql);
} catch (SqlException ex) {
log.info("Failed to create DDL trigger: {}", triggerSql);
throw ex;
}
transaction.commit();
} catch (SqlException ex) {
transaction.rollback();
throw ex;
} finally {
transaction.close();
}
}
}
}
use of org.jumpmind.db.sql.SqlException in project symmetric-ds by JumpMind.
the class AbstractDatabasePlatform method getCreateSymTablePermission.
protected PermissionResult getCreateSymTablePermission(Database database) {
Table table = getPermissionTableDefinition();
PermissionResult result = new PermissionResult(PermissionType.CREATE_TABLE, Status.FAIL);
getDropSymTablePermission();
try {
database.addTable(table);
createDatabase(database, false, false);
result.setStatus(Status.PASS);
} catch (SqlException e) {
result.setException(e);
result.setSolution("Grant CREATE permission");
}
return result;
}
Aggregations