Skip to content

Commit

Permalink
0004578: SQL-Server bulk loader not allowing create events
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Oct 19, 2020
1 parent f5d8971 commit 9cebfe8
Showing 1 changed file with 8 additions and 22 deletions.
Expand Up @@ -36,7 +36,6 @@
import org.jumpmind.db.platform.IDatabasePlatform;
import org.jumpmind.db.sql.JdbcSqlTransaction;
import org.jumpmind.db.util.BinaryEncoding;
import org.jumpmind.symmetric.SymmetricException;
import org.jumpmind.symmetric.io.data.CsvData;
import org.jumpmind.symmetric.io.data.DataEventType;
import org.jumpmind.symmetric.io.data.writer.DataWriterStatisticConstants;
Expand Down Expand Up @@ -80,19 +79,6 @@ public MsSqlBulkDatabaseWriter(IDatabasePlatform symmetricPlatform,
public boolean start(Table table) {
this.table = table;
if (super.start(table)) {
if (sourceTable != null && targetTable == null) {
String qualifiedName = sourceTable.getFullyQualifiedTableName();
if (writerSettings.isIgnoreMissingTables()) {
if (!missingTables.contains(qualifiedName)) {
log.info("Did not find the {} table in the target database. This might have been part of a sql "
+ "command (truncate) but will work if the fully qualified name was in the sql provided", qualifiedName);
missingTables.add(qualifiedName);
}
} else {
throw new SymmetricException("Could not load the %s table. It is not in the target database", qualifiedName);
}
}

needsBinaryConversion = false;
if (! batch.getBinaryEncoding().equals(BinaryEncoding.HEX) && targetTable != null) {
for (Column column : targetTable.getColumns()) {
Expand All @@ -102,9 +88,9 @@ public boolean start(Table table) {
}
}
}
databaseTable = getPlatform(table).getTableFromCache(sourceTable.getCatalog(), sourceTable.getSchema(),
sourceTable.getName(), false);
if (targetTable != null) {
if (sourceTable != null && targetTable != null) {
databaseTable = getPlatform(table).getTableFromCache(sourceTable.getCatalog(), sourceTable.getSchema(),
sourceTable.getName(), false);
String[] csvNames = targetTable.getColumnNames();
String[] columnNames = databaseTable.getColumnNames();
needsColumnsReordered = false;
Expand All @@ -115,11 +101,11 @@ public boolean start(Table table) {
}
}
}
//TODO: Did this because start is getting called multiple times
// for the same table in a single batch before end is being called
if (this.stagedInputFile == null) {
createStagingFile();
}
// TODO: Did this because start is getting called multiple times
// for the same table in a single batch before end is being called
if (this.stagedInputFile == null) {
createStagingFile();
}
return true;
} else {
return false;
Expand Down

0 comments on commit 9cebfe8

Please sign in to comment.