Hi,
I have some problems when using PHQL, do you have any idea? FYI, I do not use any Constraints in both MySQL and Phalcon.
thanks in advance
<?php
$query = 'UPDATE Table SET column = "value" WHERE id IN (1,2,3,4,5)'; // work
$query = 'UPDATE Table SET column = "value" WHERE id > 0'; // nothing happen in database
$query = 'UPDATE Table SET column = "value" WHERE 1'; // nothing happen in database
$query = 'UPDATE Table SET id = 100 WHERE id = 101'; // nothing happen in database
$query = 'UPDATE Table SET column = "value" WHERE id IN (1,2,3,4,5) ORDER BY id'; // error: "Syntax error, unexpected token ORDER, near to ' BY id', when parsing: UPDATE Table SET column = "value" WHERE id IN (1,2,3,4,5) ORDER BY id"
$this->modelsManager->executeQuery($query);
update:
I do more tests, and the result is showing that if I'm updating more than 7 rows it will not work.
update:
I still haven't found the solution to make PHQL works in this particular case. I tried raw SQL with the way provided by Andrey at https://forum.phalcon.io/discussion/734/update-table-in-raw-sql-returning-value-on-success, now it works. More info, if update with the way described in doc: https://docs.phalcon.io/en/latest/reference/phql.html#using-raw-sql, it will give "SQLSTATE[HY000]: General error" error.