Introduce a method to set any MySQL session SQL mode

Rather than implement a method just for the special case of setting
MySQL TRADITIONAL mode, implement one that can set any supported
server mode, and reimplement the old method as a wrapper around that.

In addition, check the actual effective SQL mode
(as per SHOW VARIABLES LIKE 'sql_mode'), and log a warning if it's
deemed unsafe.

Co-author: Ben Nemec <openstack@nemebean.com>

Change-Id: I90139b915b2ff169878fd93625e5320d39094ed3