cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

Error with PHQL FIND_IN_SET

Open x51xxx opened this issue 12 years ago • 3 comments

$phql = "SELECT r.id, r.name
            FROM Ap\Models\Recipe r
            JOIN Ap\Models\RecipeCategories as rc ON rc.id = r.category_id
            LEFT JOIN Ap\Models\RecipeCuisines cu ON cu.id = r.cuisine_id
            WHERE FIND_IN_SET(111, r.ingredient_ids)
            ORDER BY  r.id
";
$this->modelsManager->createQuery($phql)->parse()

Error

Syntax error, unexpected token IDENTIFIER(FIND_IN_SET), near to '(929, r.ingredient_ids) ORDER BY r...


Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.

x51xxx avatar Sep 09 '14 21:09 x51xxx

"...find_in_set FIND_IN_SET..." doubled, that is wrong. You need it only once. :-)

swen100 avatar Sep 10 '14 06:09 swen100

Sorry, my mistake when writing example. In fact, the problem probably originated in the cphalcon/ext/mvc/model/query/parser.h, there was not a registered literal.

x51xxx avatar Sep 12 '14 17:09 x51xxx

After updating to 1.3.3 the problem does not occur.

x51xxx avatar Sep 12 '14 17:09 x51xxx