String[] sets = taskTimerExec.getSets().split(",");
if (sets.length == 1) {
dao.update(taskTimerExec.getTab(), Chain.make(sets[0].split(",")[0], sets[0].split(",")[1]),
Cnd.wrap(taskTimerExec.getWheres()));
} else if (sets.length == 2) {
dao.update(taskTimerExec.getTab(), Chain.make(sets[0].split(",")[0], sets[0].split(",")[1])
.add(sets[1].split(",")[0], sets[1].split(",")[1]), Cnd.wrap(taskTimerExec.getWheres()));
} else if (sets.length == 3) {
dao.update(taskTimerExec.getTab(),
Chain.make(sets[0].split(",")[0], sets[0].split(",")[1])
.add(sets[1].split(",")[0], sets[1].split(",")[1]).add(sets[2].split(",")[0],
sets[2].split(",")[1]),
Cnd.wrap(taskTimerExec.getWheres()));
} else if (sets.length == 4) {
dao.update(taskTimerExec.getTab(),
Chain.make(sets[0].split(",")[0], sets[0].split(",")[1])
.add(sets[1].split(",")[0], sets[1].split(",")[1])
.add(sets[2].split(",")[0], sets[2].split(",")[1]).add(sets[3].split(",")[0],
sets[3].split(",")[1]),
Cnd.wrap(taskTimerExec.getWheres()));
}
7 回复
String[] sets = taskTimerExec.getSets().split(",");
if (sets.length == 1) {
dao.update(taskTimerExec.getTab(), Chain.make(sets[0].split("=")[0], sets[0].split("=")[1]),
Cnd.wrap(taskTimerExec.getWheres()));
} else if (sets.length == 2) {
dao.update(taskTimerExec.getTab(), Chain.make(sets[0].split("=")[0], sets[0].split("=")[1])
.add(sets[1].split("=")[0], sets[1].split("=")[1]), Cnd.wrap(taskTimerExec.getWheres()));
} else if (sets.length == 3) {
dao.update(taskTimerExec.getTab(),
Chain.make(sets[0].split("=")[0], sets[0].split("=")[1])
.add(sets[1].split("=")[0], sets[1].split("=")[1]).add(sets[2].split("=")[0],
sets[2].split("=")[1]),
Cnd.wrap(taskTimerExec.getWheres()));
} else if (sets.length == 4) {
dao.update(taskTimerExec.getTab(),
Chain.make(sets[0].split("=")[0], sets[0].split("=")[1])
.add(sets[1].split("=")[0], sets[1].split("=")[1])
.add(sets[2].split("=")[0], sets[2].split("=")[1]).add(sets[3].split("=")[0],
sets[3].split("=")[1]),
Cnd.wrap(taskTimerExec.getWheres()));
}
就是 taskTimerExec.getTab() 是表名 sets是 a=b,c=d要更新的字段taskTimerExec.getWheres()这个是 更新条件
我的意思就是 a=b,c=d 是不确定有几个的 更新的字段不确定
@wendal(wendal) 就是 taskTimerExec.getTab() 是表名 sets是 a=b,c=d要更新的字段taskTimerExec.getWheres()这个是 更新条件
我的意思就是 a=b,c=d 是不确定有几个的 更新的字段不确定
如何动态的更新字段 该帖子已经有demo代码. 关.
添加回复
该帖子已被锁定,不能回复.