Database: document, re-add a test and use a value type rather than strings

We
- fix up the database interface to make it look more uniform and more like the stdlib
- use a value type rather than strings, to avoid excess s-expression marshalling and unmarshalling
- untangle a unit test from a client/server test and run this from the build
- add missing licensing headers