true来查询就报错Syntax error, unexpected token IDENTIFIER(FOR), near to ' UPDATE' {代码...} phalcon版本1.3.4 求证,你们的phalcon使用行锁for_upade会报..."/> true来查询就报错Syntax error, unexpected token IDENTIFIER(FOR), near to ' UPDATE' {代码...} phalcon版本1.3.4 求证,你们的phalcon使用行锁for_upade会报...">

Home >Backend Development >PHP Tutorial >Phalcon使用行锁for_upade报错?

Phalcon使用行锁for_upade报错?

WBOY
WBOYOriginal
2016-06-06 20:31:171434browse

开启事务后,按照文档说的参数"for_update" => true来查询就报错Syntax error, unexpected token IDENTIFIER(FOR), near to ' UPDATE'

<code>$this->db->begin();
$robots = Robots::find(array(
    "conditions" => "name LIKE %steve%",
    "order" => "name",
    "for_update" => true
));

...

$this->db->commit();
</code>

phalcon版本1.3.4
求证,你们的phalcon使用行锁for_upade会报错吗?还是我的代码不对?
http://www.myleftstudio.com/reference/models.html#finding-records

回复内容:

开启事务后,按照文档说的参数"for_update" => true来查询就报错Syntax error, unexpected token IDENTIFIER(FOR), near to ' UPDATE'

<code>$this->db->begin();
$robots = Robots::find(array(
    "conditions" => "name LIKE %steve%",
    "order" => "name",
    "for_update" => true
));

...

$this->db->commit();
</code>

phalcon版本1.3.4
求证,你们的phalcon使用行锁for_upade会报错吗?还是我的代码不对?
http://www.myleftstudio.com/reference/models.html#finding-records

是的,phalcon 1.3.X都有这个问题,应该是在今年6月份的时候phalcon 2.0.4解决了这个bug
解决办法,用最新的phalcon,或者使用pdo执行纯sql

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn