Move queries from db/adapter to db/dbu/adapter

The config change for this happened (accidentally) in an earlier commit, this
brings the files into order.
Factor out preview code into modules

Keeps the actual adapter simpler and reflects this is an orthogonal concern.
Update queries with prepare and preview