NutzCN Logo
问答 Dao执行sql语句的返回值
发布于 3048天前 作者 qq_95c60b0b 2764 次浏览 复制 上一个帖子 下一个帖子
标签: dao
sql = Sqls.create("update ....");
sql.setCallback(Sqls.callback.integer());
//第二种方式
//sql = Sqls.fetchInt(threadPoolTaskData);
dao.execute(sql);
Integer result = sql.getObject(Integer.class);

我想通过这种方式执行update并获取受影响的行数,我知道直接使用dao.update是可以的,上面的方法为什么返回的都是null呢,我需要重写
callback吗

1 回复

结贴
使用

int result = sql.getUpdateCount();

代替

Integer result = sql.getObject(Integer.class);

在代码里看到getUpdateCount这个函数,发现是可以的,不知道有没有其他需要注意的@wendal

添加回复
请先登陆
回到顶部