Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
d6bb4d21d8 database.php: set utf8mb4 charset 2024-12-08 01:35:15 +01:00

View file

@ -66,7 +66,7 @@ function sql_open() {
$dsn = $config['db']['type'] . ':' . $dsn = $config['db']['type'] . ':' .
($unix_socket ? 'unix_socket=' . $unix_socket : 'host=' . $config['db']['server']) . ($unix_socket ? 'unix_socket=' . $unix_socket : 'host=' . $config['db']['server']) .
';dbname=' . $config['db']['database']; ';dbname=' . $config['db']['database'] . ';charset=utf8mb4';
if (!empty($config['db']['dsn'])) if (!empty($config['db']['dsn']))
$dsn .= ';' . $config['db']['dsn']; $dsn .= ';' . $config['db']['dsn'];
try { try {
@ -84,9 +84,6 @@ function sql_open() {
if ($config['debug']) { if ($config['debug']) {
$debug['time']['db_connect'] = '~' . round((microtime(true) - $start) * 1000, 2) . 'ms'; $debug['time']['db_connect'] = '~' . round((microtime(true) - $start) * 1000, 2) . 'ms';
if ($config['db']['type'] == "mysql") {
query('SET NAMES utf8') or error(db_error());
}
} }
return $pdo; return $pdo;
} catch(PDOException $e) { } catch(PDOException $e) {