This is actually a difficult one and will require getting into the C code. Easier to redo RMySQL with Rcpp?