/** * 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']); } }
/** * 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); }
/** * Parse configuration array into options for PDO constructor. * * @throws Horde_Db_Exception * @return array [dsn, username, password] */ protected function _parseConfig() { $this->_config['adapter'] = 'pgsql'; // PDO for PostgreSQL does not accept a socket argument // in the connection string; the location can be set via the // "host" argument instead. if (!empty($this->_config['socket'])) { $this->_config['host'] = $this->_config['socket']; unset($this->_config['socket']); } return parent::_parseConfig(); }