summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube/rcube_db_mysql.php
diff options
context:
space:
mode:
Diffstat (limited to 'program/lib/Roundcube/rcube_db_mysql.php')
-rw-r--r--program/lib/Roundcube/rcube_db_mysql.php48
1 files changed, 3 insertions, 45 deletions
diff --git a/program/lib/Roundcube/rcube_db_mysql.php b/program/lib/Roundcube/rcube_db_mysql.php
index d3d0ac5c8..7f5ad2b36 100644
--- a/program/lib/Roundcube/rcube_db_mysql.php
+++ b/program/lib/Roundcube/rcube_db_mysql.php
@@ -30,13 +30,9 @@ class rcube_db_mysql extends rcube_db
public $db_provider = 'mysql';
/**
- * 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
+ * Driver initialization/configuration
*/
- public function __construct($db_dsnw, $db_dsnr = '', $pconn = false)
+ protected function init()
{
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
rcube::raise_error(array('code' => 600, 'type' => 'db',
@@ -45,25 +41,12 @@ class rcube_db_mysql extends rcube_db
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)
- {
- $dbh->query("SET NAMES 'utf8'");
- }
-
- /**
* Abstract SQL statement for value concatenation
*
* @return string SQL statement to be used in query
@@ -151,7 +134,7 @@ class rcube_db_mysql extends rcube_db
$result[PDO::MYSQL_ATTR_FOUND_ROWS] = true;
// Enable AUTOCOMMIT mode (#1488902)
- $result[PDO::ATTR_AUTOCOMMIT] = true;
+ $dsn_options[PDO::ATTR_AUTOCOMMIT] = true;
return $result;
}
@@ -179,29 +162,4 @@ class rcube_db_mysql extends rcube_db
return isset($this->variables[$varname]) ? $this->variables[$varname] : $default;
}
- /**
- * Handle DB errors, re-issue the query on deadlock errors from InnoDB row-level locking
- *
- * @param string Query that triggered the error
- * @return mixed Result to be stored and returned
- */
- protected function handle_error($query)
- {
- $error = $this->dbh->errorInfo();
-
- // retry after "Deadlock found when trying to get lock" errors
- $retries = 2;
- while ($error[1] == 1213 && $retries >= 0) {
- usleep(50000); // wait 50 ms
- $result = $this->dbh->query($query);
- if ($result !== false) {
- return $result;
- }
- $error = $this->dbh->errorInfo();
- $retries--;
- }
-
- return parent::handle_error($query);
- }
-
}