diff options
author | Sander Marechal <[email protected]> | 2011-03-02 15:53:16 +0100 |
---|---|---|
committer | Sander Marechal <[email protected]> | 2011-03-02 15:53:16 +0100 |
commit | b58b452dfa6de53f3864a78cfba9eef1842b95d5 (patch) | |
tree | 9ce5f4abb6cbe6f4923a7965ce4c32df1a32e1ee /test/test_queries.php | |
parent | c956f1c8250cfb07c29f5b14a43e2ca30747e2d6 (diff) |
Add support for raw `ORDER BY` clauses.
This is useful when you need to order results by something other than a
column name, like the output of an SQL function.
Diffstat (limited to 'test/test_queries.php')
-rw-r--r-- | test/test_queries.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/test_queries.php b/test/test_queries.php index 329ebc9..b4f3341 100644 --- a/test/test_queries.php +++ b/test/test_queries.php @@ -80,6 +80,10 @@ $expected = "SELECT * FROM `widget` ORDER BY `name` ASC LIMIT 1"; Tester::check_equal("ORDER BY ASC", $expected); + ORM::for_table('widget')->order_raw('SOUNDEX(`name`)')->find_one(); + $expected = "SELECT * FROM `widget` ORDER BY SOUNDEX(`name`) LIMIT 1"; + Tester::check_equal("Raw ORDER BY", $expected); + ORM::for_table('widget')->order_by_asc('name')->order_by_desc('age')->find_one(); $expected = "SELECT * FROM `widget` ORDER BY `name` ASC, `age` DESC LIMIT 1"; Tester::check_equal("Multiple ORDER BY", $expected); |