Doctrine\DBAL\Platforms\DB2Platform::gatherAlterColumnSQL PHP Method

gatherAlterColumnSQL() private method

Gathers the table alteration SQL for a given column diff.
private gatherAlterColumnSQL ( Doctrine\DBAL\Schema\Table $table, Doctrine\DBAL\Schema\ColumnDiff $columnDiff, array &$sql, array &$queryParts )
$table Doctrine\DBAL\Schema\Table The table to gather the SQL for.
$columnDiff Doctrine\DBAL\Schema\ColumnDiff The column diff to evaluate.
$sql array The sequence of table alteration statements to fill.
$queryParts array The sequence of column alteration clauses to fill.
    private function gatherAlterColumnSQL(Table $table, ColumnDiff $columnDiff, array &$sql, array &$queryParts)
    {
        $alterColumnClauses = $this->getAlterColumnClausesSQL($columnDiff);
        if (empty($alterColumnClauses)) {
            return;
        }
        // If we have a single column alteration, we can append the clause to the main query.
        if (count($alterColumnClauses) === 1) {
            $queryParts[] = current($alterColumnClauses);
            return;
        }
        // We have multiple alterations for the same column,
        // so we need to trigger a complete ALTER TABLE statement
        // for each ALTER COLUMN clause.
        foreach ($alterColumnClauses as $alterColumnClause) {
            $sql[] = 'ALTER TABLE ' . $table->getQuotedName($this) . ' ' . $alterColumnClause;
        }
    }