[std.database] at compile time

Graham Fawcett fawcett at uwindsor.ca
Fri Oct 14 20:11:08 PDT 2011


On Fri, 14 Oct 2011 23:58:45 +0200, dennis luehring wrote:

>> One approach would be to write a separate tool that connects to the
>> database and writes out a representation of the schema to a source
>> file. At compile time, the representation is statically imported, and
>> used to verify the data model.
> 
> what about data/fields that don't comes out of the model?
> 
> for example:
> 
> select
>    name_length_add_1,
>    count(*) as counted
> from
>    (
>       select
>         (len(p.firstname) + 1) as name_length_add_1, p.*
>       from
>         persons as p
>         inner join members as m on p.firstname == m.firstname
>    ) as blub
> group by
>    name_length_add_1
> 
> how is the "counted" field or "name_length_add_1" staticaly verified?
> 
> people tend to think that sql is just simple table querying stuff - but
> thats not, not in the real world


Good point. I wasn't thinking of a tool to validate arbitrary SQL 
statements, but one that could validate a D model's correspondence with 
the database schema. Presumably the queries would be generated by the 
library. 

Best,
Graham


More information about the Digitalmars-d mailing list