Perform work in db.js inside an anonymous function.

This provides a module-like scope in which to declare functions and variables
that should not pollute the shell's global scope.