db: don't let dbMain() mess with main db
db, db_test: convert dbMain() into a test