/** * Conecta no banco */ protected function connect() { try { $this->con = PDOSingletonEAD::getInstance($this->dbType . ":host=" . $this->host . ";dbname=" . $this->db2, $this->user, $this->password); } catch (Exception $e) { echo "ERRO ..." . $e->getMessage() . " "; die; } }
public function getInstance($urlCon = null, $user = null, $pass = null) { if (FALSE == self::$carregadaEAD) { if (NULL == self::$conEAD) { self::$conEAD = new PDO($urlCon, $user, $pass); } self::$carregadaEAD = TRUE; return self::$conEAD; } return self::$conEAD; }