Abstract DB implementation, trying to be too clever.  Implements a switchable database backend.