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

Signed-off-by: Vincent Batts <vbatts@redhat.com>
pkg/graphdb: move the db.get() before tx

the db.get() can not happen inside the transaction

Signed-off-by: Vincent Batts <vbatts@redhat.com>