[GSOC] Database API draft proposal

Fawzi Mohamed fawzi at gmx.ch
Sun Apr 3 08:23:47 PDT 2011


On 3-apr-11, at 16:52, Piotr Szturmaj wrote:

> [...]
> Thanks. At this time, you can write an interface for MySQL, SQLite  
> or other relational databases, using the same DBRow struct. Naming  
> of course may be changed to DataRow, Row or other, depending on the  
> choice of community.
>
> In regards of base interfaces like IConnection or (semi-)abstract  
> class DBConnection, I think we should have common API for all  
> clients, but only to some extent. There are many features available  
> in some database servers, while not available in others, for example  
> OIDs (object identifiers) are fundamental thing in PostgreSQL, but  
> they simply don't exist in MySQL. So, PGCommand would give you  
> information on lastInsertedOID, while MySQLCommand would not.
> This is also proven in ADO.NET, where each client is rarely used  
> with common base interface, because it blocks many of its useful  
> features.
>
> I think base interface should be defined only after some of the most  
> popular RDBMS clients are finished. Also interface should be choosen  
> to cover the most featured/advanced database client. This is why I  
> started with PostgreSQL, as its the most powerful open-source RDBMS.  
> If base interface will cover it, it will also cover some less  
> powerful RDBMSes.

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.
So I would try to improve the way one describes a table, or a full  
database.
Your DBRow type is definitely nice, and is a good starting point, but  
there is definitely more work to do (not that you had said otherwise :).

Fawzi


More information about the Digitalmars-d mailing list