1 | public class DerbyTableTriggerExtractorImpl implements ITableTriggerExtractor {↵ | | 1 | public class MysqlTableTriggerExtractorImpl implements ITableTriggerExtractor {↵
|
|
2 | /** Logger for this class */↵ | | 2 | /** Logger for this class */↵
|
3 | private final static ILogger s_log = ↵ | | 3 | private final static ILogger s_log = ↵
|
4 | LoggerController.createLogger(DerbyTableTriggerExtractorImpl.class);↵ | | 4 | LoggerController.createLogger(MysqlTableTriggerExtractorImpl.class);↵
|
5 | ↵ | | 5 | ↵
|
6 | ↵ | | 6 | ↵
|
7 | /** The query that finds the triggers for a given table */↵ | | 7 | /** The query that finds the trigger definition */↵
|
8 | private static String SQL = ↵ | | 8 | private static String SQL = ↵
|
9 | "select tr.TRIGGERNAME " +↵ | | 9 | "select TRIGGER_NAME " +↵
|
10 | "from SYS.SYSTRIGGERS tr, SYS.SYSTABLES t, SYS.SYSSCHEMAS s " +↵ | | 10 | "from ↵
|
11 | "where tr.TABLEID = t.TABLEID " +↵ | | |
|
12 | "and s.↵ | | 11 | information_schema.triggers " +↵
|
13 | SCHEMAID = t.SCHEMAID " +↵ | | 12 | "where EVENT_OBJECT_SCHEMA = ? " +↵
|
14 | "and t.TABLENAME = ? " +↵ | | 13 | "and ↵
|
15 | "and s.SCHEMANAME = ? ";↵ | | 14 | EVENT_OBJECT_TABLE = ? ";↵
|
16 | ↵ | | 15 | ↵
|
17 | /**↵ | | 16 | /**↵
|
18 | * @see net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.expanders.ITableTriggerExtractor#bindParamters(java.sql.PreparedStatement, net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo)↵ | | 17 | * @see net.sourceforge.squirrel_sql.plugins.derby.exp.ITableTriggerExtractor#bindParamters(java.sql.PreparedStatement, net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo)↵
|
19 | */↵ | | 18 | */↵
|
20 | public void bindParamters(PreparedStatement pstmt, IDatabaseObjectInfo dbo) ↵ | | 19 | public void bindParamters(PreparedStatement pstmt, IDatabaseObjectInfo dbo) ↵
|
21 | throws SQLException ↵ | | 20 | throws SQLException ↵
|
22 | {↵ | | 21 | {↵
|
23 | if (s_log.isDebugEnabled()) {↵ | | 22 | if (s_log.isDebugEnabled()) {↵
|
24 | s_log.debug("Binding table name "+dbo.getSimpleName()+↵ | | 23 | s_log.debug("Binding catalog name "+dbo.getCatalogName()+↵
|
25 | " as first bind value"); ↵ | | 24 | " as first bind value");↵
|
26 | s_log.debug("Binding schema name "+dbo.getSchemaName()+↵ | | 25 | s_log.debug("Binding table name "+dbo.getSimpleName()+↵
|
27 | " as second bind value");↵ | | 26 | " as second bind value");↵
|
28 | }↵ | | 27 | ↵
|
29 | ↵ | | 28 | }↵
|
30 | pstmt.setString(1, dbo.getSimpleName());↵ | | 29 | pstmt.setString(1, dbo.getCatalogName());↵
|
31 | pstmt.setString(2, dbo.getSchemaName()); ↵ | | 30 | pstmt.setString(2, dbo.getSimpleName()); ↵
|
32 | }↵ | | 31 | }↵
|
|
33 | /**↵ | | 32 | /**↵
|
34 | * @see net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.expanders.ITableTriggerExtractor#getTableTriggerQuery()↵ | | 33 | * @see net.sourceforge.squirrel_sql.plugins.derby.exp.ITableTriggerExtractor#getTableTriggerQuery()↵
|
35 | */↵ | | 34 | */↵
|
36 | public String getTableTriggerQuery() {↵ | | 35 | public String getTableTriggerQuery() {↵
|
37 | return SQL | | 36 | return SQL
|