comparison artifact-database/src/main/java/de/intevation/artifactdatabase/h2/CollectionAccessUpdateTrigger.java @ 305:f33401ea2a6c

Artifact database: Refactorized the usage of dialect independent SQL to be reusable. artifacts/trunk@2412 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 28 Jul 2011 10:19:35 +0000
parents 16cd059945e5
children
comparison
equal deleted inserted replaced
304:40b64b4aafce 305:f33401ea2a6c
4 4
5 import java.sql.Connection; 5 import java.sql.Connection;
6 import java.sql.SQLException; 6 import java.sql.SQLException;
7 import java.sql.PreparedStatement; 7 import java.sql.PreparedStatement;
8 8
9 import de.intevation.artifactdatabase.SQL; 9 import de.intevation.artifactdatabase.DBConfig;
10
11 import de.intevation.artifactdatabase.db.SQL;
10 12
11 import org.apache.log4j.Logger; 13 import org.apache.log4j.Logger;
12 14
13 public class CollectionAccessUpdateTrigger 15 public class CollectionAccessUpdateTrigger
14 implements Trigger 16 implements Trigger
15 { 17 {
16 private static Logger logger = 18 private static Logger logger =
17 Logger.getLogger(CollectionAccessUpdateTrigger.class); 19 Logger.getLogger(CollectionAccessUpdateTrigger.class);
18 20
19 public static final String COLLECTIONS_TOUCH_TRIGGER_FUNCTION = 21 public String COLLECTIONS_TOUCH_TRIGGER_FUNCTION;
20 SQL.get("collections.touch.trigger.function");
21 22
22 public void init( 23 public void init(
23 Connection conn, 24 Connection conn,
24 String schemaName, 25 String schemaName,
25 String triggerName, 26 String triggerName,
27 boolean before, 28 boolean before,
28 int type 29 int type
29 ) 30 )
30 throws SQLException { 31 throws SQLException {
31 logger.debug("CollectionAccessUpdateTrigger.init"); 32 logger.debug("CollectionAccessUpdateTrigger.init");
33 setupSQL(DBConfig.getInstance().getSQL());
34 }
35
36 protected void setupSQL(SQL sql) {
37 COLLECTIONS_TOUCH_TRIGGER_FUNCTION =
38 sql.get("collections.touch.trigger.function");
32 } 39 }
33 40
34 public void fire( 41 public void fire(
35 Connection conn, 42 Connection conn,
36 Object [] oldRow, 43 Object [] oldRow,

http://dive4elements.wald.intevation.org