mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 21:28:02 +02:00
MySQL & MySQLi: added timezone configuration option
This commit is contained in:
@@ -80,6 +80,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
|
||||
// default values
|
||||
DibiConnection::alias($config, 'flags', 'options');
|
||||
if (!isset($config['charset'])) $config['charset'] = 'utf8';
|
||||
if (!isset($config['timezone'])) $config['timezone'] = date('P');
|
||||
if (!isset($config['username'])) $config['username'] = ini_get('mysql.default_user');
|
||||
if (!isset($config['password'])) $config['password'] = ini_get('mysql.default_password');
|
||||
if (!isset($config['host'])) {
|
||||
@@ -131,7 +132,9 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
|
||||
$this->query("SET sql_mode='$config[sqlmode]'");
|
||||
}
|
||||
|
||||
$this->query("SET time_zone='" . date('P') . "'");
|
||||
if (isset($config['timezone'])) {
|
||||
$this->query("SET time_zone='$config[timezone]'");
|
||||
}
|
||||
|
||||
$this->buffered = empty($config['unbuffered']);
|
||||
}
|
||||
|
@@ -81,6 +81,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
|
||||
} else {
|
||||
// default values
|
||||
if (!isset($config['charset'])) $config['charset'] = 'utf8';
|
||||
if (!isset($config['timezone'])) $config['timezone'] = date('P');
|
||||
if (!isset($config['username'])) $config['username'] = ini_get('mysqli.default_user');
|
||||
if (!isset($config['password'])) $config['password'] = ini_get('mysqli.default_pw');
|
||||
if (!isset($config['socket'])) $config['socket'] = ini_get('mysqli.default_socket');
|
||||
@@ -132,7 +133,9 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
|
||||
$this->query("SET sql_mode='$config[sqlmode]'");
|
||||
}
|
||||
|
||||
$this->query("SET time_zone='" . date('P') . "'");
|
||||
if (isset($config['timezone'])) {
|
||||
$this->query("SET time_zone='$config[timezone]'");
|
||||
}
|
||||
|
||||
$this->buffered = empty($config['unbuffered']);
|
||||
}
|
||||
|
Reference in New Issue
Block a user