[Nitro] SQL anyone?

Kirk Haines wyhaines at gmail.com
Mon Nov 5 12:05:07 EST 2007


On 11/5/07, Trans <transfire at gmail.com> wrote:

> Kansas has a DSL like that?

Yeah.  It's central to why I like Kansas.  And that code _really_
looks like it's just a simplified reimplementation of some Kansas
code.  I like some of the changes to the syntax in his example,
though.


students = ksdbh.select(:Students)

male_students = ksdbh.select(:Students) {|s| s.gender == 'm'}

males_ordered_by_gpa_between_27_and_40 = ksdbh.select(:Students) do |s|
  s.order_by(:gpa)
  (s.gender == 'm') & (s.age.between(27,40))
end


I've had a Kansas rewrite on my todo list for a very long time.  I am
taking a closer look at some of his syntax ideas.  I like a couple of
them.


Kirk Haines


More information about the Nitro-general mailing list