Few more fixes to databaseformatter along with a simple test case.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>