comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/CompiledStatement.java @ 1023:5cb84ceee2a0

Datacage: Templates now can nest <dc:elements> into other elements in the body of <dc:context> flys-artifacts/trunk@2481 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 10 Aug 2011 10:08:01 +0000
parents aca3b46160cb
children 94df49614d92
comparison
equal deleted inserted replaced
1022:930a9ce24294 1023:5cb84ceee2a0
16 import net.sf.ehcache.Cache; 16 import net.sf.ehcache.Cache;
17 import net.sf.ehcache.Element; 17 import net.sf.ehcache.Element;
18 18
19 import de.intevation.flys.artifacts.cache.CacheFactory; 19 import de.intevation.flys.artifacts.cache.CacheFactory;
20 20
21 import org.apache.log4j.Logger;
22
21 public class CompiledStatement 23 public class CompiledStatement
22 { 24 {
25 private static Logger log = Logger.getLogger(CompiledStatement.class);
26
23 public static final String DATACAGE_DB_CACHE = 27 public static final String DATACAGE_DB_CACHE =
24 "datacage.db"; 28 "datacage.db";
25 29
26 public static final Pattern VAR = 30 public static final Pattern VAR =
27 Pattern.compile("\\$\\{([a-zA-Z0-9_-]+)\\}"); 31 Pattern.compile("\\$\\{([a-zA-Z0-9_-]+)\\}");
45 Connection connection, 49 Connection connection,
46 StackFrames frames 50 StackFrames frames
47 ) 51 )
48 throws SQLException 52 throws SQLException
49 { 53 {
54 log.debug("executeCached");
50 Object [] values = new Object[numVars]; 55 Object [] values = new Object[numVars];
51 56
52 StringBuilder sb = new StringBuilder(original); 57 StringBuilder sb = new StringBuilder(original);
53 58
54 for (Map.Entry<String, List<Integer>> entry: positions.entrySet()) { 59 for (Map.Entry<String, List<Integer>> entry: positions.entrySet()) {
99 Connection connection, 104 Connection connection,
100 StackFrames frames 105 StackFrames frames
101 ) 106 )
102 throws SQLException 107 throws SQLException
103 { 108 {
109 log.debug("executeUncached");
104 if (preparedStatement == null) { 110 if (preparedStatement == null) {
111 if (log.isDebugEnabled()) {
112 log.debug("preparing statement: " + statement);
113 }
105 preparedStatement = connection.prepareStatement(statement); 114 preparedStatement = connection.prepareStatement(statement);
106 } 115 }
107 116
108 for (Map.Entry<String, List<Integer>> entry: positions.entrySet()) { 117 for (Map.Entry<String, List<Integer>> entry: positions.entrySet()) {
109 Object value = frames.get(entry.getKey()); 118 Object value = frames.get(entry.getKey());

http://dive4elements.wald.intevation.org