static String buildInsertSql(String table, String[] fields) {
// TODO:
String str = "INSERT INTO ";
StringBuilder a = new StringBuilder();
for(int i = 0;i < 3; i++){
if (i == 0){
a.append("(");
}
if (i == 2){
a.append(fields[i] + ")");
break;
a.append(fields[i] + ", ");
String str1 = " VALUES (?, ?, ?)";
StringBuilder str3 = new StringBuilder();
str3.append(str)
.append(table)
.append(" ")
.append(a)
.append(str1);
String str4;
str4 = "" + str3;
return str4;
Sign in to make a reply
木子向南工作室
static String buildInsertSql(String table, String[] fields) {
// TODO:
String str = "INSERT INTO ";
StringBuilder a = new StringBuilder();
for(int i = 0;i < 3; i++){
if (i == 0){
a.append("(");
}
if (i == 2){
a.append(fields[i] + ")");
break;
}
a.append(fields[i] + ", ");
}
String str1 = " VALUES (?, ?, ?)";
StringBuilder str3 = new StringBuilder();
str3.append(str)
.append(table)
.append(" ")
.append(a)
.append(str1);
String str4;
str4 = "" + str3;
return str4;
}