package sqlconnect;

public class Upd {
     public static void update(String table,String attribute1,String value1,
                               String attribute2,String value2){
         if(Database.Maps.containsKey(table)==false){
             System.err.println("没有找到该表");
             return;
         }
         attribute1=SQLfilter.filter(attribute1);
         value1=SQLfilter.filter(value1);
         attribute2=SQLfilter.filter(attribute2);
         value2=SQLfilter.filter(value2);
         String sqlQue="update "+table+" set "+attribute2+"="+value2+" where "+
                 attribute1+"="+value1;
         try{
             Database.state.execute(sqlQue);
         }catch (Exception e){
             System.err.println("删除失败");
             e.printStackTrace();
         }
     }
}
