I'm in need for the latest PostgreSQL 9.3 JSON operators syntax (http://www.postgresql.org/docs/9.3/static/functions-json.html). Regarding this question: http://stackoverflow.com/q/21095399/1697320 on StackOverflow I am trying to get Phalcon to accept syntax like
Model::query()->where("data->>'email' = :email");
So I forked the cphalcon project and started digging into the source to find out that there is lemon behind the PHQL. But I'm assuming that the parsel.lemon is outdated in regard to parser.c? For starters the phql_ret_qualified_name function in parser.lemon is missing 3rd argument which was introduced in parser.c in rev 123065c (I'm currently on 1.2.6 branch). Am I missing something?
I've managed to recompile Phalcon using the parser.lemon from repo, but this only made things worse. It doesn't even recognize SELECT statment now.
I'v done this:
$ cd ext/mvc/model/query $ gcc -o lemon lemon.c $ ./lemon parser.lemon $ git checkout -- parser.h # since it was missing some define's after "./lemon parser.lemon" command $ cat base.c >> parser.c $ cd ../../../.. $ php scripts/gen-build.php $ cd build/64bits/ $ make
The diff between my local parser.c and the GitHub version is now yielding almost every line. And even simple Model::query()->execute() throws errors:
ERROR: Syntax error, unexpected token SELECT, near...
So I would greatly appreciate if you guys could tell me what am I doing wrong, or provide some pointers on how can I make Phalcon to accept the syntax (maybe it can be done in PHP without recompiling the source?).
Also a side question: is there any chance on implementing this natively? I know that it is localized to a single RDMS, but with all that recent NoSQL boom pretty much everyone would like to use it with Postgres.