1 | public class TriggerDetailsTab extends BasePreparedStatementTab↵ | | 1 | public class TriggerDetailsTab extends BasePreparedStatementTab↵
|
2 | {↵ | | 2 | {↵
|
3 | private static final StringManager s_stringMgr =↵ | | 3 | private static final StringManager s_stringMgr =↵
|
4 | StringManagerFactory.getStringManager(TriggerDetailsTab.class);↵ | | 4 | StringManagerFactory.getStringManager(TriggerDetailsTab.class);↵
|
|
|
5 | /**↵ | | 5 | /**↵
|
6 | * This interface defines locale specific strings. This should be↵ | | 6 | * This interface defines locale specific strings. This should be↵
|
7 | * replaced with a property file.↵ | | 7 | * replaced with a property file.↵
|
8 | */↵ | | 8 | */↵
|
9 | private interface i18n↵ | | 9 | private interface i18n↵
|
10 | {↵ | | 10 | {↵
|
11 | // i18n[firebird.trigDetails=Details]↵ | | 11 | // i18n[TriggerDetailsTab.title=Details]↵
|
12 | String TITLE = s_stringMgr.getString("firebird.trigDetails");↵ | | 12 | String TITLE = s_stringMgr.getString("TriggerDetailsTab.title");↵
|
13 | // i18n[firebird.triggerDetails=Display trigger details]↵ | | 13 | // i18n[TriggerDetailsTab.hint=Display trigger details]↵
|
14 | String HINT = s_stringMgr.getString("firebird.triggerDetails");↵ | | 14 | String HINT = s_stringMgr.getString("TriggerDetailsTab.hint");↵
|
15 | }↵ | | 15 | }↵
|
|
16 | /** SQL that retrieves the data. */↵ | | 16 | /** SQL that retrieves the data. */↵
|
17 | private static String SQL =↵ | | 17 | private static String SQL =↵
|
18 | "select rdb$trigger_name, " +↵ | | 18 | "SELECT T1.owner AS trigger_owner, " +↵
|
19 | "rdb$trigger_sequence, " +↵ | | 19 | " T1.trigname AS trigger_name, " +↵
|
20 | "case rdb$trigger_type " +↵ | | 20 | " case T1.event " +↵
|
21 | " when 1 then 'BEFORE INSERT' " +↵ | | 21 | " when 'I' then 'INSERT' " +↵
|
22 | " when 2 then 'AFTER INSERT' " +↵ | | 22 | " when 'U' then 'UPDATE' " +↵
|
23 | " when 3 then 'BEFORE UPDATE' " +↵ | | 23 | " when 'D' then 'DELETE' " +↵
|
24 | " when 4 then 'AFTER UPDATE' " +↵ | | 24 | " when 'S' then 'SELECT' " +↵
|
25 | " when 5 then 'BEFORE DELETE' " +↵ | | 25 | " else T1.event " +↵
|
26 | " when 6 then 'AFTER DELETE' " +↵ | | 26 | " ↵
|
27 | " else 'UNKNOWN TYPE' || rdb$trigger_type " +↵ | | |
|
28 | "end as rdb$trigger_typ↵ | | 27 | end AS triggering_event, " +↵
|
| | | 28 | " T2.owner AS table_owner, " +↵
|
29 | e, " +↵ | | 29 | " T2.tabname AS table_name, " +↵
|
30 | "case rdb$trigger_inactive " +↵ | | 30 | " case T2.tabtype " +↵
|
31 | " when 0 then 'ACTIVE' " +↵ | | 31 | " when 'T' then 'TABLE' " +↵
|
32 | " when 1 then 'INACTIVE' " +↵ | | 32 | " when 'V' then 'VIEW' " +↵
|
33 | " else 'UNKNOWN' " +↵ | | 33 | " ↵
|
34 | "end as rdb$trigger_active, " +↵ | | |
|
35 | "rdb$description " +↵ | | |
|
36 | "from rdb$triggers where " +↵ | | |
|
37 | " rdb$trigger_↵ | | 34 | else T2.tabtype " +↵
|
| | | 35 | " end AS table_type, " +↵
|
| | | 36 | " T1.old AS reference_before, " +↵
|
| | | 37 | " T1.new AS reference_after " +↵
|
| | | 38 | "FROM informix.systriggers AS T1, " +↵
|
| | | 39 | " informix.systables AS T2 " +↵
|
| | | 40 | "WHERE T2.tabid = T1.tabid " +↵
|
38 | name = ?";↵ | | 41 | "and T1.trigname = ? ";↵
|
| | | 42 | ↵
|
39 | /** Logger for this class. */↵ | | 43 | /** Logger for this class. */↵
|
40 | private final static ILogger s_log =↵ | | 44 | private final static ILogger s_log =↵
|
41 | LoggerController.createLogger(TriggerDetailsTab.class);↵ | | 45 | LoggerController.createLogger(TriggerDetailsTab.class);↵
|
|
42 | public TriggerDetailsTab()↵ | | 46 | public TriggerDetailsTab()↵
|
43 | {↵ | | 47 | {↵
|
44 | super(i18n.TITLE, i18n.HINT, true);↵ | | 48 | super(i18n.TITLE, i18n.HINT, true);↵
|
45 | }↵ | | 49 | }↵
|
|
46 | protected PreparedStatement createStatement() throws SQLException↵ | | 50 | protected PreparedStatement createStatement() throws SQLException↵
|
47 | {↵ | | 51 | {↵
|
48 | ISession session = getSession();↵ | | 52 | ISession session = getSession();↵
|
| | | 53 | IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵
|
49 | if (s_log.isDebugEnabled()) {↵ | | 54 | if (s_log.isDebugEnabled()) {↵
|
50 | s_log.debug("Preparing SQL: "+SQL);↵ | | 55 | s_log.debug("Trigger details SQL: "+SQL);↵
|
51 | } ↵ | | 56 | s_log.debug("Trigger name: "+doi.getSimpleName());↵
|
| | | 57 | }↵
|
52 | PreparedStatement pstmt = session.getSQLConnection().prepareStatement(SQL);↵ | | 58 | PreparedStatement pstmt = session.getSQLConnection().prepareStatement(SQL);↵
|
53 | IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵ | | 59 | ↵
|
54 | if (s_log.isDebugEnabled()) {↵ | | |
|
55 | s_log.debug("setString param: "+doi.getSimpleName());↵ | | |
|
56 | } ↵ | | |
|
57 | pstmt.setString(1, doi.getSimpleName());↵ | | 60 | pstmt.setString(1, doi.getSimpleName());↵
|
58 | return pstmt | | 61 | return pstmt
|