/** * 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->_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(); }
/** * 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(); }
/** * 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); }