1 | public class MysqlTriggerSourceTab extends FormattedSourceTab↵ | | 1 | public class IndexSourceTab extends FormattedSourceTab↵
|
2 | {↵ | | 2 | {↵
|
3 | /** SQL that retrieves the source of a view. */↵ | | 3 | /** SQL that retrieves the source of an index. */↵
|
4 | private static String SQL =↵ | | 4 | private static String SQL =↵
|
5 | "SELECT ACTION_STATEMENT " +↵ | | 5 | "↵
|
6 | "FROM INFORMATION_SCHEMA.TRIGGERS " +↵ | | |
|
7 | "WHERE TRIGGER_SCHEMA↵ | | 6 | select indexdef " +↵
|
| | | 7 | "from pg_indexes " +↵
|
8 | = ? " +↵ | | 8 | "where schemaname = ? " +↵
|
9 | "AND TRIGGER_NAME = ? ";↵ | | 9 | "and indexname = ? ";↵
|
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(MysqlTriggerSourceTab.class);↵ | | 13 | LoggerController.createLogger(ViewSourceTab.class);↵
|
|
14 | public MysqlTriggerSourceTab(String hint, String stmtSep)↵ | | 14 | public IndexSourceTab(String hint, String stmtSep)↵
|
15 | {↵ | | 15 | {↵
|
16 | super(hint);↵ | | 16 | super(hint);↵
|
17 | super.setupFormatter(stmtSep, null);↵ | | 17 | super.setupFormatter(stmtSep, null);↵
|
18 | super.setCompressWhitespace(true);↵ | | 18 | super.setCompressWhitespace(true);↵
|
19 | }↵ | | 19 | }↵
|
|
20 | protected PreparedStatement createStatement() throws SQLException↵ | | 20 | protected PreparedStatement createStatement() throws SQLException↵
|
21 | {↵ | | 21 | {↵
|
22 | final ISession session = getSession();↵ | | 22 | final ISession session = getSession();↵
|
23 | final IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵ | | 23 | final IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵
|
|
24 | ISQLConnection conn = session.getSQLConnection();↵ | | 24 | ISQLConnection conn = session.getSQLConnection();↵
|
25 | if (s_log.isDebugEnabled()) {↵ | | 25 | if (s_log.isDebugEnabled()) {↵
|
26 | s_log.debug("Running SQL for View source tab: "+SQL);↵ | | 26 | s_log.debug("Running SQL for index source tab: "+SQL);↵
|
27 | s_log.debug("Binding catalog name "+doi.getCatalogName()+↵ | | 27 | s_log.debug("schema name: "+doi.get↵
|
28 | " as first bind value");↵ | | 28 | SchemaName());↵
|
29 | s_log.debug("Binding table name "+doi.getSimpleName()+↵ | | 29 | s_log.debug("index name: "+doi.getSimpleName()↵
|
30 | " as second bind value"); ↵ | | 30 | );↵
|
31 | }↵ | | 31 | }↵
|
32 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵ | | 32 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵
|
33 | ↵ | | 33 | ↵
|
34 | pstmt.setString(1, doi.getCatalogName());↵ | | 34 | pstmt.setString(1, doi.getSchemaName());↵
|
35 | pstmt.setString(2, doi.getSimpleName());↵ | | 35 | pstmt.setString(2, doi.getSimpleName());↵
|
36 | return pstmt | | 36 | return pstmt
|