public final function getConnection() { if ($this->conn === null) { if (self::$pdo == null) { self::$pdo = new PDO($GLOBALS['DB_DSN'], $GLOBALS['DB_USER'], $GLOBALS['DB_PASSWD']); } $this->conn = $this->createDefaultDBConnection(self::$pdo, $GLOBALS['DB_DBNAME']); } return $this->conn; }
public function getConnection() { if (!$this->conn) { if (!self::$pdo) { self::$pdo = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } $this->conn = $this->createDefaultDBConnection(self::$pdo, DB_NAME); } return $this->conn; }