switch from utf8 to utf8mb4 on the database level

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO
2017-06-24 06:07:38 +00:00
parent 44760a7e0f
commit 1a0acb0185
10 changed files with 39 additions and 28 deletions

View File

@ -202,6 +202,7 @@ $config['DB_HOSTNAME'] = 'localhost';
$config['DB_USERNAME'] = 'piler';
$config['DB_PASSWORD'] = 'piler';
$config['DB_DATABASE'] = 'piler';
$config['DB_CHARSET'] = 'utf8mb4';
$config['SPHINX_DRIVER'] = 'sphinx';
$config['SPHINX_DATABASE'] = 'sphinx';

View File

@ -10,8 +10,8 @@ class MySQL {
try {
$this->link = new PDO("mysql:host=$hostname;dbname=$database", $username, $password,
array(
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
PDO::MYSQL_ATTR_INIT_COMMAND => "SET CHARACTER SET utf8"
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES " . DB_CHARSET,
PDO::MYSQL_ATTR_INIT_COMMAND => "SET CHARACTER SET " . DB_CHARSET
)
);

View File

@ -9,7 +9,7 @@ class Sphinx {
list($host, $port) = explode(":", $hostname);
try {
$this->link = new PDO("mysql:host=$host;port=$port;dbname=$database;charset=utf8", $username, $password);
$this->link = new PDO("mysql:host=$host;port=$port;dbname=$database;charset=" . DB_CHARSET, $username, $password);
}
catch(PDOException $exception) {
exit('Error: ' . $exception->getMessage() . " on database: $database<br />");