StringBuilder result = new StringBuilder("select "); result.append(columnList); result.append(" from "); ISession sourceSession = prov.getDiffSourceSession(); // String sourceSchema = null; // MySQL uses catalogs instead of schemas /* if (DialectFactory.isMySQLSession(sourceSession)) { if (log.isDebugEnabled()) { String catalog = prov.getSourceSelectedDatabaseObjects()[0].getCatalogName(); String schema = prov.getSourceSelectedDatabaseObjects()[0].getSchemaName(); log.debug("Detected MySQL, using catalog ("+catalog+") " + "instead of schema ("+schema+")"); } sourceSchema = prov.getSourceSelectedDatabaseObjects()[0].getCatalogName(); } else { sourceSchema = prov.getSourceSelectedDatabaseObjects()[0].getSchemaName(); } */ String tableName = getQualifiedObjectName(sourceSession, ti.getCatalogName(), ti.getSchemaName(), ti.getSimpleName(), DialectFactory.SOURCE_TYPE); result.append(tableName); return result.toString();
StringBuilder result = new StringBuilder("select "); result.append(columnList); result.append(" from "); ISession sourceSession = prov.getCopySourceSession(); String tableName = getQualifiedObjectName( sourceSession, ti.getCatalogName(), ti.getSchemaName(), ti.getSimpleName(), DialectFactory.SOURCE_TYPE); result.append(tableName); return result.toString();
Clone fragments detected by clone detection tool
File path: /sql12/plugins/dbdiff/src/net/sourceforge/squirrel_sql/plugins/dbdiff/util/DBUtil.java File path: /sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil.java
Method name: String getSelectQuery(SessionInfoProvider, String, ITableInfo) Method name: String getSelectQuery(SessionInfoProvider, String, ITableInfo)
Number of AST nodes: 7 Number of AST nodes: 7
1
StringBuilder result = new StringBuilder("select ");
1
StringBuilder result = new StringBuilder("select ");
2
		result.append(columnList);
2
		result.append(columnList);
3
		result.append(" from ");
3
		result.append(" from ");
4
		ISession sourceSession = prov.getDiffSourceSession();
4
		ISession sourceSession = prov.getCopySourceSession();
5
		// String sourceSchema = null;
5
		String 
6
		// MySQL uses catalogs instead of schemas
7
		/*
8
		if (DialectFactory.isMySQLSession(sourceSession)) {
9
		    if (log.isDebugEnabled()) {
10
		        String catalog = 
11
		            prov.getSourceSelectedDatabaseObjects()[0].getCatalogName();
12
		        String schema =
13
		            prov.getSourceSelectedDatabaseObjects()[0].getSchemaName();
14
		        log.debug("Detected MySQL, using catalog ("+catalog+") " +
15
		                  "instead of schema ("+schema+")");
16
		    }
17
		    sourceSchema = 
18
		        prov.getSourceSelectedDatabaseObjects()[0].getCatalogName();
6
tableName = getQualifiedObjectName(
19
		} else {
7
		
20
		    sourceSchema = 
21
		        prov.getSourceSelectedDatabaseObjects()[0].getSchemaName();
22
		}
23
		*/
24
		String tableName =
25
			getQualifiedObjectName(sourceSession, ti.getCatalogName(), ti.getSchemaName(), ti.getSimpleName(),
8
   sourceSession, ti.getCatalogName(), ti.getSchemaName(), ti.getSimpleName(),
26
				DialectFactory.SOURCE_TYPE);
9
		   DialectFactory.SOURCE_TYPE);
27
		result.append(tableName);
10
		result.append(tableName);
28
		return result.toString();
11
		return result.toString();
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 different classes
Number of node comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    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
    1
    StringBuilder result = new StringBuilder("select ");
    1
    StringBuilder result = new StringBuilder("select ");
    2
    result.append(columnList);
    2
    result.append(columnList);
    3
    result.append(" from ");
    3
    result.append(" from ");
    4
    ISession sourceSession = prov.getDiffSourceSession();
    4
    ISession sourceSession = prov.getDiffSourceSession();
    4
    ISession sourceSession = prov.getCopySourceSession();
    Differences
    Expression1Expression2Difference
    getDiffSourceSessiongetCopySourceSessionMETHOD_INVOCATION_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.dbdiff.SessionInfoProvidernet.sourceforge.squirrel_sql.plugins.dbcopy.SessionInfoProviderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.plugins.dbdiff.SessionInfoProvider of variable prov does not match with type net.sourceforge.squirrel_sql.plugins.dbcopy.SessionInfoProvider of variable prov
    • Make classes net.sourceforge.squirrel_sql.plugins.dbdiff.SessionInfoProvider and net.sourceforge.squirrel_sql.plugins.dbcopy.SessionInfoProvider extend a common superclass
    4
    ISession sourceSession = prov.getCopySourceSession();
    5
    String tableName = getQualifiedObjectName(sourceSession, ti.getCatalogName(), ti.getSchemaName(), ti.getSimpleName(), DialectFactory.SOURCE_TYPE);
    5
    String tableName = getQualifiedObjectName(sourceSession, ti.getCatalogName(), ti.getSchemaName(), ti.getSimpleName(), DialectFactory.SOURCE_TYPE);
    6
    result.append(tableName);
    6
    result.append(tableName);
    7
    return result.toString();
    7
    return result.toString();
    Precondition Violations (1)
    Row Violation
    1Type net.sourceforge.squirrel_sql.plugins.dbdiff.SessionInfoProvider of variable prov does not match with type net.sourceforge.squirrel_sql.plugins.dbcopy.SessionInfoProvider of variable prov