Fix csrl cleanup phase 1

Here are 9 commits from @csrl which I believe are okay all of them. I have run tests and they pass but do note that many of these patches works on the connection pool management and that is not really tested that much by our current test code coverage.

I have run through all commit up to (but not including) https://github.com/csrl/emysql/commit/d1a7a2cd119b12cdde26de4651f30f0cea6db3fb .. So to continue we should start from there and take another phase of cleanups. While many of changes looks sound, they also messed a bit more when I tried to patch up the code base, so I need a fresh look later to continue on those.

Note that due to whitespace, many of the commits require some careful manual handling, so it is not that easy to get them in.