program/lib/Roundcube/rcube_db.php | ●●●●● patch | view | raw | blame | history | |
program/lib/Roundcube/rcube_db_mssql.php | ●●●●● patch | view | raw | blame | history | |
program/lib/Roundcube/rcube_db_mysql.php | ●●●●● patch | view | raw | blame | history | |
program/lib/Roundcube/rcube_db_pgsql.php | ●●●●● patch | view | raw | blame | history | |
program/lib/Roundcube/rcube_db_sqlite.php | ●●●●● patch | view | raw | blame | history | |
program/lib/Roundcube/rcube_db_sqlsrv.php | ●●●●● patch | view | raw | blame | history |
program/lib/Roundcube/rcube_db.php
@@ -100,27 +100,15 @@ $this->db_dsnw_array = self::parse_dsn($db_dsnw); $this->db_dsnr_array = self::parse_dsn($db_dsnr); // Initialize driver class $this->init(); } /** * Initialization of the object with driver specific code */ protected function init() { // To be used by driver classes } /** * Connect to specific database * * @param array $dsn DSN for DB connections * * @return PDO database handle * @param array $dsn DSN for DB connections * @param string $mode Connection mode (r|w) */ protected function dsn_connect($dsn) protected function dsn_connect($dsn, $mode) { $this->db_error = false; $this->db_error_msg = null; @@ -158,9 +146,10 @@ return null; } $this->dbh = $dbh; $this->db_mode = $mode; $this->db_connected = true; $this->conn_configure($dsn, $dbh); return $dbh; } /** @@ -180,16 +169,6 @@ */ protected function conn_configure($dsn, $dbh) { } /** * Driver-specific database character set setting * * @param string $charset Character set name */ protected function set_charset($charset) { $this->query("SET NAMES 'utf8'"); } /** @@ -219,23 +198,14 @@ $dsn = ($mode == 'r') ? $this->db_dsnr_array : $this->db_dsnw_array; $this->dbh = $this->dsn_connect($dsn); $this->db_connected = is_object($this->dbh); $this->dsn_connect($dsn, $mode); // use write-master when read-only fails if (!$this->db_connected && $mode == 'r' && $this->is_replicated()) { $mode = 'w'; $this->dbh = $this->dsn_connect($this->db_dsnw_array); $this->db_connected = is_object($this->dbh); $this->dsn_connect($this->db_dsnw_array, 'w'); } if ($this->db_connected) { $this->db_mode = $mode; $this->set_charset('utf8'); } else { $this->conn_failure = true; } $this->conn_failure = !$this->db_connected; } /** program/lib/Roundcube/rcube_db_mssql.php
@@ -29,20 +29,18 @@ public $db_provider = 'mssql'; /** * Driver initialization * Object constructor * * @param string $db_dsnw DSN for read/write operations * @param string $db_dsnr Optional DSN for read only operations * @param bool $pconn Enables persistent connections */ protected function init() public function __construct($db_dsnw, $db_dsnr = '', $pconn = false) { parent::__construct($db_dsnw, $db_dsnr, $pconn); $this->options['identifier_start'] = '['; $this->options['identifier_end'] = ']'; } /** * Character setting */ protected function set_charset($charset) { // UTF-8 is default } /** program/lib/Roundcube/rcube_db_mysql.php
@@ -30,9 +30,13 @@ public $db_provider = 'mysql'; /** * Driver initialization/configuration * Object constructor * * @param string $db_dsnw DSN for read/write operations * @param string $db_dsnr Optional DSN for read only operations * @param bool $pconn Enables persistent connections */ protected function init() public function __construct($db_dsnw, $db_dsnr = '', $pconn = false) { if (version_compare(PHP_VERSION, '5.3.0', '<')) { rcube::raise_error(array('code' => 600, 'type' => 'db', @@ -41,12 +45,25 @@ true, true); } parent::__construct($db_dsnw, $db_dsnr, $pconn); // SQL identifiers quoting $this->options['identifier_start'] = '`'; $this->options['identifier_end'] = '`'; } /** * Driver-specific configuration of database connection * * @param array $dsn DSN for DB connections * @param PDO $dbh Connection handler */ protected function conn_configure($dsn, $dbh) { $this->query("SET NAMES 'utf8'"); } /** * Abstract SQL statement for value concatenation * * @return string SQL statement to be used in query program/lib/Roundcube/rcube_db_pgsql.php
@@ -29,6 +29,17 @@ public $db_provider = 'postgres'; /** * Driver-specific configuration of database connection * * @param array $dsn DSN for DB connections * @param PDO $dbh Connection handler */ protected function conn_configure($dsn, $dbh) { $this->query("SET NAMES 'utf8'"); } /** * Get last inserted record ID * * @param string $table Table name (to find the incremented sequence) program/lib/Roundcube/rcube_db_sqlite.php
@@ -29,13 +29,6 @@ public $db_provider = 'sqlite'; /** * Database character set */ protected function set_charset($charset) { } /** * Prepare connection */ protected function conn_prepare($dsn) program/lib/Roundcube/rcube_db_sqlsrv.php
@@ -29,20 +29,18 @@ public $db_provider = 'mssql'; /** * Driver initialization * Object constructor * * @param string $db_dsnw DSN for read/write operations * @param string $db_dsnr Optional DSN for read only operations * @param bool $pconn Enables persistent connections */ protected function init() public function __construct($db_dsnw, $db_dsnr = '', $pconn = false) { parent::__construct($db_dsnw, $db_dsnr, $pconn); $this->options['identifier_start'] = '['; $this->options['identifier_end'] = ']'; } /** * Database character set setting */ protected function set_charset($charset) { // UTF-8 is default } /**