Move the actual sqlite execution to a helper.

There will soon be many more commands, so wrapping this makes sense.

Change-Id: I75a28f3fcff77feee158f018b016b7a24954c580