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