int resultFound = 0; ResultSet rs = stmt.executeQuery(sql); if (rs.next()) { resultFound = rs.getInt(1); } rs.close(); return resultFound;
int rowCount = 0; ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM " + tableName); if (rs.next()) { rowCount = rs.getInt(1); } rs.close(); return rowCount;
Clone fragments detected by clone detection tool
File path: /sql12/plugins/smarttools/src/net/sourceforge/squirrel_sql/plugins/smarttools/SmarttoolsHelper.java File path: /sql12/plugins/smarttools/src/net/sourceforge/squirrel_sql/plugins/smarttools/SmarttoolsHelper.java
Method name: int checkColumnData(Statement, String) Method name: int getRowCount(Statement, String)
Number of AST nodes: 6 Number of AST nodes: 6
1
int resultFound = 0;
1
int rowCount = 0;
2
		ResultSet rs = stmt.executeQuery(sql);
2
		ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM " + tableName);
3
		if (rs.next())
3
		if (rs.next())
4
		{
4
		{
5
			resultFound = rs.getInt(1);
5
			rowCount = rs.getInt(1);
6
		}
6
		}
7
		rs.close();
7
		rs.close();
8
		return resultFound;
8
		return rowCount;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons20
  1. {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)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int resultFound = 0;
    1
    int resultFound = 0;
    1
    int rowCount = 0;
    Differences
    Expression1Expression2Difference
    resultFoundrowCountVARIABLE_NAME_MISMATCH
    1
    int rowCount = 0;
    2
    ResultSet rs = stmt.executeQuery(sql);
    2
    ResultSet rs = stmt.executeQuery(sql);
    2
    ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM " + tableName);
    Differences
    Expression1Expression2Difference
    sql"SELECT COUNT(*) FROM " + tableNameTYPE_COMPATIBLE_REPLACEMENT
    2
    ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM " + tableName);
    3
    if (rs.next())
    3
    if (rs.next())
    4
    resultFound = rs.getInt(1);
    4
    resultFound = rs.getInt(1);
    4
    rowCount = rs.getInt(1);
    Differences
    Expression1Expression2Difference
    resultFoundrowCountVARIABLE_NAME_MISMATCH
    4
    rowCount = rs.getInt(1);
    5
    rs.close();
    5
    rs.close();
    6
    return resultFound;
    6
    return resultFound;
    6
    return rowCount;
    Differences
    Expression1Expression2Difference
    resultFoundrowCountVARIABLE_NAME_MISMATCH
    6
    return rowCount;
    Precondition Violations (0)
    Row Violation