[GSOC] Database API draft proposal

Christian Manning cmanning999 at gmail.com
Tue Apr 5 13:38:02 PDT 2011


Hello all,

This is the second draft and a lot of changes have been made. Hopefully 
it's a better overall proposal and I look forward to anybody's feedback :)
---------------------------------

Synopsis
--------
An API for databases is a common component of many languages' standard 
library, though Phobos currently lacks this. This project will remedy 
this by providing such an API and also begin to utilise it with 
interfaces for some Database Management Systems (DBMS). I believe this 
will benefit the D community greatly and will help bring attention and 
developers to the language.

Details
-------
Piotr Szturmaj has began working on DDB [1] which has a PostgreSQL 
clietn written in D as well as some database neutral features such as 
the DBRow type for storing rows from a database. Piotr and I have agreed 
to collaborate such that DDB will continue with Piotr at the helm, and I 
will begin implementing other DBMS clients based around his work. Once 
there is another implementation, work will then begin on extracting a 
common interface which will form the API.
For example:

module database;

interface DBConnection {
     //method definitions for connecting to databases go here.
}

Then in an implementation of MySQL:

module mysql;

import database;

class Connection : DBConnection {
     //implement defined methods tailoring to MySQL.
}

Exactly what will go in to these interfaces will depend on the 
differences between the DBMSs, but they all share many things. The API 
should also be developed in conjunction with the D community to minimise 
any fallout of decisions made.

The DBMSs I plan to implement are MySQL and SQLite. Unlike PostgreSQL, 
MySQL doesn't seem to have a long-term and stable client-server 
protocol. As a result of this I will be wrapping around the MySQL C API 
(v5.1) to bring it to D. SQLite will also undergo the same process. 
Because of this, these clients are not likely to get into Phobos and so, 
if the API does then these will be an external package.

If this project is completely successful, there will be a database API 
and at least three DBMS clients ready for use in D applications. The 
minimum amount of functionality for this to be considered successful 
would be an API that is mostly utilised by the PostgreSql and MySQL 
clients. In this scenario there will still be two usable clients, 
however, perhaps the API is not totally complete and neither is the 
SQLite client.

About Me
--------
My name is Christian Manning and I am a second year undergraduate 
studying Computer Science at De Montfort University.
I've become interested in D over time after reading about it several 
years ago. I got myself "The D Programming Language" and went from 
there. Although I've not done anything useful in D as I've learnt mainly 
C and Java and am unable to use D for my university projects, I think 
I'm capable of achieving the goals of this project.

Grades From The Past Year
-------------------------
Internet Software Development:
- XSLT/JSP: 91%
- JSP/MySQL: 70%+ (preliminary grade given in demo)

OO Software Design & Development:
- Data model: 83.33%
- Jetman (create a score + high score system and a configuration panel,
MVC style): 80% (preliminary given in demo)

Database Design & Implementation:
- Data Modelling assignment (ERD, normalisation and the like): 69.17%
- Database implementation (of the solution to the previous, in Oracle):
not yet marked.

Data Structures & Algorithms:
- Circular doubly linked list with cursor in C: not yet marked.

Computational Modelling (1st year):
- Caesar cipher in Haskell: 98%

References
----------
[1] https://github.com/pszturmaj/ddb http://pszturmaj.github.com/ddb/db.html



More information about the Digitalmars-d mailing list