Make sqlite connection lazy

The patch makes sqlite database connection lazy.

If the sqlite connection is created in a thread and then accessed from
another one, it'll fail mentioning that the connection is not thread
safe and that sqlite objects should be accessed from within the thread
the connection was created in.

Creating the connection instance at the very end alleviates this issue
but it doesn't fix it completely. It is still possible to create a
connection in a sub thread and then access it from another one. This
patch just makes that less probable by creating the instance when it's
actually needed.

Closes-bug: 1257093

Change-Id: I2ce46c20158fbf090a25736b3afc1dd32437af24
Merge "Make sqlite connection lazy"