/** * Conecta no banco */ protected function connect() { try { $this->con = PDOSingleton2::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::$carregada2) { if (NULL == self::$con2) { self::$con2 = new PDO($urlCon, $user, $pass); } self::$carregada2 = TRUE; return self::$con2; } return self::$con2; }