Few years back our organization is working on an application that accesses database frequently. The software is being developed using C++. The initial phase of development was smooth. However, soon we realized that our database access code is boring to write, tedious to debug and more or less horrible to look at. Most of the problems can be attributed to the following reasons:
Most of the code is duplicated. Not much of thinking goes into writing the access code once the SQL has been decided.
The database access libraries provides interfaces in terms of the low level language constructs like char*, int etc. There are times developers forget to put an & before a variable name!.
Where as our wrapper classes provides the necessary abstraction to access the database, the abstraction is not high-level enough for us to enjoy writing code.
Still the database access is in terms of columns. It is upto the developers to put all columns together and make a C++ class out of it.
We developed a small tool (was called SQLparser) to generate wrapper code to C++ classes. This tool reads code written in a specific format (more like PL/SQL code) and spits out C++ class code that can access the database. We found the tool to be very useful in our regular development. We reduced the LOC of database access by almost 1/10th.
It is time to revise SQLparser and make it more useful. There were problems with the original tool - the tool accepts format that looks like english and most of us are C++/Java developers. Another problem is that SQLparser always insists that we pass an object even when we want to get a single integer from the database. The tool generated code is not generalized enough. For example, if we want to get each record from a table and do some processing, the only way to achieve was to get the result in a vector, process and delete the vector. Lastly, I am hearing about Antlr and it is time I have a look at it ;-).
The end result is DAME - Database Access Made Easy. This version removes almost all the problems that existed with SQLparser. I enjoyed developing it and we started to use it in one of our projects already. I hope you enjoy using it.