Stmt rebase rebase

I did a fairly naive rebase of this branch onto the current master, then applied pretty much the same fixes I applied in https://github.com/brianmario/mysql2/pull/476 . Turns out they were still required.