move some generic functions out of a class
Revert "remove n_tuples from MysqlRes, won't be set if using SQL_NO_CACHE"

This reverts commit 2701946ac90c1d4eff3abaa606dd3ae2bce2b570.
if a hash doesn't match, pass along the failed range end so the other end can subdivide the remainder if the first hash in the subdivided failed range does match
combine commands in another case, to further support pipelining
combine commands in another case, to further support pipelining