public class ProcedureSourceTab extends InformixSourceTab { /** * SQL that retrieves the source of a stored procedure. * * Note: seqno is technically not needed to display the source for the * stored procedure, however, on some versions of Informix it is an error to * order by a column that is not in the select list, yielding this * exception: * * Error: ORDER BY column (seqno) must be in SELECT list. * SQLState: IX000 * ErrorCode: -309 */ private static String SQL = "SELECT T1.procid, T2.data, T2.seqno " + "FROM informix.sysprocedures AS T1, informix.sysprocbody AS T2 " + "WHERE procname = ? " + "AND T2.procid = T1.procid " + "AND datakey = 'T' " + "ORDER BY T1.procid, T2.seqno "; /** Logger for this class. */ private final static ILogger s_log = LoggerController.createLogger(ProcedureSourceTab.class); public ProcedureSourceTab(String hint) { super(hint); sourceType = STORED_PROC_TYPE; } /** * @see net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.BaseSourceTab#createStatement() */ @Override protected PreparedStatement createStatement() throws SQLException { final ISession session = getSession(); final IDatabaseObjectInfo doi = getDatabaseObjectInfo(); if (s_log.isDebugEnabled()) { s_log.debug("Running SQL: "+SQL); s_log.debug("procname="+doi.getSimpleName()); } ISQLConnection conn = session.getSQLConnection(); PreparedStatement pstmt = conn.prepareStatement(SQL); pstmt.setString(1, doi.getSimpleName()); return pstmt;
public class TriggerSourceTab extends InformixSourceTab { /** * SQL that retrieves the source of a stored procedure. * * Note: datakey and seqno are technically not needed to display the source * for the trigger source code, however, on some versions of Informix it * is an error to order by a column that is not in the select list, * yielding this exception: * * Error: ORDER BY column (datakey) must be in SELECT list. * SQLState: IX000 * ErrorCode: -309 */ private static String SQL = "SELECT T2.data, T2.datakey, T2.seqno " + "FROM informix.systriggers AS T1, informix.systrigbody AS T2 " + "WHERE trigname = ? " + "AND T2.trigid = T1.trigid " + "AND datakey IN ('D', 'A') " + "ORDER BY datakey DESC, seqno "; /** Logger for this class. */ private final static ILogger s_log = LoggerController.createLogger(TriggerSourceTab.class); public TriggerSourceTab(String hint) { super(hint); sourceType = TRIGGER_TYPE; } /** * @see net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.BaseSourceTab#createStatement() */ @Override protected PreparedStatement createStatement() throws SQLException { final ISession session = getSession(); final IDatabaseObjectInfo doi = getDatabaseObjectInfo(); if (s_log.isDebugEnabled()) { s_log.debug("Running SQL: "+SQL); s_log.debug("trigname="+doi.getSimpleName()); } ISQLConnection conn = session.getSQLConnection(); PreparedStatement pstmt = conn.prepareStatement(SQL); pstmt.setString(1, doi.getSimpleName()); return pstmt;
Clone fragments detected by clone detection tool
File path: /sql12/plugins/informix/src/net/sourceforge/squirrel_sql/plugins/informix/tab/ProcedureSourceTab.java File path: /sql12/plugins/informix/src/net/sourceforge/squirrel_sql/plugins/informix/tab/TriggerSourceTab.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class ProcedureSourceTab extends InformixSourceTab
1
public class TriggerSourceTab extends InformixSourceTab
2
{
2
{
3
	/**
3
	/**
4
    
4
 
5
 * SQL that retrieves the source of a stored procedure.
5
	 * SQL that retrieves the source of a stored procedure.
6
     * 
6
	 *  
7
     * Note: seqno is technically not needed to display the source for the
7
     * Note: datakey and seqno are technically not needed to display the source 
8
     * stored procedure, however, on some versions of Informix it 
8
     * for the trigger source code, however, on some versions of Informix it 
9
is an error to
9
     * is an error to
10
     * order by a column that is not in the select list, 
10
 order by a column that is not in the select list, 
11
yielding this
11
     * yielding this
12
     * exception:
12
 exception:
13
     * 
13
     * 
14
     *      Error: ORDER BY column (seqno) must be in SELECT list. 
14
     *      Error: ORDER BY column (datakey) must be in SELECT list. 
15
     *      SQLState: IX000
15
     *      SQLState: IX000
16
     *      ErrorCode: -309
16
     *      ErrorCode: -309
17
     */
17
	 */
18
	private static String SQL =
18
	private static String SQL =
19
        "SELECT T1.procid, T2.data, T2.seqno " +
19
	    "SELECT  T2.data, T2.datakey, T2.seqno " +
20
        "FROM informix.sysprocedures AS T1, informix.sysprocbody AS T2 " +
20
	    "FROM    informix.systriggers AS T1, informix.systrigbody AS T2 " +
21
        "WHERE procname = ? " +
21
	    "WHERE   trigname = ? " +
22
        "AND T2.procid = T1.procid " +
22
	    "AND     T2.trigid = T1.trigid " +
23
        "AND datakey = 'T' " +
23
	    "AND     datakey IN ('D', 'A') " +
24
        "ORDER BY T1.procid, T2.seqno ";
24
	    "ORDER   BY datakey DESC, seqno ";
25
    
25
    
26
	/** Logger for this class. */
26
	/** Logger for this class. */
27
	private final static ILogger s_log =
27
	private final static ILogger s_log =
28
		LoggerController.createLogger(ProcedureSourceTab.class);
28
		LoggerController.createLogger(TriggerSourceTab.class);
29
	public ProcedureSourceTab(String hint)
29
	public TriggerSourceTab(String hint)
30
	{
30
	{
31
		super(hint);
31
		super(hint);
32
        sourceType = STORED_PROC_TYPE;
32
        sourceType = TRIGGER_TYPE;
33
	}
33
	}
34
	/**
34
	/**
35
	 * @see net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.BaseSourceTab#createStatement()
35
	 * @see net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.BaseSourceTab#createStatement()
36
	 */
36
	 */
37
	@Override
37
	@Override
38
	protected PreparedStatement createStatement() throws SQLException
38
	protected PreparedStatement createStatement() throws SQLException
39
	{
39
	{
40
		final ISession session = getSession();
40
		final ISession session = getSession();
41
		final IDatabaseObjectInfo doi = getDatabaseObjectInfo();
41
		final IDatabaseObjectInfo doi = getDatabaseObjectInfo();
42
		if (s_log.isDebugEnabled()) {
42
        if (s_log.isDebugEnabled()) {
43
            s_log.debug("Running SQL: "+SQL);
43
            s_log.debug("Running SQL: "+SQL);
44
            s_log.debug("procname="+doi.getSimpleName());
44
            s_log.debug("trigname="+doi.getSimpleName());
45
        }
45
        }
46
		ISQLConnection conn = session.getSQLConnection();
46
		ISQLConnection conn = session.getSQLConnection();
47
		PreparedStatement pstmt = conn.prepareStatement(SQL);
47
		PreparedStatement pstmt = conn.prepareStatement(SQL);
48
		pstmt.setString(1, doi.getSimpleName());
48
		pstmt.setString(1, doi.getSimpleName());
49
		return pstmt;
49
		return pstmt;
50
	
50
	
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