[std.database]

Jacob Carlborg doob at me.com
Tue Oct 11 23:35:38 PDT 2011


On 2011-10-11 23:09, Johann MacDonagh wrote:
> On 10/11/2011 4:07 AM, Jacob Carlborg wrote:
>>
>> I think that the use of opDispatch and selecting with a struct should be
>> available at the higher level interfaces and not in the low level
>> interface.
>>
>
> What do you mean by this? Do you mean instead of having the opDispatch
> in the Connection class, we'd have it in a separate struct / template /
> other magic? This would allow us to utilize this method for other
> sources of data, such as XML.

Something like that. Take advantage of opDispatch in a more ORM like 
interface. Which also hides the connection and executing of raw SQL.

> On the other hand though, this doesn't add a whole lot. Let's say we had
> this code:
>
> auto rows = db.execute("SELECT score, a.user FROM users a JOIN scores b
> on a.user = b.user");
> foreach (row; rows) {
> writeln(to!int(row["score"]));
> }

I think that the above code would sit in a middle layer between the 
lower level of the database driver and a higher level of an ORM like 
interface. See my reply to one of Andrei's posts.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list