Skip to content

Commit

Permalink
0002953: MSSQL Data truncation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jumpmind-josh committed Jan 5, 2017
1 parent 077c022 commit f886b3a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Expand Up @@ -269,7 +269,15 @@ protected String getSourceTablePrefix(TriggerHistory triggerHistory) {
}

@Override
protected String getColumnSize(Column column) {
protected String getColumnSize(Table table, Column column) {
int totalSize = 0;
for (Column c : table.getColumns()) {
totalSize += c.getSizeAsInt();
}
if (castToNVARCHAR && totalSize > 8000) {
return "max";
}

if (castToNVARCHAR && column.getSizeAsInt() > 4000) {
return "max";
}
Expand Down
Expand Up @@ -863,8 +863,11 @@ else if (column.getJdbcTypeName() != null
String formattedColumnText = FormatUtils.replace("columnName",
String.format("%s%s", columnPrefix, column.getName()), templateToUse);

Table sourceTable = symmetricDialect.getPlatform().getTableFromCache(trigger.getSourceCatalogName(),
trigger.getSourceSchemaName(), trigger.getSourceTableName(), false);

formattedColumnText = FormatUtils.replace("columnSize",
getColumnSize(column), formattedColumnText);
getColumnSize(sourceTable, column), formattedColumnText);

formattedColumnText = FormatUtils.replace("masterCollation",
symmetricDialect.getMasterCollation(), formattedColumnText);
Expand All @@ -883,7 +886,7 @@ else if (column.getJdbcTypeName() != null

}

protected String getColumnSize(Column column) {
protected String getColumnSize(Table table, Column column) {
return column.getSize();
}

Expand Down

0 comments on commit f886b3a

Please sign in to comment.