Skip to content

Commit

Permalink
Merge pull request ifsnop#167 from andreas-glaser/fix-lock-tables
Browse files Browse the repository at this point in the history
Adds 40100 WITH CONSISTENT SNAPSHOT to transaction start
  • Loading branch information
ifsnop authored Aug 5, 2019
2 parents d3bd1aa + 2ece02c commit 92bdf13
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Ifsnop/Mysqldump/Mysqldump.php
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ public function prepareListValues($tableName)
$this->dbHandler->exec($this->typeAdapter->start_transaction());
}

if ($this->dumpSettings['lock-tables']) {
if ($this->dumpSettings['lock-tables'] && !$this->dumpSettings['single-transaction']) {
$this->typeAdapter->lock_table($tableName);
}

Expand Down Expand Up @@ -1232,7 +1232,7 @@ public function endListValues($tableName, $count = 0)
$this->dbHandler->exec($this->typeAdapter->commit_transaction());
}

if ($this->dumpSettings['lock-tables']) {
if ($this->dumpSettings['lock-tables'] && !$this->dumpSettings['single-transaction']) {
$this->typeAdapter->unlock_table($tableName);
}

Expand Down Expand Up @@ -2054,9 +2054,11 @@ public function setup_transaction()

public function start_transaction()
{
return "START TRANSACTION";
return "START TRANSACTION " .
"/*!40100 WITH CONSISTENT SNAPSHOT */";
}


public function commit_transaction()
{
return "COMMIT";
Expand Down

0 comments on commit 92bdf13

Please sign in to comment.