final StringBuffer buf = new StringBuffer(2048); final String sep = " " + _session.getQueryTokenizer().getSQLStatementSeparator(); final IObjectTreeAPI api = _session.getSessionInternalFrame().getObjectTreeAPI(); final IDatabaseObjectInfo[] dbObjs = api.getSelectedDatabaseObjects(); for (int i = 0; i < dbObjs.length; ++i) { final String cmd = getMySQLCommand(dbObjs[i]); if (cmd != null && cmd.length() > 0) { buf.append(cmd).append(" ").append(sep).append('\n'); } } // Execute the SQL command in the SQL tab and then display the SQL tab. if (buf.length() > 0) { _session.getSessionInternalFrame().getSQLPanelAPI().appendSQLScript(buf.toString(), true); _session.getSessionInternalFrame().getSQLPanelAPI().executeCurrentSQL(); _session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB); }
final StringBuffer buf = new StringBuffer(2048); final String sep = "\n" + _session.getQueryTokenizer().getSQLStatementSeparator(); final IObjectTreeAPI api = _session.getSessionInternalFrame().getObjectTreeAPI(); final IDatabaseObjectInfo[] dbObjs = api.getSelectedDatabaseObjects(); for (int i = 0; i < dbObjs.length; ++i) { final String cmd = getSQL(dbObjs[i]); if (cmd != null && cmd.length() > 0) { buf.append(cmd).append(sep).append('\n'); } } // Execute the SQL command in the SQL tab and then display the SQL tab. if (buf.length() > 0) { _session.getSessionInternalFrame().getSQLPanelAPI().appendSQLScript(buf.toString(), true); _session.getSessionInternalFrame().getSQLPanelAPI().executeCurrentSQL(); _session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB); }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/mysql/src/net/sourceforge/squirrel_sql/plugins/mysql/action/AbstractMultipleSQLCommand.java File path: /sql12/plugins/firebird/src/org/firebirdsql/squirrel/act/AbstractMultipleSQLCommand.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 12 Number of AST nodes: 12
1
final StringBuffer buf = new StringBuffer(2048);
1
final StringBuffer buf = new StringBuffer(2048);
2
		final String sep = " 
2
        final String sep = 
3
" + _session.getQueryTokenizer().getSQLStatementSeparator();
3
            "\n" + _session.getQueryTokenizer().getSQLStatementSeparator();
4
		final IObjectTreeAPI api = _session.getSessionInternalFrame().getObjectTreeAPI();
4
        final IObjectTreeAPI api = _session.getSessionInternalFrame().getObjectTreeAPI();
5
		final IDatabaseObjectInfo[] dbObjs = api.getSelectedDatabaseObjects();
5
        final IDatabaseObjectInfo[] dbObjs = api.getSelectedDatabaseObjects();
6
		for (int i = 0; i < dbObjs.length; ++i)
6
        for (int i = 0; i < dbObjs.length; ++i)
7
		{
8
			
7
        {
9
final String cmd = getMySQLCommand(dbObjs[i]);
8
            final String cmd = getSQL(dbObjs[i]);
10
			if (cmd != null && cmd.length() > 0)
9
            if (cmd != null && cmd.length() > 0)
11
			{
12
				
10
            {
13
buf.append(cmd).append(" ").append(sep).append('\n');
11
                buf.append(cmd).append(sep).append('\n');
14
			}
15
		}
16
		
12
            }
13
        }
17
// Execute the SQL command in the SQL tab and then display the SQL tab.
14
        // Execute the SQL command in the SQL tab and then display the SQL tab.
18
		if (buf.length() > 0)
15
        if (buf.length() > 0)
19
		{
20
			
16
        {
21
_session.getSessionInternalFrame().getSQLPanelAPI().appendSQLScript(buf.toString(), true);
17
            _session.getSessionInternalFrame().getSQLPanelAPI().appendSQLScript(buf.toString(), true);
22
			_session.getSessionInternalFrame().getSQLPanelAPI().executeCurrentSQL();
18
            _session.getSessionInternalFrame().getSQLPanelAPI().executeCurrentSQL();
23
			_session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB);
19
            _session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB);
24
		}
20
        }
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.5
Clones locationClones are in different classes
Number of node comparisons34
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)24.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    final StringBuffer buf = new StringBuffer(2048);
    1
    final StringBuffer buf = new StringBuffer(2048);
    2
    final String sep = " " + _session.getQueryTokenizer().getSQLStatementSeparator();
    2
    final String sep = " " + _session.getQueryTokenizer().getSQLStatementSeparator();
    2
    final String sep = "\n" + _session.getQueryTokenizer().getSQLStatementSeparator();
    Differences
    Expression1Expression2Difference
    " ""\n"LITERAL_VALUE_MISMATCH
    2
    final String sep = "\n" + _session.getQueryTokenizer().getSQLStatementSeparator();
    3
    final IObjectTreeAPI api = _session.getSessionInternalFrame().getObjectTreeAPI();
    3
    final IObjectTreeAPI api = _session.getSessionInternalFrame().getObjectTreeAPI();
    4
    final IDatabaseObjectInfo[] dbObjs = api.getSelectedDatabaseObjects();
    4
    final IDatabaseObjectInfo[] dbObjs = api.getSelectedDatabaseObjects();
    5
    for (int i = 0; i < dbObjs.length; ++i)
    5
    for (int i = 0; i < dbObjs.length; ++i)
    6
    final String cmd = getMySQLCommand(dbObjs[i]);
    6
    final String cmd = getMySQLCommand(dbObjs[i]);
    6
    final String cmd = getSQL(dbObjs[i]);
    Differences
    Expression1Expression2Difference
    getMySQLCommandgetSQLMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression getMySQLCommand(dbObjs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression getSQL(dbObjs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    final String cmd = getSQL(dbObjs[i]);
    7
    if (cmd != null && cmd.length() > 0)
    7
    if (cmd != null && cmd.length() > 0)
    8
    buf.append(cmd).append(" ").append(sep).append('\n');
    8
    buf.append(cmd).append(" ").append(sep).append('\n');
    8
    buf.append(cmd).append(sep).append('\n');
    Differences
    Expression1Expression2Difference
    " "cmdTYPE_COMPATIBLE_REPLACEMENT
    buf.append(cmd)bufTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression cmd cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression buf.append(cmd) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression buf cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    buf.append(cmd).append(sep).append('\n');
    9
    if (buf.length() > 0)
    9
    if (buf.length() > 0)
    10
    _session.getSessionInternalFrame().getSQLPanelAPI().appendSQLScript(buf.toString(), true);
    10
    _session.getSessionInternalFrame().getSQLPanelAPI().appendSQLScript(buf.toString(), true);
    11
    _session.getSessionInternalFrame().getSQLPanelAPI().executeCurrentSQL();
    11
    _session.getSessionInternalFrame().getSQLPanelAPI().executeCurrentSQL();
    12
    _session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB);
    12
    _session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB);
    Precondition Violations (5)
    Row Violation
    1Expression getMySQLCommand(dbObjs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression getSQL(dbObjs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression cmd cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression buf.append(cmd) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression buf cannot be parameterized, because it has dependencies to/from statements that will be extracted