Fixed #31550: MySQL error if profiling not available/not activated in mysql and another bug on mysql driver in debug mode (bug in unreleased 3.1.2 only)

Related tracker:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31550

Related discussion:
https://groups.google.com/forum/#!msg/joomlabugsquad/Ag7l3UQhF8M/dhcDpRznxsUJ

This patch also has a joomla-codestyle cleanup for myslq.php and a single line codestyle cleanup for tags observer.