database.c: implement the DB_find_* API