Created
May 15, 2014 14:16
-
-
Save wunki/04cac02340405ffd63ee to your computer and use it in GitHub Desktop.
Dynamic ordering with Clojure's yesql.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM users ORDER BY :order ASC |
It doesn't seem to give an error, but it's even stranger, it doesn't seem to do anything at all. The order doesn't change if I change the value. For example, changing name
to joined_at
doesn't do anything.
Hmm...which DB are you using?
@krisajenkins PostgreSQL. Could be that it's my incompetence, but I couldn't get an error, neither would sorting change with different values.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Will this work with Yesql? I believe this is entirely dependent on whether your JDBC driver supports it, and that for most databases the answer will be no. Try:
...and see what happens. I suspect the database will consider it an error, in which case Yesql can't help.
(But if not, post the error and I'll try to help further!)