Skip to content

Commit

Permalink
0002939: MySQL store: Error after reload node
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Dec 9, 2016
1 parent d28853a commit 47914fa
Showing 1 changed file with 1 addition and 9 deletions.
Expand Up @@ -77,7 +77,7 @@ public MySqlBulkDatabaseWriter(IDatabasePlatform platform,

public boolean start(Table table) {
this.table = table;
if (super.start(table)) {
if (super.start(table) && targetTable != null) {
needsBinaryConversion = false;
if (! batch.getBinaryEncoding().equals(BinaryEncoding.NONE)) {
for (Column column : targetTable.getColumns()) {
Expand Down Expand Up @@ -130,7 +130,6 @@ public void write(CsvData data) {
writer.setForceQualifier(true);
writer.setNullString("\\N");
Column[] columns = targetTable.getColumns();
boolean lastWasBinary = false;
for (int i = 0; i < columns.length; i++) {
if (columns[i].isOfBinaryType() && parsedData[i] != null) {
if (i > 0) {
Expand All @@ -139,20 +138,13 @@ public void write(CsvData data) {
out.write('"');
if (batch.getBinaryEncoding().equals(BinaryEncoding.HEX)) {
out.write(escape(Hex.decodeHex(parsedData[i].toCharArray())));
// out.write(parsedData[i].getBytes());
} else if (batch.getBinaryEncoding().equals(BinaryEncoding.BASE64)) {
// out.write(escape(Base64.decodeBase64(parsedData[i].getBytes())));
out.write(new String(Hex.encodeHex(Base64.decodeBase64(parsedData[i].getBytes()))).getBytes());
}
out.write('"');
lastWasBinary = true;
} else {
// if (lastWasBinary) {
// out.write(',');
// }
writer.write(parsedData[i], true);
writer.flush();
lastWasBinary = false;
}
}
writer.endRecord();
Expand Down

0 comments on commit 47914fa

Please sign in to comment.