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 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/ProcedureSourceTab.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 ProcedureSourceTab 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: seqno is technically not needed to display the source for the
7
     * stored procedure, however, on some versions of Informix it is an error to
8
     * order by a column that is not in the select list, yielding this
9
     * exception:
10
     * 
11
     *      Error: ORDER BY column (seqno) 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 T1.procid, T2.data, T2.seqno " +
7
        "SELECT viewtext " +
17
        "FROM informix.sysprocedures AS T1, informix.sysprocbody AS T2 " +
8
        "FROM informix.systables AS T1, informix.sysviews AS T2 " +
18
        "WHERE procname = ? " +
9
        "WHERE tabname = ? " +
19
        "AND T2.procid = T1.procid " +
10
        "AND T2.tabid = T1.
20
        "AND datakey = 'T' " +
21
        "ORDER BY T1.procid, T2.seqno ";
11
tabid ";
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(ProcedureSourceTab.class);
15
		LoggerController.createLogger(ViewSourceTab.class);
26
	public ProcedureSourceTab(String hint)
16
	public ViewSourceTab(String hint)
27
	{
17
	{
28
		super(hint);
18
		super(hint);
29
        sourceType = STORED_PROC_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();
39
		
24
		ISQLConnection conn = session.getSQLConnection();
40
if (s_log.isDebugEnabled()) {
25
        if (s_log.isDebugEnabled()) {
41
            s_log.debug("Running SQL: "+SQL);
26
            s_log.debug("Running View Source SQL: "+SQL);
42
            s_log.debug("procname="+doi.getSimpleName());
27
            s_log.debug("View Name="+doi.getSimpleName());
43
        }
28
        
44
		ISQLConnection conn = session.getSQLConnection();
29
    s_log.debug("Schema Name="+doi.getSchemaName());
30
        }                
45
		PreparedStatement pstmt = conn.prepareStatement(SQL);
31
		PreparedStatement pstmt = conn.prepareStatement(SQL);
46
		pstmt.setString(1, doi.getSimpleName());
32
		pstmt.setString(1, doi.getSimpleName());
47
		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