1 | public class IndexSourceTab extends FormattedSourceTab↵ | | 1 | public class ViewSourceTab extends FormattedSourceTab↵
|
2 | {↵ | | 2 | {↵
|
3 | /** SQL that retrieves the source of an index. */↵ | | 3 | /** SQL that retrieves the source of a stored procedure. */↵
|
4 | private static String SQL =↵ | | 4 | private static String SQL =↵
|
5 | "select " +↵ | | 5 | "select text " +↵
|
6 | "'create '||index_type_name||' '||index_name||' ON '||table_name||'('||column_name||')' " +↵ | | 6 | "↵
|
7 | "from INFORMATION_SCHEMA.INDEXES↵ | | 7 | from sysobjects " +↵
|
8 | " +↵ | | 8 | "inner join syscomments on syscomments.id = sysobjects.id " +↵
|
9 | "where table_schema = ? " +↵ | | 9 | "where loginame = ? " +↵
|
10 | "and index_name = ? ";↵ | | 10 | "and name = ? ";↵
|
11 | ↵ | | 11 | ↵
|
12 | /** Logger for this class. */↵ | | 12 | /** Logger for this class. */↵
|
13 | private final static ILogger s_log =↵ | | 13 | private final static ILogger s_log =↵
|
14 | LoggerController.createLogger(ViewSourceTab.class);↵ | | 14 | LoggerController.createLogger(ViewSourceTab.class);↵
|
|
15 | public IndexSourceTab(String hint, String stmtSep)↵ | | 15 | public ViewSourceTab(String hint, String stmtSep)↵
|
16 | {↵ | | 16 | {↵
|
17 | super(hint);↵ | | 17 | super(hint);↵
|
18 | super.setCompressWhitespace(true);↵ | | 18 | super.setCompressWhitespace(false);↵
|
19 | super.setupFormatter(stmtSep, null); ↵ | | 19 | super.setupFormatter(stmtSep, null); ↵
|
20 | }↵ | | 20 | }↵
|
|
21 | protected PreparedStatement createStatement() throws SQLException↵ | | 21 | protected PreparedStatement createStatement() throws SQLException↵
|
22 | {↵ | | 22 | {↵
|
23 | final ISession session = getSession();↵ | | 23 | final ISession session = getSession();↵
|
24 | final IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵ | | 24 | final IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵
|
|
25 | ISQLConnection conn = session.getSQLConnection();↵ | | 25 | ISQLConnection conn = session.getSQLConnection();↵
|
26 | if (s_log.isDebugEnabled()) {↵ | | 26 | if (s_log.isDebugEnabled()) {↵
|
27 | s_log.debug("Running SQL for index source tab: "+SQL);↵ | | 27 | s_log.debug("Running SQL for View source tab: "+SQL);↵
|
28 | s_log.debug("schema name: "+doi.getSchemaName());↵ | | 28 | s_log.debug("Binding for param 1: "+doi.getCatalogName());↵
|
29 | s_log.debug("index name: "+doi.getSimpleName());↵ | | 29 | s_log.debug("Binding for param 2: "+doi.getSimpleName());↵
|
30 | }↵ | | 30 | }↵
|
31 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵ | | 31 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵
|
32 | ↵ | | 32 | ↵
|
33 | pstmt.setString(1, doi.getSchemaName());↵ | | 33 | pstmt.setString(1, doi.getCatalogName());↵
|
34 | pstmt.setString(2, doi.getSimpleName());↵ | | 34 | pstmt.setString(2, doi.getSimpleName());↵
|
35 | return pstmt | | 35 | return pstmt
|