opEquals/opCmp returning other types

Jacob Carlborg doob at me.com
Mon Mar 19 01:31:57 PDT 2012


On 2012-03-19 01:54, Brian Palmer wrote:
> I'm working on a DSL for generating SQL queries, based loosely on
> Python's SQLAlchemy and Ruby's Sequel. One nice thing about the DSL is
> the compact syntax for specifying WHERE clauses. With some fiddling, I
> got it working for opEquals, a simplified example:
>
> foreach(network; db["networks"].each) {
> writefln("network: %s", network.name);
> foreach(host; db["hosts"].where(db.c.id == network.id)) {
> writefln("\thost: %s", host.address);
> }
> }

I've been playing with the exact same idea:

Foo.where(x => x.name == "foo");

Generates this SQL:

select foos.* from foos where foos.name = 'foo'

I was hoping this would work for the other operators as well.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list