Skip to content

Commit

Permalink
0002010: Initial load failing on Firebird because of "Implementation …
Browse files Browse the repository at this point in the history
…limit exceeded. Block size exceeds implementation restriction"
  • Loading branch information
chenson42 committed Oct 14, 2014
1 parent b0a07eb commit 3c6ad0c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
Expand Up @@ -124,4 +124,8 @@ public FirebirdTriggerTemplate(ISymmetricDialect symmetricDialect) {
"select $(columns) from $(schemaName)$(tableName) t where $(whereClause) " );
}

protected boolean requiresTriggerTemplatesToBeUsedDuringInitialLoad() {
return false;
}

}
Expand Up @@ -109,12 +109,22 @@ abstract public class AbstractTriggerTemplate {
protected AbstractTriggerTemplate(ISymmetricDialect symmetricDialect) {
this.symmetricDialect = symmetricDialect;
}

protected boolean requiresTriggerTemplatesToBeUsedDuringInitialLoad() {
return true;
}

public String createInitalLoadSql(Node node, TriggerRouter triggerRouter, Table originalTable,
TriggerHistory triggerHistory, Channel channel, String overrideSelectSql) {

IParameterService parameterService = symmetricDialect.getParameterService();

boolean dateTimeAsString = parameterService.is(
ParameterConstants.DATA_LOADER_TREAT_DATETIME_AS_VARCHAR);

boolean concatInCsv = parameterService.is(
ParameterConstants.INITIAL_LOAD_CONCAT_CSV_IN_SQL_ENABLED);

Table table = originalTable.copyAndFilterColumns(triggerHistory.getParsedColumnNames(),
triggerHistory.getParsedPkColumnNames(), true);

Expand All @@ -125,8 +135,8 @@ public String createInitalLoadSql(Node node, TriggerRouter triggerRouter, Table
String sql = null;

String tableAlias = symmetricDialect.getInitialLoadTableAlias();
if (parameterService.is(
ParameterConstants.INITIAL_LOAD_CONCAT_CSV_IN_SQL_ENABLED)) {

if (concatInCsv) {
sql = sqlTemplates.get(INITIAL_LOAD_SQL_TEMPLATE);
String columnsText = buildColumnsString(tableAlias,
tableAlias, "", columns, DataEventType.INSERT,
Expand All @@ -148,11 +158,29 @@ public String createInitalLoadSql(Node node, TriggerRouter triggerRouter, Table
columnList.append(",");
}

ColumnString columnString = fillOutColumnTemplate(tableAlias, tableAlias,
"", column, DataEventType.INSERT, false, channel, triggerRouter.getTrigger());
String columnExpression = columnString.columnString;
if (isNotBlank(textColumnExpression) && TypeMap.isTextType(column.getMappedTypeCode())) {
columnExpression = textColumnExpression.replace("$(columnName)", columnExpression);
String columnExpression = null;
if (requiresTriggerTemplatesToBeUsedDuringInitialLoad()) {
ColumnString columnString = fillOutColumnTemplate(tableAlias,
tableAlias, "", column, DataEventType.INSERT, false, channel,
triggerRouter.getTrigger());
columnExpression = columnString.columnString;
if (isNotBlank(textColumnExpression)
&& TypeMap.isTextType(column.getMappedTypeCode())) {
columnExpression = textColumnExpression.replace("$(columnName)",
columnExpression);
}
} else {
columnExpression = SymmetricUtils.quote(symmetricDialect,
column.getName());

if (dateTimeAsString
&& TypeMap.isDateTimeType(column.getMappedTypeCode())) {
columnExpression = castDatetimeColumnToString(column.getName());
} else if (isNotBlank(textColumnExpression)
&& TypeMap.isTextType(column.getMappedTypeCode())) {
columnExpression = textColumnExpression.replace("$(columnName)",
columnExpression) + " as " + column.getName();
}
}

columnList.append(columnExpression).append(" as ").append(column.getName());
Expand Down

0 comments on commit 3c6ad0c

Please sign in to comment.