/** * Constructor. Get singleton instance via \iveeCore\SDE::instance() instead. * * @param \mysqli $db is an optional reference to an existing DB connection object */ protected function __construct(\mysqli $db = null) { if (!isset($db)) { $db = new \mysqli(Config::getDbHost(), Config::getDbUser(), Config::getDbPw(), Config::getDbName(), Config::getDbPort()); if ($db->connect_error) { exit('Fatal Error: ' . $db->connect_error . PHP_EOL); } } elseif (!$db instanceof \mysqli) { exit('Fatal Error: parameter given is not a mysqli object' . PHP_EOL); } $this->db = $db; //ivee uses transactions so turn off autocommit $this->db->autocommit(false); //eve runs on UTC time $this->db->query("SET time_zone='+0:00';"); }