Refactor Database API

Mostly from Kip's suggestions. Language refactoring, incomplete.

Change-Id: I8a57dbad7bdf3bb582e22813f7bfb0dcbc9bd284
Merge "Refactor Database API"