Fix database transaction scope for resources endpoint
Fix database transaction scope for resources endpoint

Prior to this commit, the database transaction scope for
the `resources` endpoint did not encapsulate the `get-result-count`
call; this caused an error when handling requests that asked
for the count header.

puppetlabs/puppetdb,johnduarte/puppetdb,senior/puppetdb,kbarber/puppetdb,grimradical/puppetdb,johnduarte/puppetdb,rbrw/puppetdb,johnduarte/puppetdb,cprice404/puppetdb,shrug/puppetdb,puppetlabs/puppetdb,mullr/puppetdb,mullr/puppetdb,waynr/puppetdb,waynr/puppetdb,wkalt/puppetdb,johnduarte/puppetdb,rbrw/puppetdb,puppetlabs/puppetdb,cprice404/puppetdb,highb/puppetdb,kbrezina/puppetdb,kbarber/puppetdb,mullr/puppetdb,waynr/puppetdb,jantman/puppetdb,highb/puppetdb,waynr/puppetdb,grimradical/puppetdb,kbarber/puppetdb,shrug/puppetdb,ajroetker/puppetdb,grimradical/puppetdb,wkalt/puppetdb,senior/puppetdb,ajroetker/puppetdb,shrug/puppetdb,highb/puppetdb,senior/puppetdb,senior/puppetdb,rbrw/puppetdb,highb/puppetdb,grimradical/puppetdb,ajroetker/puppetdb,wkalt/puppetdb,jantman/puppetdb,cprice404/puppetdb,mullr/puppetdb,shrug/puppetdb,kbrezina/puppetdb,kbrezina/puppetdb,puppetlabs/puppetdb,puppetlabs/puppetdb,jantman/puppetdb,kbarber/puppetdb,rbrw/puppetdb,ajroetker/puppetdb,rbrw/puppetdb,wkalt/puppetdb,mullr/puppetdb,kbrezina/puppetdb