cleanup and simplification of database access layer

fixes several warnings

(0) -30 -10 -2 +2 +10 +30 +100 +300 tip

mercurial