fix storage SQL: авычки...
This commit is contained in:
parent
6ad470b67f
commit
e44435b54d
1 changed files with 2 additions and 2 deletions
|
|
@ -39,12 +39,12 @@ public class DbUtilsHelper {
|
|||
|
||||
public static String createUpdateOrInsert(String tableName, String[] fields, String matchingKey) {
|
||||
String updateOrInsert = "INSERT INTO " + tableName +
|
||||
" (" + Arrays.stream(fields).map(f -> "\"" + f.toUpperCase() + "\"").collect(Collectors.joining(", ")) + ") values (" +
|
||||
" (" + Arrays.stream(fields).map(f -> "" + f.toUpperCase() + "").collect(Collectors.joining(", ")) + ") values (" +
|
||||
// Arrays.stream(fields).map(f -> "\"" + f.toUpperCase() + "\"").collect(Collectors.joining(", ", ":", ""));
|
||||
String.join(", ", Collections.nCopies(fields.length, "?")) +
|
||||
") ON CONFLICT ";
|
||||
updateOrInsert += "(" + matchingKey.toUpperCase()+")";
|
||||
updateOrInsert += " DO UPDATE SET " + Arrays.stream(fields).filter(f->!matchingKey.equalsIgnoreCase(f)).map(f -> "\"" + f.toUpperCase() + "\"=EXCLUDED.\"" + f.toUpperCase() + "\"").collect(Collectors.joining(", "));
|
||||
updateOrInsert += " DO UPDATE SET " + Arrays.stream(fields).filter(f->!matchingKey.equalsIgnoreCase(f)).map(f -> "" + f.toUpperCase() + "=EXCLUDED." + f.toUpperCase() + "").collect(Collectors.joining(", "));
|
||||
|
||||
return updateOrInsert;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue