Examples of DBColumn


Examples of org.apache.empire.db.DBColumn

        // add Comments
        createComment(db, "TABLE", t, t.getComment(), script);
        columns = t.getColumns().iterator();
        while (columns.hasNext())
        {
            DBColumn c = columns.next();
            String com = c.getComment();
            if (com != null)
                createComment(db, "COLUMN", c, com, script);
        }
        // done
        return success();
View Full Code Here

Examples of org.apache.empire.db.DBColumn

        sql.append("COMMENT ON ");
        sql.append(type);
        sql.append(" ");
        if (expr instanceof DBColumn)
        {
            DBColumn c = (DBColumn)expr;
            c.getRowSet().addSQL(sql, DBExpr.CTX_NAME);
            sql.append(".");
        }
        expr.addSQL(sql, DBExpr.CTX_NAME);
        sql.append(" IS '");
        sql.append(comment);
View Full Code Here

Examples of org.apache.empire.db.DBColumn

                   
                    if (dbTable != null)
                    {
                       
                        // check if the found column exists in the found DBTable
                        DBColumn col = dbTable.getColumn(columnName);
                        if (col == null)
                        {
                            log.warn("COLUMN NOT FOUND IN " + db.getClass().getName() + "\t: [" + tableName + "]["
                                           + columnName + "][" + dataType + "][" + dataLength + "]");
                            continue;
View Full Code Here

Examples of org.apache.empire.db.DBColumn

      {
        DBCompareColExpr o = (DBCompareColExpr)other;
        DBColumnExpr oexpr = o.getColumnExpr();
        if (expr.equals(oexpr))
          return true;
        DBColumn col  = expr.getUpdateColumn();
        DBColumn ocol = oexpr.getUpdateColumn();
        return (col!=null) ? (col.equals(ocol)) : false;
      }
      return false;
    }
View Full Code Here

Examples of org.databene.jdbacl.model.DBColumn

  private SchemaChange createSchemaChange(boolean nullableFk) {
    SchemaChange schemaChange = new SchemaChange(new ComparisonConfig(null, null, null));
    DBTable refereeTable = new DBTable("referee");
    DBTable refererTable = new DBTable("referer");
    DBColumn fkColumn = new DBColumn("ref", refererTable, DBDataType.getInstance(Types.INTEGER, "int"));
    fkColumn.setNullable(nullableFk);
    refereeTable.addColumn(fkColumn);
    schemaChange.addSubChange(new TableCreation(refereeTable));
    DBForeignKeyConstraint fk = new DBForeignKeyConstraint("new_fk", true, refererTable, new String[] { "ref" }, refereeTable, new String[] { "id" });
    schemaChange.addSubChange(new ForeignKeyConstraintCreation(fk));
    return schemaChange;
View Full Code Here

Examples of org.databene.jdbacl.model.DBColumn

public class ChangeByAffectedObjectFilterTest {
 
  @Test
  public void testNotNullConstraintCreation() {
    DBTable oldTable = new DBTable("T");
    DBColumn oldColumn = new DBColumn("C1", oldTable, DBDataType.getInstance("INTEGER"));
    DBColumn oldColumn2 = new DBColumn("C2", oldTable, DBDataType.getInstance("INTEGER"));
   
    DBTable newTable = new DBTable("T");
    DBColumn newColumn = new DBColumn("C1", newTable, DBDataType.getInstance("INTEGER"));
    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);
View Full Code Here

Examples of org.databene.jdbacl.model.DBColumn

    checkSeverity("NUMBER", 6, null, "NUMBER", 6, 3, ChangeSeverity.EASE);
  }

  private void checkSeverity(String oldType, Integer oldSize, Integer oldFractionDigits,
      String newType, Integer newSize, Integer newFractionDigits, ChangeSeverity expectedSeverity) {
    DBColumn oldColumn = new DBColumn("VAL", null, DBDataType.getInstance(1, oldType), oldSize, oldFractionDigits);
    ColumnTypeChange change = new ColumnTypeChange(oldColumn, DBDataType.getInstance(1, newType), newSize, newFractionDigits);
    assertEquals(expectedSeverity, change.getSeverity());
  }
View Full Code Here

Examples of org.databene.jdbacl.model.DBColumn

      createIntColumn(columnNames[i], table);
    return table;
  }

  protected DBColumn createIntColumn(String name, DBTable table) {
    return new DBColumn(name, table, DBDataType.getInstance(Types.INTEGER, "INT"));
  }
View Full Code Here

Examples of org.databene.jdbacl.model.DBColumn

  protected DBColumn createIntColumn(String name, DBTable table) {
    return new DBColumn(name, table, DBDataType.getInstance(Types.INTEGER, "INT"));
  }

  protected DBColumn createVarcharColumn(String name, DBTable table) {
    return new DBColumn(name, table, DBDataType.getInstance(Types.VARCHAR, "VARCHAR"));
  }
View Full Code Here

Examples of org.databene.jdbacl.model.DBColumn

 
  @Test
  public void testUnchanged() {
    // given a column that did not change
    DBTable table1 = new DBTable("tbl");
    DBColumn col1 = createIntColumn("col1", table1);
    DBTable table2 = new DBTable("tbl");
    DBColumn col2 = createIntColumn("col1", table2);
    // when performing a comparison
    TableChange tableChange = new TableChange(table1, null);
    new TableColumnComparator(config).compareObjects(col1, col2, tableChange);
    // then the result must be empty
    System.out.println(tableChange);
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.