std.database
lobo via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 27 23:00:15 PDT 2015
On Thursday, 28 May 2015 at 05:00:30 UTC, Rikki Cattermole wrote:
> On 28/05/2015 4:57 p.m., 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
>
> Then you open up table names, property serialization ext. ext.
> Please no.
> That is an ORM's job. I'm saying this from experience.
+1 for decoupling ORMish stuff from the DB driver layer but I
agree with Robert, std.database should have an ORM layer on top
of its DB drivers. It's powered by D and writing an ORM layer in
D is easy.
The hard part, as is always the case, is agreeing on the API for
Phobos inclusion.
bye,
lobo
More information about the Digitalmars-d
mailing list