Fixes issue with thread-safety on with-db

I've added 2 tests to the integration test with-db

The tests:

1.  verify that the version of the with-db I wrote to fix lazyness broke thread safety on the with-db macro.   
2.  verify that my new version fixes the thread safety issue.

Let me know what you think of this.