[std.database]

Johann MacDonagh johann.macdonagh.no at spam.gmail.com
Tue Oct 11 17:41:26 PDT 2011


On 10/11/2011 5:46 PM, Adam Ruppe wrote:
> Andrei Alexandrescu wrote:
>> The database engine should be codified in the connection string,
>> not in the type name.
>
> Why?
>
> If it's in the type, you can trivially specialize for different
> engines and get static checking for functions not supported
> across them all, or runtime checking if you prefer.
>
> You can also change the constructors to make it clear what
> is being created.

Agreed. In addition, if DbConnection handled all connections based on 
the connection string (of course, we're assuming connection strings are 
all unique here), then DbConnection would have to be modified to support 
a new driver.

DbConnection should have the lowest common denominator implementation / 
abstract routines, and the specialized Connection classes would work 
from that. That's how ADO.net works at least.


More information about the Digitalmars-d mailing list