Examples of ColumnChange


Examples of org.apache.ddlutils.alteration.ColumnChange

        {
            HashSet processedColumns = new HashSet();

            for (Iterator changeIt = columnChanges.iterator(); changeIt.hasNext();)
            {
                ColumnChange change       = (ColumnChange)changeIt.next();
                Column       sourceColumn = change.getChangedColumn();
                Column       targetColumn = targetTable.findColumn(sourceColumn.getName(), getPlatform().isDelimitedIdentifierModeOn());

                if (!processedColumns.contains(targetColumn))
                {
                    processColumnChange(sourceTable,
                                        targetTable,
                                        sourceColumn,
                                        targetColumn,
                                        (change instanceof ColumnDataTypeChange) || (change instanceof ColumnSizeChange));
                    processedColumns.add(targetColumn);
                }
                changes.remove(change);
                change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
            }
        }
        // Finally we add primary keys
        for (Iterator changeIt = changes.iterator(); changeIt.hasNext();)
        {
View Full Code Here

Examples of org.apache.ddlutils.alteration.ColumnChange

            }
            else if ((change instanceof ColumnChange) && (columnChanges != null))
            {
                // we gather all changed columns because we can use the ALTER TABLE ALTER COLUMN
                // statement for them
                ColumnChange columnChange     = (ColumnChange)change;
                ArrayList    changesPerColumn = (ArrayList)columnChanges.get(columnChange.getChangedColumn());

                if (changesPerColumn == null)
                {
                    changesPerColumn = new ArrayList();
                    columnChanges.put(columnChange.getChangedColumn(), changesPerColumn);
                }
                changesPerColumn.add(change);
            }
        }
        if (columnChanges != null)
View Full Code Here

Examples of org.databene.mad4db.cmd.ColumnChange

  public TableColumnComparator(ComparisonConfig config) {
    super(config);
  }

  public void compareObjects(DBColumn col1, DBColumn col2, CompositeStructuralChange<?> tableChange) {
    ColumnChange columnChange = new ColumnChange(col1);

    // check column type, size and fractionDigits
    DBDataType newType = col2.getType();
    Integer newSize = col2.getSize();
    Integer newFractionDigits = col2.getFractionDigits();
    if (!col1.getType().equals(newType)
        || !NullSafeComparator.equals(col1.getSize(), newSize)
        || !NullSafeComparator.equals(col1.getFractionDigits(), newFractionDigits))
      columnChange.addSubChange(new ColumnTypeChange(col1, newType, newSize, newFractionDigits));

    // check column default
    if (!NullSafeComparator.equals(col1.getDefaultValue(), col2.getDefaultValue()))
      columnChange.addSubChange(new DefaultValueChange(col1, col2.getDefaultValue()));
   
    // check column nullability
    if (col1.isNullable() && !col2.isNullable())
      columnChange.addSubChange(new NotNullConstraintCreation(col2.getNotNullConstraint()));
    if (!col1.isNullable() && col2.isNullable())
      columnChange.addSubChange(new ConstraintDeletion<DBNotNullConstraint>(col1.getNotNullConstraint()));

    // if there were changes, add them to the parent tableChange
    if (columnChange.getSubChanges().size() > 0)
      tableChange.addSubChange(columnChange);
  }
View Full Code Here

Examples of org.databene.mad4db.cmd.ColumnChange

    DBColumn newColumn2 = new DBColumn("C2", newTable, DBDataType.getInstance("INTEGER"));
    DBNotNullConstraint constraint = new DBNotNullConstraint(newTable, "T_C1_NOT_NULL", true, "C1");
    newColumn.setNotNullConstraint(constraint);
   
    NotNullConstraintCreation constraintCreation = new NotNullConstraintCreation(constraint);
    ColumnChange columnChange = new ColumnChange(newColumn);
    columnChange.addSubChange(constraintCreation);
    TableChange tableChange = new TableChange(oldTable, newTable);
    tableChange.addSubChange(columnChange);
   
    assertFalse(new ChangeByAffectedObjectFilter(newColumn2).accept(columnChange));
    assertFalse(new ChangeByAffectedObjectFilter(oldColumn2).accept(columnChange));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.