Skip to content

Commit

Permalink
0003029: Add a parameter that will force SymmetricDS to create nclobs in
Browse files Browse the repository at this point in the history
sym_data on Oracle.
  • Loading branch information
erilong committed Apr 8, 2020
1 parent e867dfd commit d559e9e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
Expand Up @@ -28,7 +28,9 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.jumpmind.db.model.Column;
import org.jumpmind.db.model.Database;
import org.jumpmind.db.model.Table;
import org.jumpmind.db.model.TypeMap;
import org.jumpmind.db.platform.IDatabasePlatform;
import org.jumpmind.db.platform.PermissionType;
import org.jumpmind.db.sql.ISqlTransaction;
Expand Down Expand Up @@ -72,7 +74,20 @@ public OracleSymmetricDialect(IParameterService parameterService, IDatabasePlatf
}
}
}


@Override
public Database readSymmetricSchemaFromXml() {
Database db = super.readSymmetricSchemaFromXml();
if (parameterService.is(ParameterConstants.DBDIALECT_ORACLE_USE_NTYPES_FOR_SYNC)) {
Table table = db.findTable(TableConstants.getTableName(getTablePrefix(),
TableConstants.SYM_DATA));
table.getColumnWithName("row_data").setMappedType(TypeMap.NCLOB);
table.getColumnWithName("old_data").setMappedType(TypeMap.NCLOB);
table.getColumnWithName("pk_data").setMappedType(TypeMap.NCLOB);
}
return db;
}

@Override
protected void buildSqlReplacementTokens() {
super.buildSqlReplacementTokens();
Expand Down
Expand Up @@ -23,6 +23,7 @@
import java.util.HashMap;

import org.apache.commons.lang.StringUtils;
import org.jumpmind.db.model.Table;
import org.jumpmind.symmetric.common.ParameterConstants;
import org.jumpmind.symmetric.db.AbstractTriggerTemplate;
import org.jumpmind.symmetric.db.ISymmetricDialect;
Expand Down Expand Up @@ -268,4 +269,12 @@ protected String getCreateTimeExpression(ISymmetricDialect symmetricDialect) {
}
}

protected String toClobExpression(Table table) {
if (table.hasNTypeColumns() || symmetricDialect.getParameterService().is(ParameterConstants.DBDIALECT_ORACLE_USE_NTYPES_FOR_SYNC)) {
return "to_nclob('')||";
} else {
return "to_clob('')||";
}
}

}
Expand Up @@ -261,6 +261,7 @@ private ParameterConstants() {
public final static String DBDIALECT_ORACLE_BULK_FIELD_TERMINATOR = "oracle.bulk.load.field.terminator";
public final static String DBDIALECT_ORACLE_BULK_LINE_TERMINATOR = "oracle.bulk.load.line.terminator";
public final static String DBDIALECT_ORACLE_LOAD_QUERY_HINT_PARALLEL_COUNT = "oracle.load.query.hint.parallel.count";
public final static String DBDIALECT_ORACLE_USE_NTYPES_FOR_SYNC = "oracle.use.ntypes.for.sync";

public final static String DBDIALECT_TIBERO_USE_TRANSACTION_VIEW = "tibero.use.transaction.view";
public final static String DBDIALECT_TIBERO_TEMPLATE_NUMBER_SPEC = "tibero.template.precision";
Expand Down
Expand Up @@ -1885,6 +1885,15 @@ oracle.bulk.load.sqlldr.infile.charset=
# DatabaseOverridable: true
oracle.load.query.hint.parallel.count=1

# Use nclob for the data capture columns and use to_nclob() in the
# trigger text so that double byte data isn't lost
# when the database collation for char types isn't compatible with n char types.
#
# DatabaseOverridable: true
# Tags: other
# Type: boolean
oracle.use.ntypes.for.sync=false

# Path to the tbloader executable for running Tibero tbLoader.
# If blank, it will check for TB_HOME environment variable and find tbLoader there.
# Otherwise, it will run "tbloader" and expect the operating system to find it.
Expand Down

0 comments on commit d559e9e

Please sign in to comment.