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 indexdef " +↵ | | 5 | "select text " +↵
|
6 | "from pg_indexes↵ | | 6 | "from sysobjects " +↵
|
7 | " +↵ | | 7 | "inner join syscomments on syscomments.id = sysobjects.id " +↵
|
8 | "where schemaname = ? " +↵ | | 8 | "where loginame = ? " +↵
|
9 | "and indexname = ? ";↵ | | 9 | "and 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(ViewSourceTab.class);↵
|
|
14 | public IndexSourceTab(String hint, String stmtSep)↵ | | 14 | public ViewSourceTab(String hint, String stmtSep)↵
|
15 | {↵ | | 15 | {↵
|
16 | super(hint);↵ | | 16 | super(hint);↵
|
17 | super.setupFormatter(stmtSep, null);↵ | | 17 | super.set↵
|
18 | super.setCompressWhitespace(true);↵ | | 18 | CompressWhitespace(false);↵
|
| | | 19 | super.setupFormatter(stmtSep, null); ↵
|
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 for param 1: "+doi.getCatalogName());↵
|
28 | s_log.debug("index name: "+doi.getSimpleName());↵ | | 29 | s_log.debug("Binding for param 2: "+doi.getSimpleName());↵
|
29 | }↵ | | 30 | }↵
|
30 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵ | | 31 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵
|
31 | ↵ | | 32 | ↵
|
32 | pstmt.setString(1, doi.getSchemaName());↵ | | 33 | pstmt.setString(1, doi.getCatalogName());↵
|
33 | pstmt.setString(2, doi.getSimpleName());↵ | | 34 | pstmt.setString(2, doi.getSimpleName());↵
|
34 | return pstmt | | 35 | return pstmt
|