CRM-17394 - Initialize DB slightly later. Fix query-log and redundant SET NAMES.
Strictly speaking, this patch does two different things:
* Initialize DB slightly later. This fixes a race among settings-manager, DB init, and query logging.
* Call `SET NAMES utf8` once during connection init. Before, it was called once for every DAO object.
Based on quick spot-check, it still seems to store UTF-8 data. To be safe,
I've added an extra error-check to ensure that the `SET NAMES utf8` is still
called before we actually use the DAO.