pkg/graphdb: better transaction handling

This uses the actually transaction API of 'database/sql'. In so, this
fixes the sqlite locking issue when building docker on go1.4
Related to #9615 

Local tests are failing to resolve index.docker.io, not sure it's related to this PR (http://pastebin.com/vkYzcAU5)

Signed-off-by: Vincent Batts <vbatts@redhat.com>