public class IndexSourceTab extends FormattedSourceTab { /** SQL that retrieves the source of an index. */ private static String SQL = "select " + "'create '||index_type_name||' '||index_name||' ON '||table_name||'('||column_name||')' " + "from INFORMATION_SCHEMA.INDEXES " + "where table_schema = ? " + "and index_name = ? "; /** Logger for this class. */ private final static ILogger s_log = LoggerController.createLogger(ViewSourceTab.class); public IndexSourceTab(String hint, String stmtSep) { super(hint); super.setCompressWhitespace(true); super.setupFormatter(stmtSep, null); } protected PreparedStatement createStatement() throws SQLException { final ISession session = getSession(); final IDatabaseObjectInfo doi = getDatabaseObjectInfo(); ISQLConnection conn = session.getSQLConnection(); if (s_log.isDebugEnabled()) { s_log.debug("Running SQL for index source tab: "+SQL); s_log.debug("schema name: "+doi.getSchemaName()); s_log.debug("index name: "+doi.getSimpleName()); } PreparedStatement pstmt = conn.prepareStatement(SQL); pstmt.setString(1, doi.getSchemaName()); pstmt.setString(2, doi.getSimpleName()); return pstmt
public class MysqlTriggerSourceTab extends FormattedSourceTab { /** SQL that retrieves the source of a view. */ private static String SQL = "SELECT ACTION_STATEMENT " + "FROM INFORMATION_SCHEMA.TRIGGERS " + "WHERE TRIGGER_SCHEMA = ? " + "AND TRIGGER_NAME = ? "; /** Logger for this class. */ private final static ILogger s_log = LoggerController.createLogger(MysqlTriggerSourceTab.class); public MysqlTriggerSourceTab(String hint, String stmtSep) { super(hint); super.setupFormatter(stmtSep, null); super.setCompressWhitespace(true); } protected PreparedStatement createStatement() throws SQLException { final ISession session = getSession(); final IDatabaseObjectInfo doi = getDatabaseObjectInfo(); ISQLConnection conn = session.getSQLConnection(); if (s_log.isDebugEnabled()) { s_log.debug("Running SQL for View source tab: "+SQL); s_log.debug("Binding catalog name "+doi.getCatalogName()+ " as first bind value"); s_log.debug("Binding table name "+doi.getSimpleName()+ " as second bind value"); } PreparedStatement pstmt = conn.prepareStatement(SQL); pstmt.setString(1, doi.getCatalogName()); pstmt.setString(2, doi.getSimpleName()); return pstmt
Clone fragments detected by clone detection tool
File path: /sql12/plugins/h2/src/net/sourceforge/squirrel_sql/plugins/h2/tab/IndexSourceTab.java File path: /sql12/plugins/mysql/src/net/sourceforge/squirrel_sql/plugins/mysql/tab/MysqlTriggerSourceTab.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class IndexSourceTab extends FormattedSourceTab
1
public class MysqlTriggerSourceTab extends FormattedSourceTab
2
{
2
{
3
	/** SQL that retrieves the source of an index. */
3
	/** SQL that retrieves the source of a view. */
4
	private static String SQL =
4
	private static String SQL =
5
        "select " +
5
        "
6
        "'create '||index_type_name||' '||index_name||' ON '||table_name||'('||column_name||')' " +
6
SELECT ACTION_STATEMENT " +
7
        "from INFORMATION_SCHEMA.INDEXES " +
7
        "FROM INFORMATION_SCHEMA.TRIGGERS " +
8
        "where table_schema = ? " +
8
        "WHERE TRIGGER_SCHEMA = ? " +
9
        "and index_name = ? ";
9
        "AND TRIGGER_NAME = ? ";
10
    
10
    
11
	/** Logger for this class. */
11
	/** Logger for this class. */
12
	private final static ILogger s_log =
12
	private final static ILogger s_log =
13
		LoggerController.createLogger(ViewSourceTab.class);
13
		LoggerController.createLogger(MysqlTriggerSourceTab.class);
14
	public IndexSourceTab(String hint, String stmtSep)
14
	public MysqlTriggerSourceTab(String hint, String stmtSep)
15
	{
15
	{
16
		super(hint);
16
		super(hint);
17
        super.setCompressWhitespace(true);
17
        super.set
18
        super.setupFormatter(stmtSep, null);        
18
upFormatter(stmtSep, null);
19
        super.setCompressWhitespace(true);
19
	}
20
	}
20
	protected PreparedStatement createStatement() throws SQLException
21
	protected PreparedStatement createStatement() throws SQLException
21
	{
22
	{
22
		final ISession session = getSession();
23
		final ISession session = getSession();
23
		final IDatabaseObjectInfo doi = getDatabaseObjectInfo();
24
		final IDatabaseObjectInfo doi = getDatabaseObjectInfo();
24
		ISQLConnection conn = session.getSQLConnection();
25
		ISQLConnection conn = session.getSQLConnection();
25
        if (s_log.isDebugEnabled()) {
26
        if (s_log.isDebugEnabled()) {
26
            s_log.debug("Running SQL for index source tab: "+SQL);
27
            s_log.debug("Running SQL for View source tab: "+SQL);
27
            s_log.debug("schema name: "+doi.getSchemaName()
28
            s_log.debug("Binding catalog name "+doi.getCatalogName()+
28
);
29
                        " as first bind value");
29
            s_log.debug("index name: "+doi.getSimpleName());
30
            s_log.debug("Binding table name "+doi.getSimpleName()+
31
                        " as second bind value");                        
30
        }
32
        }
31
		PreparedStatement pstmt = conn.prepareStatement(SQL);
33
		PreparedStatement pstmt = conn.prepareStatement(SQL);
32
        
34
        
33
        pstmt.setString(1, doi.getSchemaName());
35
        pstmt.setString(1, doi.getCatalogName());
34
		pstmt.setString(2, doi.getSimpleName());
36
		pstmt.setString(2, doi.getSimpleName());
35
		return pstmt
37
		return pstmt
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0