1 | public class MysqlTriggerSourceTab extends FormattedSourceTab↵ | | 1 | public class MysqlViewSourceTab extends FormattedSourceTab↵
|
2 | {↵ | | 2 | {↵
|
3 | /** SQL that retrieves the source of a view. */↵ | | 3 | /** SQL that retrieves the source of a view. */↵
|
4 | private static String SQL =↵ | | 4 | private static String SQL =↵
|
5 | "SELECT ACTION_STATEMENT " +↵ | | 5 | "SELECT VIEW_DEFINITION " +↵
|
6 | "FROM INFORMATION_SCHEMA.TRIGGERS " +↵ | | 6 | "FROM INFORMATION_SCHEMA.VIEWS " +↵
|
7 | "WHERE TRIGGER_SCHEMA = ? " +↵ | | 7 | "WHERE TABLE_SCHEMA = ? " +↵
|
8 | "AND TRIGGER_NAME = ? ";↵ | | 8 | "AND TABLE_NAME = ? ";↵
|
9 | ↵ | | 9 | ↵
|
10 | /** Logger for this class. */↵ | | 10 | /** Logger for this class. */↵
|
11 | private final static ILogger s_log =↵ | | 11 | private final static ILogger s_log =↵
|
12 | LoggerController.createLogger(MysqlTriggerSourceTab.class);↵ | | 12 | LoggerController.createLogger(MysqlViewSourceTab.class);↵
|
|
13 | public MysqlTriggerSourceTab(String hint, String stmtSep)↵ | | 13 | public MysqlViewSourceTab(String hint, String stmtSep)↵
|
14 | {↵ | | 14 | {↵
|
15 | super(hint);↵ | | 15 | super(hint);↵
|
16 | super.setupFormatter(stmtSep, null);↵ | | 16 | super.setupFormatter(stmtSep, null);↵
|
17 | super.setCompressWhitespace(true);↵ | | 17 | super.setCompressWhitespace(true);↵
|
18 | }↵ | | 18 | }↵
|
|
19 | protected PreparedStatement createStatement() throws SQLException↵ | | 19 | protected PreparedStatement createStatement() throws SQLException↵
|
20 | {↵ | | 20 | {↵
|
21 | final ISession session = getSession();↵ | | 21 | final ISession session = getSession();↵
|
22 | final IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵ | | 22 | final IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵
|
|
23 | ISQLConnection conn = session.getSQLConnection();↵ | | 23 | ISQLConnection conn = session.getSQLConnection();↵
|
24 | if (s_log.isDebugEnabled()) {↵ | | 24 | if (s_log.isDebugEnabled()) {↵
|
25 | s_log.debug("Running SQL for View source tab: "+SQL);↵ | | 25 | s_log.debug("Running SQL for View source tab: "+SQL);↵
|
26 | s_log.debug("Binding catalog name "+doi.getCatalogName()+↵ | | 26 | s_log.debug("Binding catalog name "+doi.getCatalogName()+↵
|
27 | " as first bind value");↵ | | 27 | " as first bind value");↵
|
28 | s_log.debug("Binding table name "+doi.getSimpleName()+↵ | | 28 | s_log.debug("Binding table name "+doi.getSimpleName()+↵
|
29 | " as second bind value"); ↵ | | 29 | " as second bind value"); ↵
|
| | | 30 | ↵
|
30 | }↵ | | 31 | }↵
|
31 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵ | | 32 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵
|
32 | ↵ | | 33 | ↵
|
33 | pstmt.setString(1, doi.getCatalogName());↵ | | 34 | pstmt.setString(1, doi.getCatalogName());↵
|
34 | pstmt.setString(2, doi.getSimpleName());↵ | | 35 | pstmt.setString(2, doi.getSimpleName());↵
|
35 | return pstmt | | 36 | return pstmt
|