std.database

Sebastiaan Koppe via Digitalmars-d digitalmars-d at puremagic.com
Thu May 28 02:18:52 PDT 2015


On Thursday, 28 May 2015 at 04:57:55 UTC, Robert burner Schadek 
wrote:
> On Thursday, 28 May 2015 at 04:45:52 UTC, Erik Smith wrote:
>>> Shouldn't the statement be reusable?
>>
>> Yes it should.  I added this use case:
>>
>> auto stmt = con.statement("insert into table values(?,?)");
>> stmt.execute("a",1);
>> stmt.execute("b",2);
>> stmt.execute("c",3);
>>
>
> struct Table;
>
> Table a, b, c;
>
> con.insert!Table(a);
> ...
>
> if you use CTFE to create the statement string there is no 
> reason to reuse it.
> it will be string literal, that's even better! Think Big. Think 
> D
>
> the other code is Java not D

That might be, but doing struct-table mappings will open a big 
can of worms, not to mention all the syntax opinions (optional 
and default values, table relationships, etc). Beter build layer 
by layer.

Besides, some people dont believe the orm hype, and would be 
happy to build their own query generation layer on top of a 
low-level sql library, not one tainted with ctfe and template 
mixins.


More information about the Digitalmars-d mailing list