[std.database]

Piotr Szturmaj bncrbme at jadamspam.pl
Sun Oct 9 05:28:11 PDT 2011


Steve Teale wrote:
> I use this title at Andrei's suggestion, and repeat his idea that it be used
> as a prefix for discussions as we navigate toward a design. Unless there is
> resistance to the idea, I will on the job of implementing whatever we decide
> is appropriate. I am retired, and have the time to do it.
>
> It seems that every man, and possibly his dog, has a private implementation
> for at least a favorite DB, so we should have plenty of material to build on.
>
> At this point I would like to get responses from those who feel they are
> likely to contribute to the design through to completion.
>
> I'd also like to get a feel for the magnitude of the task, so I'd like to ask
> what database systems you think should be supported.
>
> I have started a github account, and will put my mysqld stuff there shortly,
> then you can kick me out if you don't like what you see.

1. I think that we should not design this API using the least common 
denominator approach. This is to not limit some databases. For example 
PostgreSQL has many great features not available in MySQL. That's why I 
started with postgres in my ddb project. I think DB API should be 
designed to support the most featureful databases and those that have 
less features may be easily adapted to that API.

Some PostgreSQL vs MySQL differences to note:

- the former does support arrays and composite types that may be stored 
in single column, the latter doesn't
- the former support asynchronous queries, but I guess its not that 
important
- the former support async notifications (for example, fired by a 
trigger, or when server is shutting down)

2. Compile type mapping of fields should support postgres's composites 
and arrays. For example, this is obvious:

execQuery!(int, string)("select 5, 'abc'");

but this is not:

execQuery!(int, string)("select ROW(5, 'abc')"); // valid postgres query

Does it return two columns or one composite column? I already addressed 
this ambiguities in ddb, please see documentation on github 
(http://pszturmaj.github.com/ddb/db.html). See also 'advanced example' 
on that page.

3. I think that compile type mapping of fields should be generalized to 
not only support DB API. It could also be used with CSV files or other 
tabular data. It may also be extended to support tree structures with 
XML (mapping xml to structs/tuples/arrays).


More information about the Digitalmars-d mailing list