connect() public method

Connect to the db
public connect ( )
コード例 #1
0
ファイル: Mysql.php プロジェクト: raz0rsdge/horde
 /**
  * Connect to the db
  */
 public function connect()
 {
     if ($this->_active) {
         return;
     }
     parent::connect();
     // ? $this->_connection->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
     // Set the default charset. http://dev.mysql.com/doc/refman/5.1/en/charset-connection.html
     if (!empty($this->_config['charset'])) {
         $this->setCharset($this->_config['charset']);
     }
 }
コード例 #2
0
ファイル: Pgsql.php プロジェクト: horde/horde
 /**
  * Connect to the db.
  *
  * @throws Horde_Db_Exception
  */
 public function connect()
 {
     if ($this->_active) {
         return;
     }
     parent::connect();
     $this->_lastQuery = $sql = "SET datestyle TO 'iso'";
     $retval = $this->_connection->exec($sql);
     if ($retval === false) {
         $error = $this->_connection->errorInfo();
         throw new Horde_Db_Exception($error[2]);
     }
     $this->_configureConnection();
 }
コード例 #3
0
ファイル: Pgsql.php プロジェクト: jubinpatel/horde
 /**
  * Connect to the db.
  *
  * @throws Horde_Db_Exception
  */
 public function connect()
 {
     if ($this->_active) {
         return;
     }
     parent::connect();
     $this->_lastQuery = $sql = "SET datestyle TO 'iso'";
     $retval = $this->_connection->exec($sql);
     if ($retval === false) {
         $error = $this->_connection->errorInfo();
         throw new Horde_Db_Exception($error[2]);
     }
     // Money type has a fixed precision of 10 in PostgreSQL 8.2 and below, and as of
     // PostgreSQL 8.3 it has a fixed precision of 19. PostgreSQLColumn.extract_precision
     // should know about this but can't detect it there, so deal with it here.
     Horde_Db_Adapter_Postgresql_Column::$moneyPrecision = $this->postgresqlVersion() >= 80300 ? 19 : 10;
     $this->_configureConnection();
 }
コード例 #4
0
ファイル: Sqlite.php プロジェクト: horde/horde
 /**
  * Connect to the db.
  *
  * @throws Horde_Db_Exception
  */
 public function connect()
 {
     if ($this->_active) {
         return;
     }
     parent::connect();
     $this->_connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
     $this->_lastQuery = $sql = 'PRAGMA full_column_names=0';
     $retval = $this->_connection->exec($sql);
     if ($retval === false) {
         $error = $this->_connection->errorInfo();
         throw new Horde_Db_Exception($error[2]);
     }
     $this->_lastQuery = $sql = 'PRAGMA short_column_names=1';
     $retval = $this->_connection->exec($sql);
     if ($retval === false) {
         $error = $this->_connection->errorInfo();
         throw new Horde_Db_Exception($error[2]);
     }
     $this->_lastQuery = $sql = 'SELECT sqlite_version(*)';
     $this->_sqliteVersion = $this->selectValue($sql);
 }