Skip to content

Commit 6eafb2b

Browse files
authored
Merge pull request #660 from thomasnokleby/support-unicode-0-character-on-postgresql
Remove null bytes from strings before insertion on postgreql.
2 parents e174e05 + fc1476a commit 6eafb2b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dbptk-modules/dbptk-module-postgresql/src/main/java/com/databasepreservation/modules/postgresql/out/PostgreSQLJDBCExportModule.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,15 @@ public String apply(Cell cell) {
310310

311311
ps.setArray(index, sqlArray);
312312
}
313+
314+
@Override
315+
protected void handleSimpleTypeStringDataCell(String data, PreparedStatement ps, int index, Cell cell,
316+
ColumnStructure column) throws SQLException {
317+
if (data != null) {
318+
data = data.replace("\u0000", "");
319+
ps.setString(index, data);
320+
} else {
321+
ps.setNull(index, Types.VARCHAR);
322+
}
323+
}
313324
}

0 commit comments

Comments
 (0)