C++0x now with lambda and closure

BCS BCS at pathlink.com
Tue Apr 1 09:48:50 PDT 2008


Robert Fraser wrote:

> One of my D library ideas that fell by the wayside was to make a 
> compile-time SQL parser. So you could do something like:
> 
> string[] results = Query!("
>         SELECT groups.name
>             FROM groups
>             INNER JOIN employees ON employees.groupId = groups.id,
>             GROUP BY employees.groupId
>             HAVING avg(employees.salary) > 50000
>             WHERE group.name != "Accounting" -- Nobody likes them
>             ORDER BY group.name
>     ");
> 
> (or something like that; my SQL's a bit rusty). Ideally, you could have 
> an arbitrarily complex query including subqueries. Query would be a 
> template of some sort... not sure exactly how this would work... but 
> that's my pipe dream, anyway.

I have wanted to make a template that lets you define a DB class with 
stored procedures accessed through methods. It would work a lot like the 
above but would optimize the queries at compile time.

The parser for either case would be big, slow and a memory hog but it 
can be built.


More information about the Digitalmars-d-announce mailing list