You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.0 KiB
49 lines
1.0 KiB
package dao;
|
|
|
|
import java.util.List;
|
|
|
|
public class UpdateAll extends SQLStmt {
|
|
private static final String fs ="UPDATE ";
|
|
List<String> fields;
|
|
String increment;
|
|
|
|
public UpdateAll(String table, List<String> fields, String increment) {
|
|
super(table);
|
|
this.setFields(fields);
|
|
this.setIncrement(increment);
|
|
}
|
|
|
|
@Override
|
|
public String getSQL() {
|
|
return this.getFs()+this.getUs();
|
|
}
|
|
|
|
@Override
|
|
public String getFs() {
|
|
return fs+this.getTable()+" ";
|
|
}
|
|
public String getUs(){
|
|
String us = "SET ";
|
|
for(String s:this.getFields()){
|
|
us+=s+" = "+s+" + "+this.getIncrement()+", ";
|
|
}
|
|
return utils.Utils.cutTail(us,2);
|
|
}
|
|
|
|
public List<String> getFields() {
|
|
return fields;
|
|
}
|
|
|
|
public void setFields(List<String> fields) {
|
|
this.fields = fields;
|
|
}
|
|
|
|
public String getIncrement() {
|
|
return increment;
|
|
}
|
|
|
|
public void setIncrement(String increment) {
|
|
this.increment = increment;
|
|
}
|
|
}
|