当我执行此查询2次时,返回相同的值?
$sql = "select nextval('auth_num_seq') as nextval";
$nextval = $this->query($sql);
return $nextval[0][0]['nextval'];
为什么?
我也尝试过,但不起作用?
$sql = "select setval('auth_num_seq', nextval('auth_num_seq') + 1, false)";
$setval = $this->query($sql);
$sql = "select nextval('auth_num_seq') as nextval";
$nextval = $this->query($sql);
return $nextval[0][0]['nextval'];
答案 0 :(得分:1)
我在此链接中找到了解决方案:http://cakephp.1045679.n5.nabble.com/how-to-disable-query-caching-td1297496.html
感谢 AD7six !!
我需要这样做:$this->query('some sql', false);
。将第二个参数设置为 false 。