SQLite Database layer

Improvements in the SQLite Database layer and its interfaces and
implementations.