Ensure variables in database classes are defined, used and correctly cased

Change-Id: I12065b2c2bae1c000edac3c92d1db0c03fc40f90
Merge "Ensure variables in database classes are defined, used and correctly cased"