insSql1+=fieldname+",";
if((sFieldValue==null) ){
//表单未提交关键字段数据值时,本文只按数字型处理,数据值按下一流水号计算。
rs2= Stmt. executeQuery("SELECT max("+fieldname+")+1 FROM "+tablename);
rs2. next();
iFieldvalue=rs2.getInt(1);
insSql2+=Integer.toString(iFieldvalue)+",";
}
else if(Datatype.equals("DATE")){
insSql2+= "To_Date(’" + sFieldValue + "’,’YYYY-MM-DD’),";
}else if(Datatype.equals("VARCHAR2") || Datatype.equals("CHAR")){
insSql2+="’" + sFieldValue+"’,";
}
else /*NUMBER,FLOAT */ insSql2+=sFieldValue+",";}
//生成update,delete语句where部分:where fieldname=... AND
if(OperType.equals("update") || OperType.equals("delete")){
if(Datatype.equals("DATE")){
whereSql+=fieldname+"=To_Date(’" + sFieldValue + "’,’YYYY-MM-DD’) AND ";
}
else if(Datatype.equals("VARCHAR2") || Datatype.equals("CHAR")){
whereSql+=fieldname+"=’" + sFieldValue+"’ AND ";
}else /*NUMBER,FLOAT */ whereSql+=fieldname+"="+ sFieldValue+" AND ";} }
}
whereSql=whereSql.substring(0,whereSql.length()-4);
文章来源于领测软件测试网 https://www.ltesting.net/