Modify database commands to specify a particular database

Rather than using a hard-coded database, we now specify the
database file / connection. This will make it easier to use
an in memory database for testing.
Start of test suite
Untested draft of makematch function