mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX #3910 Setting timezone parameter to MySQLDatabase::__construct() should use $this->query() to be consistent
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@111889 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
507f9909bd
commit
5453c1a99d
@ -51,7 +51,7 @@ class MySQLDatabase extends SS_Database {
|
||||
* - username: The username to log on with
|
||||
* - password: The password to log on with
|
||||
* - database: The database to connect to
|
||||
* - timezone: (optional) the timezone offset, eg: +12:00 for NZ time
|
||||
* - timezone: (optional) The timezone offset. For example: +12:00, "Pacific/Auckland", or "SYSTEM"
|
||||
*/
|
||||
public function __construct($parameters) {
|
||||
$this->dbConn = mysql_connect($parameters['server'], $parameters['username'], $parameters['password'], true);
|
||||
@ -63,13 +63,12 @@ class MySQLDatabase extends SS_Database {
|
||||
|
||||
$this->active = mysql_select_db($parameters['database'], $this->dbConn);
|
||||
$this->database = $parameters['database'];
|
||||
if(isset($parameters['timezone'])) { //set timezone to custom parameter
|
||||
mysql_query("SET SESSION time_zone='" . $parameters['timezone'] . "'");
|
||||
}
|
||||
|
||||
if(!$this->dbConn) {
|
||||
$this->databaseError("Couldn't connect to MySQL database");
|
||||
}
|
||||
|
||||
|
||||
if(isset($parameters['timezone'])) $this->query(sprintf("SET SESSION time_zone = '%s'", $parameters['timezone']));
|
||||
$this->query("SET sql_mode = 'ANSI'");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user