/** * @param AdapterInterface $adapter * @param \Phinx\Db\Table $origin * @param \Lhm\Table $destination * @param SqlHelper $sqlHelper * @param array $options * - `stride` * Size of chunk ( defaults to 2000 ) */ public function __construct(AdapterInterface $adapter, \Phinx\Db\Table $origin, \Lhm\Table $destination, SqlHelper $sqlHelper = null, array $options = []) { $this->adapter = $adapter; $this->origin = $origin; $this->destination = $destination; $this->sqlHelper = $sqlHelper ?: new SqlHelper($this->adapter); $this->options = $options + ['stride' => 2000]; $this->primaryKey = $this->adapter->quoteColumnName($this->sqlHelper->extractPrimaryKey($this->origin)); $this->nextToInsert = $this->start = $this->selectStart(); $this->limit = $this->selectLimit(); $this->intersection = new Intersection($this->origin, $this->destination); }
/** * @param array $columns List of column names * @return array */ public function quoteColumns(array $columns) { $quoted = []; foreach ($columns as $column) { $quoted[] = $this->adapter->quoteColumnName($column); } return $quoted; }
/** * Quotes a column name for use in a query. * * @param string $columnName Table Name * @return string */ public function quoteColumnName($columnName) { return $this->adapter->quoteColumnName($columnName); }