[GSOC] Database API draft proposal

Piotr Szturmaj bncrbme at jadamspam.pl
Sun Apr 3 09:37:50 PDT 2011


Fawzi Mohamed wrote:
> I think that you project looks nice, but see some of the comments in my
> other message.
> I would for example consider separating table definition from row
> object, and while your row object is really nice, often one has either a
> single DB model, described in a few model files or goes with a fully
> dynamic model.
> In large project one does not/should not, define RowTypes on the fly
> everywhere in the code.

There's no need to declare all row types. DBRow support both static and 
dynamic models. For dynamic rows, DBRow uses Variant[] as its underlying 
type. This is previous sample code, but changed to use dynamic row:

auto cmd = new PGCommand(conn, "SELECT typname, typlen FROM pg_type");
auto result = cmd.executeQuery;

foreach (row; result)
{
     // here, row subtypes a Variant[]
     writeln(row[0], ", ", row[1]);
}

Btw. I've just updated documentation, so you can take another look :)


More information about the Digitalmars-d mailing list