Databases and the D Standard Library

Adam Wilson via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 1 17:34:45 PST 2017


Chris Wright wrote:
> On Sat, 31 Dec 2016 19:24:31 -0800, Adam Wilson wrote:
>> My idea: Each data store has it's own implementation with it's own
>> naming convention. For example (ADO.NET):
>> 	- SqlConnection (MSSQL)
>> 	- NpgsqlConnection (Npgsql)
>>
>> Yes, this means that you have to change names in your code if you switch
>> data-stores
>
> You *can* use classes and interfaces and type hierarchies. They do use
> the GC by default, unlike structs, but they're kind of handy, especially
> here.
>

That was my intention, the knee-jerk reaction that class and interfaces 
get here sometimes strikes me as a bit histrionic sometimes. They are a 
tool with a use case. :)

> Then you have a SqlConnection interface that most people use all the time
> and all people use most of the time. If you explicitly need some
> connection properties that are specific to Postgres, you cast to a
> PostgresConnection.
>

That is pretty much how it works in ADO.NET and JDO. And I think it 
works well.

-- 
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;


More information about the Digitalmars-d mailing list