Skip to content

Instantly share code, notes, and snippets.

@wilig
Created August 18, 2010 17:49
Show Gist options
  • Save wilig/535574 to your computer and use it in GitHub Desktop.
Save wilig/535574 to your computer and use it in GitHub Desktop.
sequel> (to-sql (filter (> :table1/id 5) (collect :table1)))
["select * from table1 WHERE table1.id > ?" 5]
sequel> (to-sql (filter (and (> :table1/id 5) (< :table1/id 15)) (collect :table1)))
["select * from table1 WHERE (table1.id > ? AND table1.id < ?)" 5 15]
sequel> (to-sql (filter (or (and (> :table1/id 5) (< :table1/id 15)) (= :table1/id 50)) (collect :table1)))
["select * from table1 WHERE ((table1.id > ? AND table1.id < ?) OR table1.id = ?)" 5 15 50]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment