public function __construct(array $connection_options = array()) { $this->transactionSupport = TRUE; // Transactional DDL is always available in PostgreSQL, $this->transactionalDDLSupport = TRUE; $pdo = parent::openConnection(array(PDO::ATTR_EMULATE_PREPARES => FALSE, PDO::ATTR_STRINGIFY_FETCHES => TRUE, PDO::ATTR_CASE => PDO::CASE_LOWER)); parent::__construct($pdo); // Force PostgreSQL to use the UTF-8 character set by default. $pdo->exec("SET NAMES 'UTF8'"); }
public function __construct(array $connection_options = array()) { $this->transactionSupport = FALSE; // MySQL never supports transactional DDL. $this->transactionalDDLSupport = FALSE; $pdo = parent::openConnection(array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE, PDO::ATTR_EMULATE_PREPARES => TRUE, PDO::ATTR_CASE => PDO::CASE_LOWER)); parent::__construct($pdo); // Force MySQL to use the UTF-8 character set. $pdo->exec('SET NAMES utf8'); // Force MySQL's behavior to conform more closely to SQL standards. // This allows Drupal to run almost seamlessly on many different // kinds of database systems. These settings force MySQL to behave // the same as postgresql, or sqlite in regards to syntax interpretation // and invalid data handling. See http://drupal.org/node/344575 for further discussion. $pdo->exec("SET sql_mode='ANSI,TRADITIONAL'"); }
public function __construct(array $connection_options = array()) { // We don't need a specific PDOStatement class here, we simulate it below. $this->statementClass = NULL; $this->connectionOptions = $connection_options; $pdo = parent::openConnection(array(PDO::ATTR_CASE => PDO::CASE_LOWER, PDO::ATTR_STRINGIFY_FETCHES => TRUE)); parent::__construct($pdo); // Detect support for SAVEPOINT. $version = $this->query('SELECT sqlite_version()')->fetchField(); $this->savepointSupport = version_compare($version, '3.6.8') >= 0; // This driver defaults to transaction support, except if explicitly passed FALSE. $this->transactionSupport = version_compare($version, '3.0.0') >= 0; // Create functions needed by SQLite. $this->getPDO()->sqliteCreateFunction('if', array($this, 'sqlFunctionIf')); $this->getPDO()->sqliteCreateFunction('greatest', array($this, 'sqlFunctionGreatest')); $this->getPDO()->sqliteCreateFunction('pow', 'pow', 2); $this->getPDO()->sqliteCreateFunction('length', 'strlen', 1); $this->getPDO()->sqliteCreateFunction('md5', 'md5', 1); $this->getPDO()->sqliteCreateFunction('concat', array($this, 'sqlFunctionConcat')); $this->getPDO()->sqliteCreateFunction('substring', array($this, 'sqlFunctionSubstring'), 3); $this->getPDO()->sqliteCreateFunction('substring_index', array($this, 'sqlFunctionSubstringIndex'), 3); $this->getPDO()->sqliteCreateFunction('rand', array($this, 'sqlFunctionRand')); }