Sequel: Now With ParseTree Goodness
The latest 0.2 release of Sequel has incorporated some of those ParseTree ideas from Ambition so now you can do queries like the following (with the SQL that they generate underneath)
DB[:items].filter {:price < 100} # "SELECT * # FROM items # WHERE (price < 100)" DB[:items].filter {:category == 'Ruby'} # "SELECT * # FROM items # WHERE (category = 'Ruby')"
And to get more complex
DB[:orders].filter{ :price >= DB[:items].select(:price) } # "SELECT * # FROM orders # WHERE (price >= (SELECT price # FROM items))" DB[:items].filter do :x == 1 :y > 2 :z < 3 end # "SELECT * # FROM items # WHERE ((x = 1) # AND (y > 2) # AND (z < 3))"
Aimred is a specialist Ruby and Ruby on Rails development house and consultancy based in Cape Town, South Africa.