C++0x now with lambda and closure

Ralf Schneider ralfs72_at_ at gmx.net
Tue Apr 1 11:04:10 PDT 2008


>
> 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.

Have a look at Ultimate++: 
http://www.ultimatepp.org/src$Sql$SqlExp$en-us.html
but in C++ and without strings like:

Select(COLUMN)
.From(TABLE)

.Where(COLUMN == (Select(COLUMN1).From(TABLE1) -

       Select(COLUMN2).From(TABLE2)))






More information about the Digitalmars-d-announce mailing list