Skip to content

Commit

Permalink
join force index
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Green committed Mar 31, 2015
1 parent a05e5b3 commit d9de7ef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/DbSync/Comparison/Hash.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private function compareLimit($offset, $blockSize)
{
return "SELECT " . $this->buildComparisonHash() . " FROM " .
"(" .
"SELECT $this->columns FROM %s FORCE INDEX (`PRIMARY`) WHERE 1 " .
"SELECT $this->columns FROM %s FORCE INDEX (`PRIMARY`) %s WHERE 1 " .
$this->where . " ".
"ORDER BY $this->primaryKey " .
"LIMIT $offset, $blockSize" .
Expand All @@ -183,7 +183,7 @@ private function compareIndex($offset, $blockSize)
$endOffset = $offset + $blockSize;

return "SELECT " . $this->buildComparisonHash() . " FROM " .
" %s FORCE INDEX (`PRIMARY`) WHERE " .
" %s FORCE INDEX (`PRIMARY`) %s WHERE " .
"$this->limitKey BETWEEN $offset AND $endOffset " .
$this->where;
}
Expand All @@ -204,9 +204,9 @@ public function compare($offset, $blockSize)
{
$query = $this->limitKey ? $this->compareIndex($offset, $blockSize) : $this->compareLimit($offset, $blockSize);

$sourceHash = $this->source->fetchOne(sprintf($query,$this->sourcetable . ' ' . $this->joinSource));
$sourceHash = $this->source->fetchOne(sprintf($query,$this->sourcetable, $this->joinSource));

$destHash = $this->destination->fetchOne(sprintf($query,$this->desttable. ' ' . $this->joinDest));
$destHash = $this->destination->fetchOne(sprintf($query,$this->desttable, $this->joinDest));

$this->lastComparisonEmpty = $sourceHash ? false : true;

Expand Down

0 comments on commit d9de7ef

Please sign in to comment.