static String buildInsertSql(String table, String[] fields) {
var res = new StringBuilder(); res.append("INSERT INTO ")
.append(table)
.append(" (")
.append(String.join(", ", fields))
.append(") VALUES (")
.append(String.join(", ", Collections.nCopies(fields.length, "?")))
.append(")");
return res.toString();
}
Sign in to make a reply
castig
static String buildInsertSql(String table, String[] fields) {
var res = new StringBuilder();
res.append("INSERT INTO ")
.append(table)
.append(" (")
.append(String.join(", ", fields))
.append(") VALUES (")
.append(String.join(", ", Collections.nCopies(fields.length, "?")))
.append(")");
return res.toString();
}