how to build up the library..

Steve Teale steve.teale at britseyeview.com
Thu Oct 6 22:24:16 PDT 2011


Andrei,

I was thinking the same thing about the C level interface sometime in the middle
of last night. A straight translation of mysqld could be put there almost
immediately. I have to make myself translate the character set stuff, and add
that, but it's probably only a days work.

As for the interface, I was influenced at the intermediate level by my memory of
using C#.

I think that a DB interface for D should be something that provides an understood
set of facilities rather than an interface in the language sense that provides
certain specific methods. This would allow a decent job to be done on individual
databases strengths, while making it easy for D programmers to move from one to
another. I will write up a summary of my thoughts later today, and post it here.

Briefly, I had thought of variants, but am also attracted to the idea of
'compatible structs'. These would be struct definition that when fed to a suitable
template function, could be determined to be a match for a stated query - a bit
like isForwardRange ;=). Other templates would be provided to automate the process
of 'applying' arrays of such structs to/from the database. Similar facilities
could be provided for arrays of arrays of variants.

At an even higher level one could have templates that implemented entire
operations, like updating a batch of records.

D's template facilities make such stuff easy to implement once you have certain
primitives to base them on. I am at that point now. I have bridgehead and can
consider breakout.

Steve


More information about the Digitalmars-d mailing list