package dao;

import java.util.Map;

public class Update extends SQLStmt {
    private static final String fs ="UPDATE ";
    private Map<String,String> limits;
    private Map<String,String> vMap;


    Update(String table, Map<String, String> vMap, Map<String, String> limits) {
        super(table);
        this.setVMap(vMap);
        this.setLimits(limits);
    }

    @Override
    public String getSQL() {
        return this.getFs()+this.getVs()+this.getLs();
    }

    @Override
    public String getFs() {
        return fs+this.getTable()+" ";
    }
    private String getLs(){
        return dao.Utils.whereAnd(this.getLimits());
    }
    private String getVs(){
        String sql = "SET ";
        sql+=Utils.linkColumn(Utils.linkKeyValue(this.getVMap()))+" ";
        return sql;
    }


    private Map<String, String> getLimits() {
        return limits;
    }

    public void setLimits(Map<String, String> limits) {
        this.limits = limits;
    }
    public Map<String, String> getVMap() {
        return vMap;
    }

    public void setVMap(Map<String, String> vMap) {
        this.vMap = vMap;
    }


}
