コード例 #1
0
 /**
  * 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;
     }
 }
コード例 #2
0
 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;
 }