Add Database class.

Also move clear-db utility from test to Database->clear().
Move xquery modules into subdir.