-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NFR] PostgreSQL row sorting: implement [NULLS { FIRST | LAST }] #548
Comments
How could that syntax be rewritten to work on Mysql and Sqlite? |
As far as I'm concerned, there is no native NULLS { FIRST | LAST }, but there are some workarounds http://stackoverflow.com/questions/1498648/sql-how-to-make-null-values-come-last-when-sorting-ascending |
@phalcon Why should it even work in Sqlite and MySQL? I see no reason for it. If somebody wants to use advanced database features then framework should provide this possibility, otherwise it is a framework limitation. If framework tends to be compatible with all databases it should be flexible, but not impose limitations. |
Because the goal of PHQL is transparent switch between the supported databases. Support every possible no sql-standard syntax is almost impossible. Also, we can't automatically escape columns/table names or rename columns if PHQL is not used. |
Can be solved by #653 $di->modelsManager->registerSimpleQueryFunction('ORDER_BY_NULLS_LAST', '?0 NULLS LAST');
$robots = Robots::find(array(
"order" => "name ORDER_BY_NULLS_LAST(DESC)"
));
// SELECT u.* FROM users AS u ORDER BY u.name DESC NULLS LAST |
This belongs in Incubator Dialect. |
This issue was moved to phalcon/incubator#801 |
Currently, on executing following piece of code:
Exception rises:
The text was updated successfully, but these errors were encountered: