MySQLi implementation - Some errors could exist.
Fix for #597; #599; #600; #598; #602; #603; #415; #586; #608; #612; #607; #598;