mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-02 21:50:43 +08:00
fix(sql-builder): escape line
This commit is contained in:
@ -258,7 +258,7 @@ public class DefaultSqlBuilder implements SqlBuilder<Table> {
|
||||
*/
|
||||
public String buildSingleInsertSql(String databaseName, String schemaName, String tableName, List<String> columnList, List<String> valueList) {
|
||||
String baseSql = buildBaseInsertSql(databaseName, schemaName, tableName, columnList);
|
||||
List<String> list = valueList.stream().map(EasyStringUtils::escapeString).toList();
|
||||
List<String> list = valueList.stream().map(EasyStringUtils::escapeLineString).toList();
|
||||
return baseSql + "(" + String.join(",", list) + ");";
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ public class DefaultSqlBuilder implements SqlBuilder<Table> {
|
||||
public String buildMultiInsertSql(String databaseName, String schemaName, String tableName, List<String> columnList, List<List<String>> valueLists) {
|
||||
String baseSql = buildBaseInsertSql(databaseName, schemaName, tableName, columnList);
|
||||
String valuesPart = valueLists.stream()
|
||||
.map(values -> "(" + String.join(",", values.stream().map(EasyStringUtils::escapeString).toList()) + ")")
|
||||
.map(values -> "(" + String.join(",", values.stream().map(EasyStringUtils::escapeLineString).toList()) + ")")
|
||||
.collect(Collectors.joining(",\n"));
|
||||
return baseSql + valuesPart + ";";
|
||||
}
|
||||
|
Reference in New Issue
Block a user