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