Skip to content

Commit

Permalink
0001449: Add support for allowing a database writer filter to change …
Browse files Browse the repository at this point in the history
…the target tables catalog, schema and table name
  • Loading branch information
mhanes committed Oct 23, 2013
1 parent 250d4ca commit f47dce7
Showing 1 changed file with 12 additions and 12 deletions.
Expand Up @@ -381,19 +381,19 @@ protected boolean filterBefore(CsvData data) {
statistics.get(batch).startTimer(DataWriterStatisticConstants.FILTERMILLIS);
for (IDatabaseWriterFilter filter : filters) {
process &= filter.beforeWrite(this.context, this.sourceTable, data);
// re-lookup target table in case the source table has changed
Table oldTargetTable = targetTable;
targetTable = lookupTableAtTarget(this.sourceTable);
if (targetTable == null) {
throw new IllegalStateException("Unable to locate table " +this.sourceTable.getFullyQualifiedTableName()+" in target database.");
} else if (!targetTable.equals(oldTargetTable)) {
// allow for auto increment columns to be inserted into if appropriate
String quote = getPlatform().getDatabaseInfo().getDelimiterToken();
if (oldTargetTable!=null) {
transaction.allowInsertIntoAutoIncrementColumns(false, oldTargetTable, quote);
}
transaction.allowInsertIntoAutoIncrementColumns(true, targetTable, quote);
}
// re-lookup target table in case the source table has changed
Table oldTargetTable = targetTable;
targetTable = lookupTableAtTarget(this.sourceTable);
if (targetTable == null) {
throw new IllegalStateException("Unable to locate table " +this.sourceTable.getFullyQualifiedTableName()+" in target database.");
} else if (!targetTable.equals(oldTargetTable)) {
// allow for auto increment columns to be inserted into if appropriate
String quote = getPlatform().getDatabaseInfo().getDelimiterToken();
if (oldTargetTable!=null) {
transaction.allowInsertIntoAutoIncrementColumns(false, oldTargetTable, quote);
}
transaction.allowInsertIntoAutoIncrementColumns(true, targetTable, quote);
}
} finally {
statistics.get(batch).stopTimer(DataWriterStatisticConstants.FILTERMILLIS);
Expand Down

0 comments on commit f47dce7

Please sign in to comment.