Add a database/sql compatible store.

It's very inefficient at the moment. Need to rethink the interfaces.