Add READ COMMITTED
parent
4d9a65d632
commit
3bdc635003
|
@ -4,7 +4,7 @@
|
|||
* Very stable interface for MySQL - object-oriented at last :)
|
||||
* Select builder is inspired by MediaWiki's one.
|
||||
* Also usable for querying SphinxQL.
|
||||
* Version: 2015-05-12
|
||||
* Version: 2015-05-13
|
||||
* (c) Vitaliy Filippov, 2012-2015
|
||||
*/
|
||||
|
||||
|
@ -127,6 +127,11 @@ class DatabaseMysql implements Database
|
|||
{
|
||||
$this->transactions = array();
|
||||
$this->link->set_charset('utf8');
|
||||
if ($this->username || $this->dbname) // skip for Sphinx
|
||||
{
|
||||
// READ COMMITTED is more consistent for average usage
|
||||
$this->link->query('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED');
|
||||
}
|
||||
if ($this->autoBegin)
|
||||
{
|
||||
$this->begin();
|
||||
|
@ -178,9 +183,15 @@ class DatabaseMysql implements Database
|
|||
$this->queryCount++;
|
||||
if ($this->queryLogFile)
|
||||
{
|
||||
$this->loggedQueries .= date("[Y-m-d H:i:s] ").$sql."\n";
|
||||
$begin = explode(' ', microtime(), 2);
|
||||
}
|
||||
$r = $this->link->query($sql, $fetchMode);
|
||||
if ($this->queryLogFile)
|
||||
{
|
||||
$end = explode(' ', microtime(), 2);
|
||||
$this->loggedQueries .= date("[Y-m-d H:i:s.").substr($end[0], 2, 6)."] [".
|
||||
sprintf("%.05fs", $end[1]-$begin[1]+$end[0]-$begin[0])."] $sql\n";
|
||||
}
|
||||
if (!$r)
|
||||
{
|
||||
if ($this->link->errno == 2006 && $this->reconnect && !$this->transactions)
|
||||
|
|
Loading…
Reference in New Issue