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