Skip to content

Commit

Permalink
0003244: AS400 support for versions less than 7
Browse files Browse the repository at this point in the history
  • Loading branch information
jumpmind-josh committed Aug 30, 2017
1 parent 8559f60 commit 4fa55af
Showing 1 changed file with 35 additions and 0 deletions.
Expand Up @@ -21,14 +21,18 @@
package org.jumpmind.symmetric.db.db2;

import org.jumpmind.db.platform.IDatabasePlatform;
import org.jumpmind.db.sql.ISqlTransaction;
import org.jumpmind.symmetric.db.ISymmetricDialect;
import org.jumpmind.symmetric.service.IParameterService;

public class Db2As400SymmetricDialect extends Db2SymmetricDialect implements ISymmetricDialect {

boolean supportsGlobalVariables = false;

public Db2As400SymmetricDialect(IParameterService parameterService, IDatabasePlatform platform) {
super(parameterService, platform);
this.triggerTemplate = new Db2As400TriggerTemplate(this);
supportsGlobalVariables = platform.getSqlTemplate().getDatabaseMajorVersion() >= 7;
}

@Override
Expand All @@ -40,7 +44,38 @@ protected boolean doesTriggerExistOnPlatform(String catalog, String schema, Stri
"SELECT COUNT(*) FROM " + getSystemSchemaName() + ".SYSTRIGGERS WHERE TRIGNAME = ? AND TRIGSCHEMA = ?",
new Object[] { triggerName.toUpperCase(), schema.toUpperCase() }) > 0;
}

@Override
public void enableSyncTriggers(ISqlTransaction transaction) {
if (supportsGlobalVariables) {
super.enableSyncTriggers(transaction);
}
}

@Override
public void disableSyncTriggers(ISqlTransaction transaction, String nodeId) {
if (supportsGlobalVariables) {
super.disableSyncTriggers(transaction, nodeId);
}
}

@Override
public String getSyncTriggersExpression() {
return supportsGlobalVariables ? super.getSyncTriggersExpression() : "";
}

@Override
public String getSourceNodeExpression() {
return supportsGlobalVariables ? super.getSourceNodeExpression() : "";
}

@Override
public void createRequiredDatabaseObjects() {
if (supportsGlobalVariables) {
super.createRequiredDatabaseObjects();
}
}

@Override
protected String getSystemSchemaName() {
return "QSYS2";
Expand Down

0 comments on commit 4fa55af

Please sign in to comment.