public function setTable($sourcetable, $desttable, $comparisonColumns, $syncColumns, $whereSource, $whereDest) { $this->sourcetable = $sourcetable; $this->desttable = $desttable; $primaryKey = $this->source->showPrimaryKey($sourcetable); $cols = $this->source->getColumnInfo($sourcetable); $this->primaryKey = \DbSync\implode_identifiers($primaryKey); $this->syncColumns = \DbSync\implode_identifiers(array_unique(array_merge($primaryKey, $syncColumns))); $this->columns = \DbSync\implode_identifiers(array_unique(array_merge($primaryKey, $comparisonColumns))); $this->whereSource = $whereSource ? ' AND ' . $whereSource : ''; $this->whereDest = $whereDest ? ' AND ' . $whereDest : ''; foreach ($primaryKey as $key) { if ($this->isInt($cols[$key]['Type'])) { $this->limitKey = $key; $this->start = $this->getAggregateCount('MIN'); $this->total = $this->getAggregateCount('MAX'); return; } } $this->start = 0; $this->total = $this->source->fetchOne('SELECT count(*) FROM ' . $this->sourcetable . ' WHERE 1' . $this->whereSource); }
/** * @dataProvider providerIdentifiersTest * */ public function testItCorrectlyImplodesIdentifiers($identifiers, $expected) { $this->assertEquals($expected, \DbSync\implode_identifiers($identifiers)); }