I’ve been working a bit with litesql the past few days, so I thought I’d review it.
litesql is an object persistence library that uses sqlite as it’s storage backend (although it now also supports MySQL and PostgreSQL). There are two separate components to the system, the library which handles the actual storage mechanism, and the code generator which takes as input an XML specification of your data objects and generates the appropriate C++ classes.
Defining your model and generating the appropriate code is very easy. The XML format is very straightforward, although it limits you to only a handful of datatypes (which actually is a good thing, as it hides details about the storage backend). Additionally, there is support for inheritance between the model objects, and of course litesql supports all the typical relations (one-to-one, one-to-many, and many-to-many). The generator then process your XML specification and outputs two files, yourdatabasename.cpp and yourdatabasename.hpp.
The generated code uses the STL, particularly the string and vector classes, and unfortunately avoids the rather nasty problems that plague all heavily templated code bases–nasty looking syntax and even worse error messages. On the upside, you don’t have to worry about interacting with poorly documented project specific classes that do much the same thing as the STL.
While overall I do like litesql there are a few things that really annoy me. First and foremost, the documentation of the library is sorely lacking. Perhaps the worst case of this comes in attempting to understand how the attributes of class instances work. It seems that they have a type of Field<T>, but in some cases there seem to be overloads that allow you to directly work with this object, e.g. in assignment. However, at other times, you must invoked the value() method of the Field to get to the actual data, e.g. in equality tests.
Finally, my last major problem is that there are (almost) no unit tests. To my mind this is a tremendous problem, particularly for a library. How do the developers know that things are working properly? How do I know that things are working properly? Additionally, while less optimal than true documentation, a set of good tests can give clues as to how things are supposed to work.
Ultimately, without full and proper documentation, it is very difficult to truly judge the library. From what I’ve seen I like it, and it seems to have a lot of promise, but I’m just not sure if it works properly. Given all that, I’d say 80% is a fair judge of the litesql library.