fix an error

This commit is contained in:
LuckyPickleZZ 2023-12-08 11:35:07 +08:00
parent abf3ea0230
commit 7097651cd8
1 changed files with 3 additions and 4 deletions

View File

@ -22,7 +22,7 @@ public class SqlWriter implements UnstructuredWriter {
this.sqlWriter = writer; this.sqlWriter = writer;
this.quoteChar = quoteChar; this.quoteChar = quoteChar;
this.lineSeparator = lineSeparator; this.lineSeparator = lineSeparator;
this.tableName = tableName; this.tableName = quoteChar + tableName + quoteChar;
this.nullFormat = nullFormat; this.nullFormat = nullFormat;
buildInsertPrefix(columnNames); buildInsertPrefix(columnNames);
} }
@ -55,10 +55,9 @@ public class SqlWriter implements UnstructuredWriter {
sb.append(quoteChar).append(columnName).append(quoteChar); sb.append(quoteChar).append(columnName).append(quoteChar);
} }
int capacity = 18 + tableName.length() + sb.length(); int capacity = 16 + tableName.length() + sb.length();
this.insertPrefix = new StringBuilder(capacity); this.insertPrefix = new StringBuilder(capacity);
this.insertPrefix this.insertPrefix.append("INSERT INTO ").append(tableName).append(" (").append(sb).append(")").append(" VALUES(");
.append("INSERT INTO ").append(quoteChar).append(tableName).append(quoteChar).append(" (").append(sb).append(")").append(" VALUES(");
} }
public void appendCommit() throws IOException { public void appendCommit() throws IOException {