forked from leftypol/leftypol
database.php: minor format
This commit is contained in:
parent
52759954c8
commit
cc82987bb0
1 changed files with 5 additions and 7 deletions
|
@ -70,9 +70,9 @@ function sql_open() {
|
|||
if (!empty($config['db']['dsn']))
|
||||
$dsn .= ';' . $config['db']['dsn'];
|
||||
try {
|
||||
$options = array(
|
||||
$options = [
|
||||
PDO::ATTR_TIMEOUT => $config['db']['timeout'],
|
||||
);
|
||||
];
|
||||
|
||||
if ($config['db']['type'] == "mysql")
|
||||
$options[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = true;
|
||||
|
@ -81,13 +81,11 @@ function sql_open() {
|
|||
$options[PDO::ATTR_PERSISTENT] = true;
|
||||
$pdo = new PDO($dsn, $config['db']['user'], $config['db']['password'], $options);
|
||||
|
||||
if ($config['debug'])
|
||||
if ($config['debug']) {
|
||||
$debug['time']['db_connect'] = '~' . round((microtime(true) - $start) * 1000, 2) . 'ms';
|
||||
if ($config['db']['type'] == "mysql"){
|
||||
if (mysql_version() >= 50503)
|
||||
query('SET NAMES utf8mb4') or error(db_error());
|
||||
else
|
||||
if ($config['db']['type'] == "mysql") {
|
||||
query('SET NAMES utf8') or error(db_error());
|
||||
}
|
||||
}
|
||||
return $pdo;
|
||||
} catch(PDOException $e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue