SQLite3 Phobos branch

Piotr Szturmaj bncrbme at jadamspam.pl
Mon Apr 25 05:26:44 PDT 2011


Alex Khmara wrote:
> On Mon, 25 Apr 2011 12:16:19 +0300, Piotr Szturmaj
> <bncrbme at jadamspam.pl> wrote:
>
>> Alex Khmara wrote:
>>> Second variant is a kind of ORM, and I think it will be too highlevel
>>> for
>>> many cases. But I understand that for web framework it's interesting
>>> direction. As for standard D library, I would like to have something
>>> more
>>> generic and traditional. Probably, something modeled from Perl's DBI,
>>> but
>>> more D-like.
>>
>> Hi,
>>
>> Please take a look at https://github.com/pszturmaj/ddb
>>
>> I also plan to support SQLite3 and MySQL.
>
> Thank you for posting link to your library.
>
> I think we need to collect different ideas about useful and handy API,
> and then try to work out D-style DB interface.
>
> And it's very good that there is somebody who work with Postgres - but
> for generic interface we will need to use minimal possibilities set,
> present on all databases - or make some "layered" structure, like ranges
> (by the way, SELECT result is a forward range by it's nature, so it would
> be reasonable to make it conforming to Forward Range specification.

In my Postgres implementation SELECT result is an Input Range, since 
Forward Range implies position saving and that's possible only with cursors.

I think we could loosely follow .NET approach where each client has 
separate class with its own capabilities. On top of that there's a 
wrapper which abstracts all clients to one minimal api set. Actually 
strictly speaking it's under that rather than on top, I mean polymorphic 
DBConnection and its descendands. I think such an approach may be good 
to consider.

Class hierarchy could then look like this:

DBConnection
|
  \
   SqliteConnection
   MySqlConnection
   PostgresConnection


More information about the Digitalmars-d mailing list