Search in sources :

Example 11 with PermissionResult

use of org.jumpmind.db.platform.PermissionResult in project symmetric-ds by JumpMind.

the class HsqlDbDatabasePlatform 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 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;
}
Also used : PermissionResult(org.jumpmind.db.platform.PermissionResult) SqlException(org.jumpmind.db.sql.SqlException)

Example 12 with PermissionResult

use of org.jumpmind.db.platform.PermissionResult in project symmetric-ds by JumpMind.

the class InformixDatabasePlatform method getCreateSymTriggerPermission.

@Override
public PermissionResult getCreateSymTriggerPermission() {
    String delimiter = getDatabaseInfo().getDelimiterToken();
    delimiter = delimiter != null ? delimiter : "";
    String triggerSql = "CREATE TRIGGER TEST_TRIGGER DELETE ON " + delimiter + PERMISSION_TEST_TABLE_NAME + delimiter + " FOR EACH ROW(DELETE FROM " + delimiter + PERMISSION_TEST_TABLE_NAME + delimiter + " WHERE TEST_ID IS 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;
}
Also used : PermissionResult(org.jumpmind.db.platform.PermissionResult) SqlException(org.jumpmind.db.sql.SqlException)

Example 13 with PermissionResult

use of org.jumpmind.db.platform.PermissionResult in project symmetric-ds by JumpMind.

the class FirebirdDatabasePlatform method getCreateSymTriggerPermission.

@Override
public PermissionResult getCreateSymTriggerPermission() {
    String delimiter = getDatabaseInfo().getDelimiterToken();
    delimiter = delimiter != null ? delimiter : "";
    String triggerSql = "CREATE TRIGGER TEST_TRIGGER FOR " + delimiter + PERMISSION_TEST_TABLE_NAME + delimiter + " AFTER UPDATE AS BEGIN 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;
}
Also used : PermissionResult(org.jumpmind.db.platform.PermissionResult) SqlException(org.jumpmind.db.sql.SqlException)

Example 14 with PermissionResult

use of org.jumpmind.db.platform.PermissionResult in project symmetric-ds by JumpMind.

the class HsqlDb2DatabasePlatform 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 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;
}
Also used : PermissionResult(org.jumpmind.db.platform.PermissionResult) SqlException(org.jumpmind.db.sql.SqlException)

Example 15 with PermissionResult

use of org.jumpmind.db.platform.PermissionResult in project symmetric-ds by JumpMind.

the class MySqlDatabasePlatform 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 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;
}
Also used : PermissionResult(org.jumpmind.db.platform.PermissionResult) SqlException(org.jumpmind.db.sql.SqlException)

Aggregations

PermissionResult (org.jumpmind.db.platform.PermissionResult)18 SqlException (org.jumpmind.db.sql.SqlException)18