Databases and the D Standard Library

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 1 08:50:03 PST 2017


On Sun, 01 Jan 2017 10:29:28 +0100, Jacob Carlborg wrote:

> On 2017-01-01 04:24, 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, but since you are already changing your queries,
>> which is a much more difficult change, this isn't a significant
>> additional cost.
> 
> I don't think we should try to make implementations different just
> because. If you have an SQL builder or an ORM on top of the interface
> that abstract the differences in the SQL syntax, it's possible to switch
> driver, within reason.

Those both limit your ability to use the underlying database to its full 
potential. They offer a chance for queries that seem simple and efficient 
to become horribly inefficient.

I ran across a problem in NHibernate about a decade ago. We had a 
straightforward HQL query involving joins. It took over a minute to run. 
We wrote the simple equivalent in SQL and it completed in milliseconds. 
Fortunately, NHibernate had the ability to run raw SQL queries.


More information about the Digitalmars-d mailing list