CheckConstraint check = new CheckConstraint(); String col = constraintType.substring(16).trim(); // chop off "CHECK on column "; check.setConstraintName(constraintName); check.addConstraintColumn(col); check.setCheckExpression(constraintKeys); constraints.addConstraint(check);
DefaultConstraint def = new DefaultConstraint(); String col = constraintType.substring(18).trim(); // chop off "DEFAULT on column "; def.setConstraintName(constraintName); def.addConstraintColumn(col); def.setDefaultExpression(constraintKeys); constraints.addConstraint(def);
Clone fragments detected by clone detection tool
File path: /sql12/plugins/mssql/src/net/sourceforge/squirrel_sql/plugins/mssql/util/MssqlIntrospector.java File path: /sql12/plugins/mssql/src/net/sourceforge/squirrel_sql/plugins/mssql/util/MssqlIntrospector.java
Method name: TableConstraints getTableConstraints(IDatabaseObjectInfo, ISQLConnection) Method name: TableConstraints getTableConstraints(IDatabaseObjectInfo, ISQLConnection)
Number of AST nodes: 6 Number of AST nodes: 6
1
CheckConstraint check = new CheckConstraint();
1
DefaultConstraint def = new DefaultConstraint();
2
					String col = constraintType.substring(16).trim(); // chop off "CHECK on column ";
2
					String col = constraintType.substring(18).trim(); // chop off "DEFAULT on column ";
3
					check.setConstraintName(constraintName);
3
					def.setConstraintName(constraintName);
4
					check.addConstraintColumn(col);
4
					def.addConstraintColumn(col);
5
					check.setCheckExpression(constraintKeys);
5
					def.setDefaultExpression(constraintKeys);
6
					constraints.addConstraint(check);
6
					constraints.addConstraint(def);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in the same method
Number of node comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    22
    CheckConstraint check = new CheckConstraint();
    22
    CheckConstraint check = new CheckConstraint();
    15
    DefaultConstraint def = new DefaultConstraint();
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.CheckConstraintnet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.DefaultConstraintSUBCLASS_TYPE_MISMATCH
    checkdefVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.CheckConstraintnet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.DefaultConstraintSUBCLASS_TYPE_MISMATCH
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.CheckConstraintnet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.DefaultConstraintSUBCLASS_TYPE_MISMATCH
    15
    DefaultConstraint def = new DefaultConstraint();
    23
    String col = constraintType.substring(16).trim();
    23
    String col = constraintType.substring(16).trim();
    16
    String col = constraintType.substring(18).trim();
    Differences
    Expression1Expression2Difference
    1618LITERAL_VALUE_MISMATCH
    16
    String col = constraintType.substring(18).trim();
    24
    check.setConstraintName(constraintName);
    24
    check.setConstraintName(constraintName);
    17
    def.setConstraintName(constraintName);
    Differences
    Expression1Expression2Difference
    checkdefVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.CheckConstraintnet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.DefaultConstraintSUBCLASS_TYPE_MISMATCH
    17
    def.setConstraintName(constraintName);
    25
    check.addConstraintColumn(col);
    25
    check.addConstraintColumn(col);
    18
    def.addConstraintColumn(col);
    Differences
    Expression1Expression2Difference
    checkdefVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.CheckConstraintnet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.DefaultConstraintSUBCLASS_TYPE_MISMATCH
    18
    def.addConstraintColumn(col);
    26
    check.setCheckExpression(constraintKeys);
    26
    check.setCheckExpression(constraintKeys);
    19
    def.setDefaultExpression(constraintKeys);
    Differences
    Expression1Expression2Difference
    setCheckExpressionsetDefaultExpressionMETHOD_INVOCATION_NAME_MISMATCH
    checkdefVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.CheckConstraintnet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.DefaultConstraintSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression check.setCheckExpression(constraintKeys) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression def.setDefaultExpression(constraintKeys) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression check.setCheckExpression(constraintKeys) is a void method call, and thus it cannot be parameterized
    Expression def.setDefaultExpression(constraintKeys) is a void method call, and thus it cannot be parameterized
    Expression check cannot be unified with expression def , because common superclass net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint does not declare member(s) public void setCheckExpression(java.lang.String) , public void setDefaultExpression(java.lang.String)
    19
    def.setDefaultExpression(constraintKeys);
    27
    constraints.addConstraint(check);
    27
    constraints.addConstraint(check);
    20
    constraints.addConstraint(def);
    Differences
    Expression1Expression2Difference
    checkdefVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.CheckConstraintnet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.DefaultConstraintSUBCLASS_TYPE_MISMATCH
    20
    constraints.addConstraint(def);
    Precondition Violations (5)
    Row Violation
    1Expression check.setCheckExpression(constraintKeys) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression def.setDefaultExpression(constraintKeys) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression check.setCheckExpression(constraintKeys) is a void method call, and thus it cannot be parameterized
    4Expression def.setDefaultExpression(constraintKeys) is a void method call, and thus it cannot be parameterized
    5Expression check cannot be unified with expression def , because common superclass net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint does not declare member(s) public void setCheckExpression(java.lang.String) , public void setDefaultExpression(java.lang.String)