Improvement over #16

The executeSingleQuery(dir, query) cares about opening and closing
connection to database. I’ve used it in createEmptyRepo and
addArtifact, but it could/should be used in other functions as well.