1 | public class MysqlTableTriggerExtractorImpl implements ITableTriggerExtractor {↵ | | 1 | public class SybaseTableTriggerExtractorImpl 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(MysqlTableTriggerExtractorImpl.class); ↵ | | 4 | LoggerController.createLogger(SybaseTableTriggerExtractorImpl.class);↵
|
5 | ↵ | | 5 | ↵
|
6 | /** The query that finds the trigger definition */↵ | | 6 | /** The query that finds the triggers for a given table */↵
|
7 | private static String SQL = ↵ | | 7 | private static String ↵
|
8 | "select TRIGGER_NAME↵ | | 8 | query = ↵
|
| | | 9 | "SELECT triggers.name " +↵
|
| | | 10 | "FROM sysobjects tables , sysobjects triggers " +↵
|
| | | 11 | "where triggers.type = 'TR' " +↵
|
| | | 12 | "and triggers.deltrig = tables.id " +↵
|
| | | 13 | "and tables.loginame = ? " +↵
|
| | | 14 | "and tables.name = ? ";↵
|
| | | 15 | ↵
|
| | | 16 | // trigger source↵
|
| | | 17 | // "SELECT text " +↵
|
9 | " +↵ | | 18 | // "FROM dbo.sysobjects " +↵
|
10 | "from information_schema.triggers " +↵ | | 19 | // "inner join syscomments on syscomments.id = sysobjects.id " +↵
|
11 | "where EVENT_OBJECT_SCHEMA = ? " +↵ | | 20 | // "where loginame = ? " +↵
|
12 | "and EVENT_OBJECT_TABLE = ? ";↵ | | 21 | // "and ↵
|
| | | 22 | name = ? " +↵
|
| | | 23 | // "and type = 'TR' "; ↵
|
13 | ↵ | | 24 | ↵
|
14 | /**↵ | | 25 | /**↵
|
15 | * @see net.sourceforge.squirrel_sql.plugins.derby.exp.ITableTriggerExtractor#bindParamters(java.sql.PreparedStatement, net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo)↵ | | 26 | * @see net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.expanders.ITableTriggerExtractor#bindParamters(java.sql.PreparedStatement, net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo)↵
|
16 | */↵ | | 27 | */↵
|
17 | public void bindParamters(PreparedStatement pstmt, IDatabaseObjectInfo dbo) ↵ | | 28 | public void bindParamters(PreparedStatement pstmt, IDatabaseObjectInfo dbo) ↵
|
18 | throws SQLException ↵ | | 29 | throws SQLException ↵
|
19 | {↵ | | 30 | {↵
|
20 | if (s_log.isDebugEnabled()) {↵ | | 31 | if (s_log.isDebugEnabled()) {↵
|
21 | s_log.debug("Binding catalog name "+dbo.getCatalogName()+↵ | | 32 | s_log.debug("Binding catalog name "+dbo.getCatalogName()+↵
|
22 | " as first bind value");↵ | | 33 | " as first bind value"); ↵
|
23 | s_log.debug("Binding table name "+dbo.getSimpleName()+↵ | | 34 | s_log.debug("Binding table name "+dbo.getSimpleName()+↵
|
24 | " as second bind value"); ↵ | | 35 | " as second bind value");↵
|
25 | ↵ | | 36 | ↵
|
26 | }↵ | | 37 | } ↵
|
27 | pstmt.setString(1, dbo.getCatalogName());↵ | | 38 | pstmt.setString(1, dbo.getCatalogName());↵
|
28 | pstmt.setString(2, dbo.getSimpleName());↵ | | 39 | pstmt.setString(2, dbo.getSimpleName());↵
|
29 | ↵ | | 40 | ↵
|
30 | }↵ | | 41 | }↵
|
|
31 | /**↵ | | 42 | /**↵
|
32 | * @see net.sourceforge.squirrel_sql.plugins.derby.exp.ITableTriggerExtractor#getTableTriggerQuery()↵ | | 43 | * @see net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.expanders.ITableTriggerExtractor#getTableTriggerQuery()↵
|
33 | */↵ | | 44 | */↵
|
34 | public String getTableTriggerQuery() {↵ | | 45 | public String getTableTriggerQuery() {↵
|
35 | return SQL | | 46 | return query
|