Mercurial > dive4elements > gnv-client
comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java @ 1123:f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
geo-backend/trunk@1154 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 04 Jun 2010 08:19:38 +0000 |
parents | d387a97807a3 |
children | ebeb56428409 |
comparison
equal
deleted
inserted
replaced
1122:1985d5db0feb | 1123:f76541120bcb |
---|---|
10 import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; | 10 import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; |
11 | 11 |
12 import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; | 12 import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; |
13 | 13 |
14 import de.intevation.gnv.geobackend.base.query.exception.QueryException; | 14 import de.intevation.gnv.geobackend.base.query.exception.QueryException; |
15 | |
16 import de.intevation.gnv.geobackend.sde.datasources.Uncacheable; | |
15 | 17 |
16 import java.sql.Connection; | 18 import java.sql.Connection; |
17 import java.sql.ResultSet; | 19 import java.sql.ResultSet; |
18 import java.sql.SQLException; | 20 import java.sql.SQLException; |
19 import java.sql.Statement; | 21 import java.sql.Statement; |
72 | 74 |
73 if (returnValue != null) { | 75 if (returnValue != null) { |
74 return returnValue; | 76 return returnValue; |
75 } | 77 } |
76 | 78 |
77 Connection connection = null; | 79 boolean cacheable = true; |
80 Connection connection = null; | |
78 ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool(); | 81 ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool(); |
79 try { | 82 try { |
80 // Submit the Query | 83 // Submit the Query |
81 connection = connectionPool.getConnection(this.connectionID); | 84 connection = connectionPool.getConnection(this.connectionID); |
82 if (connection != null){ | 85 if (connection != null){ |
84 Date start = new Date(); | 87 Date start = new Date(); |
85 ResultSet rs = stmt.executeQuery(queryString); | 88 ResultSet rs = stmt.executeQuery(queryString); |
86 Date end = new Date(); | 89 Date end = new Date(); |
87 log.info("-> Database query took " + | 90 log.info("-> Database query took " + |
88 (end.getTime() - start.getTime()) + " ms."); | 91 (end.getTime() - start.getTime()) + " ms."); |
92 | |
93 cacheable = rs instanceof Uncacheable ? false : true; | |
94 | |
89 returnValue = super.createResultCollection(rs); | 95 returnValue = super.createResultCollection(rs); |
90 }else{ | 96 }else{ |
91 log.error("Could not establish Databaseconnection."); | 97 log.error("Could not establish Databaseconnection."); |
92 throw new QueryException("Could not establish Databaseconnection."); | 98 throw new QueryException("Could not establish Databaseconnection."); |
93 } | 99 } |
94 | 100 |
95 cacheResults(queryString, returnValue); | 101 if (cacheable) { |
102 log.debug("Elements are cacheable."); | |
103 cacheResults(queryString, returnValue); | |
104 } | |
105 else { | |
106 log.debug("Elements are NOT cacheable."); | |
107 } | |
96 | 108 |
97 } catch (ConnectionException e) { | 109 } catch (ConnectionException e) { |
98 log.error(e,e); | 110 log.error(e,e); |
99 throw new QueryException("Could not establish Databaseconnection.",e); | 111 throw new QueryException("Could not establish Databaseconnection.",e); |
100 } catch (SQLException e) { | 112 } catch (SQLException e) { |