On Friday 19 August 2005 9:14 am, Jamey Cribbs wrote:

> Ok, here is a somewhat simplified code example.  Let's say you have a
> table that holds information about WWII airplanes.  You want to write a
> query that selects all planes from the table that belonged to the US and
> had a top speed greater than 350mph.  First you would write the query,
> using a block to specify the actual select condition:
>
> results = plane_tbl.select { |r| r.country == 'USA' and r.speed > 350 }

I *heart* that sort of query syntax.  You'll see much the same thing in the 
Kansas ORM:

results = ksdbh.select(:Planes) {|r| (r.country == 'USA') & (r.speed > 350)}

In this case, method_missing magic is mixed into that in such a way that the 
Ruby code becomes a SQL statement for querying a relational database.

It's a great way of interacting with data.  Neat to see that KirbyBase is 
doing that.


Kirk Haines