Abstract Database Interface

BLM768 blm768 at gmail.com
Mon Oct 29 20:22:22 PDT 2012


>
> If I recall correctly, Squeryl use Scala AST macros to support 
> a query syntax, that in D would look, as below:
>
> class Person : Model { }
>
> void main ()
> {
>     auto p = new Person;
>     p.name = "John Doe";
>     p.save();
>
>     p = Person.where!(x => x.name == "John Doe");
> }

If you make x some fancy wrapper type containing more fancy 
wrapper types with overloaded equality operators that return some 
sort of Expression class instead of a boolean, you might actually 
be able to get this to work with only D's current features. 
However, that would kind of destroy the hope of efficiency. :)

What might be nice is a database written in D that completely 
eschews SQL in favor of a native API. I might have to play with 
that eventually, but I'll probably give it a while because it 
would be a huge project, and, like most people, I'm under time 
constraints. :)




More information about the Digitalmars-d-announce mailing list