public function connect($connect_string, $db_user, $db_pass)
{
// If something went wrong, we don't need to exec the specific commands.
if (!parent::connect($connect_string, $db_user, $db_pass)) {
return false;
}
$this->pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
// Everything is OK. Let's update the charset!
if (!defined('MYSQL_CHAR_SET')) {
define('MYSQL_CHAR_SET', 'UTF8');
}
// SET NAMES defines character_set_client, character_set_results, and character_set_connection (which implicitly sets collation_connection) and therefore covers everything SET CHARACTER SET does, but uses the character set we tell it to, ignoring what the database is configured to use
// http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html
$this->exec('SET NAMES ' . MYSQL_CHAR_SET);
return true;
}