annotate geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.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 b757def3ff55
children ebeb56428409
rev   line source
266
1530890b28c9 Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause
Tim Englich <tim.englich@intevation.de>
parents: 263
diff changeset
1 package de.intevation.gnv.geobackend.sde.datasources;
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
3 import com.esri.sde.sdk.client.SDEPoint;
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 import com.esri.sde.sdk.client.SeColumnDefinition;
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
5 import com.esri.sde.sdk.client.SeConnection;
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 import com.esri.sde.sdk.client.SeException;
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
7 import com.esri.sde.sdk.client.SeExtent;
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
8 import com.esri.sde.sdk.client.SeFilter;
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
9 import com.esri.sde.sdk.client.SeLayer;
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import com.esri.sde.sdk.client.SeQuery;
267
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
11 import com.esri.sde.sdk.client.SeQueryInfo;
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
12 import com.esri.sde.sdk.client.SeRaster;
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
13 import com.esri.sde.sdk.client.SeRasterAttr;
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
14 import com.esri.sde.sdk.client.SeRasterBand;
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
15 import com.esri.sde.sdk.client.SeRasterConstraint;
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
16 import com.esri.sde.sdk.client.SeRasterTile;
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 import com.esri.sde.sdk.client.SeRow;
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
18 import com.esri.sde.sdk.client.SeShape;
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
19 import com.esri.sde.sdk.client.SeShapeFilter;
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
20 import com.esri.sde.sdk.client.SeSqlConstruct;
886
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
21
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
22 import com.vividsolutions.jts.geom.Geometry;
879
9bcc423d8d76 Added Support for SpatialQueries using LineString as Geometry of Interest.
Tim Englich <tim.englich@intevation.de>
parents: 555
diff changeset
23 import com.vividsolutions.jts.geom.LineString;
383
0b813ae17173 Added Point in Polygon Query Support to ArcSDE-Statement-Processing
Tim Englich <tim.englich@intevation.de>
parents: 380
diff changeset
24 import com.vividsolutions.jts.geom.Point;
0b813ae17173 Added Point in Polygon Query Support to ArcSDE-Statement-Processing
Tim Englich <tim.englich@intevation.de>
parents: 380
diff changeset
25 import com.vividsolutions.jts.geom.Polygon;
886
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
26
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
27 import com.vividsolutions.jts.io.WKTReader;
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
28
555
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
29 import de.intevation.gnv.geobackend.util.RedundancyRemover;
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
30
886
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
31 import java.sql.Connection;
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
32 import java.sql.ResultSet;
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
33 import java.sql.SQLException;
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
34 import java.sql.SQLWarning;
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
35 import java.sql.Statement;
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
36
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
37 import org.apache.log4j.Logger;
8b442223741c Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 885
diff changeset
38
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
39 /**
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
40 * This Class wrapps an SDE-Statment to an java.sql.Statement.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
41 * This Class also handles the SDE-Specific -Spatial-Queries and
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
42 * RasterQueries.
887
b757def3ff55 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 886
diff changeset
43 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
b757def3ff55 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 886
diff changeset
44 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 */
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 public class ArcSDEStatement implements Statement {
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
48 /**
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 * the logger, used to log exceptions and additonaly information
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 */
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 private static Logger log = Logger.getLogger(ArcSDEStatement.class);
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
52
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
53 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
54 * The Connection to the ArcSDE-Backend
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
55 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
56 private ArcSDEConnection connection = null;
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
57
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
58 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
59 * Constructor
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
60 * @param connection the Connection to the ArcSDE-Backend.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
61 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
62 public ArcSDEStatement(ArcSDEConnection connection) {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
63 this.connection = connection;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
64 }
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
66 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
67 * @see java.sql.Statement#addBatch(java.lang.String)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
68 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
69 public void addBatch(String arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
70 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
71
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
72 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
73 * @see java.sql.Statement#cancel()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
74 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
75 public void cancel() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
76 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
77
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
78 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
79 * @see java.sql.Statement#clearBatch()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
80 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
81 public void clearBatch() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
82 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
83
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
84 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
85 * @see java.sql.Statement#clearWarnings()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
86 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
87 public void clearWarnings() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
88 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
89
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
90 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
91 * @see java.sql.Statement#close()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
92 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
93 public void close() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
94 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
95
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
96 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
97 * @see java.sql.Statement#execute(java.lang.String)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
98 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
99 public boolean execute(String arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
100 return false;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
101 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
102
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
103 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
104 * @see java.sql.Statement#execute(java.lang.String, int)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
105 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
106 public boolean execute(String arg0, int arg1) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
107 return false;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
108 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
109
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
110 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
111 * @see java.sql.Statement#execute(java.lang.String, int[])
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
112 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
113 public boolean execute(String arg0, int[] arg1) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
114 return false;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
115 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
116
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
117 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
118 * @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
119 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
120 public boolean execute(String arg0, String[] arg1) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
121 return false;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
122 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
123
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
124 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
125 * @see java.sql.Statement#executeBatch()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
126 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
127 public int[] executeBatch() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
128 return null;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
129 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
130
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
131 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
132 * @see java.sql.Statement#executeQuery(java.lang.String)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
133 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
134 public ResultSet executeQuery(String statement) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
135 try {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
136 SeQuery query = null;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
137 if (statement.toLowerCase().contains("st_astext") || statement.toLowerCase().contains("intersects")){
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
138
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
139 String[] values = statement.toLowerCase().split("where", 2);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
140 String where = values.length > 1 ? values[1].trim() : "";
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
141 String[] tableNames = values[0].substring(values[0].indexOf("from")).replaceFirst("from", "").toUpperCase().trim().split(", ");
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
142 String columnValueString = values[0].substring(0, values[0].indexOf("from")).trim();
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
143 columnValueString = columnValueString.replaceFirst("select", "").trim();
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
144 String[] returnFields = columnValueString.split(", ");
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
145 String geometryColumnName = null;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
146 String byClause = null;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
147 int byClausePos = where.indexOf("group by");
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
148 if (byClausePos < 0){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
149 byClausePos = where.indexOf("order by");
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
150 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
151 if (byClausePos > 0){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
152 byClause = where.substring(byClausePos);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
153 where = where.substring(0,byClausePos);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
154 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
155
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
156 for (int i = 0; i < returnFields.length; i++){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
157 returnFields[i] = returnFields[i].trim();
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
158 if (returnFields[i].startsWith("st_astext(")){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
159 returnFields[i] = returnFields[i].replaceAll("st_astext", "");
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
160 returnFields[i] = returnFields[i].substring(1, returnFields[i].length()-1);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
161 geometryColumnName = returnFields[i];
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
162 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
163 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
164
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
165 for (int i = 0; i < tableNames.length; i++){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
166 tableNames[i] = tableNames[i].trim();
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
167 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
168
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
169 Geometry g = null;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
170 int pos = where.indexOf("intersects");
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
171 if (pos >= 0 ){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
172 String substr = where.substring(pos);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
173 where = where.substring(0,where.lastIndexOf("intersects"));
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
174 int andPos = where.lastIndexOf("and");
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
175 if (andPos < 0){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
176 andPos = 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
177 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
178 where = where.substring(0,andPos); // TODO support or also
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
179 String intersectsStmt = substr.substring(0, substr.lastIndexOf(")")); // Spatial-Statment is the last one
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
180 String wkt = null;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
181 if (intersectsStmt.contains("select")){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
182 // Anstelle eines WKT ist ein InnerSelect zum Bestimmen der Comparatorgeometrie gegeben.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
183 String stmt = intersectsStmt.substring(intersectsStmt.indexOf("select"),intersectsStmt.lastIndexOf(")"));
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
184 ResultSet resultSet = this.executeQuery(stmt);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
185 if (resultSet != null && resultSet.next()){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
186 // TODO: Support the selection of more than one Geometry
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
187 wkt = resultSet.getString("SHAPE");
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
188 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
189 }else{
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
190 wkt = intersectsStmt.substring(intersectsStmt.indexOf("\""), intersectsStmt.lastIndexOf("\"")).replace("\"", "").trim();
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
191 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
192 g = new WKTReader().read(wkt.toUpperCase());
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
193
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
194 if (geometryColumnName == null){
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
195 geometryColumnName = "SHAPE"; // TODO dynamisch aus Intersects auslesen.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
196 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
197
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
198 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
199
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
200 return this.executeQuery(this.connection.getSeConnection(), tableNames, geometryColumnName, where, g, returnFields,byClause);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
201 }else{
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
202 query = new SeQuery(this.connection.getSeConnection());
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
203 query.prepareSql(statement);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
204 query.execute();
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
205 return this.handleResultSet(query,false,null);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
206 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
207
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
208 } catch (Exception e) {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
209 log.error(e,e);
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
210 throw new SQLException(e.getMessage());
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
211 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
212
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
213
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
214 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
215 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
216 * This Methods Executes the ArcSDE Query if Spatial-Restrictions
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
217 * are given
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
218 * @param con The Connection to the ArcSDE-Backend.
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
219 * @param pLayername The Name of tables which should be used in the Query
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
220 * @param pSpatialColumnName the Name of the Spatial Column.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
221 * @param pWhere The where-Clause to limit the Data
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
222 * @param g the Geometry to limit the Data
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
223 * @param pReturnFields the Fileds that should be fetched from the Database
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
224 * @param byClause the byClaus to order the Results.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
225 * @return the @see java.sql.ResultSet with the Data which was retrieved.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
226 * @throws SQLException
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
227 */
267
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
228 private ResultSet executeQuery(SeConnection con, String[] pLayername,
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
229 String pSpatialColumnName, String pWhere,
267
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
230 Geometry g, String[] pReturnFields, String byClause)
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
231 throws SQLException {
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
232 log.debug("executeQuery()");
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
233 try {
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
234 // get the layer for querying
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
235 boolean isRaster = pSpatialColumnName.equalsIgnoreCase("raster");
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
236
266
1530890b28c9 Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause
Tim Englich <tim.englich@intevation.de>
parents: 263
diff changeset
237 SeShapeFilter[] filters = null;
1530890b28c9 Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause
Tim Englich <tim.englich@intevation.de>
parents: 263
diff changeset
238 if (g != null){
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
239 if (!isRaster){
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
240 SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName);
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
241 SeShape shape = new SeShape();
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
242 shape.setCoordRef(lLayer.getCoordRef());
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
243
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
244 SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g);
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
245
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
246 int searchMode = SeFilter.METHOD_AI;
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
247 if (g instanceof Polygon){
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
248 shape.generatePolygon(lPoints.length, 1, null, lPoints);
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
249 }else if (g instanceof Point){
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
250 shape.generatePoint(1, lPoints);
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
251 searchMode = SeFilter.METHOD_PC;
879
9bcc423d8d76 Added Support for SpatialQueries using LineString as Geometry of Interest.
Tim Englich <tim.englich@intevation.de>
parents: 555
diff changeset
252 }else if (g instanceof LineString){
9bcc423d8d76 Added Support for SpatialQueries using LineString as Geometry of Interest.
Tim Englich <tim.englich@intevation.de>
parents: 555
diff changeset
253 shape.generateLine(lPoints.length, 1, null, lPoints);
9bcc423d8d76 Added Support for SpatialQueries using LineString as Geometry of Interest.
Tim Englich <tim.englich@intevation.de>
parents: 555
diff changeset
254 searchMode = SeFilter.METHOD_LCROSS;
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
255 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
256
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
257 SeShapeFilter filter = new SeShapeFilter(pLayername[0],
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
258 pSpatialColumnName, shape,searchMode);
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
259 filters = new SeShapeFilter[1];
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
260 filters[0] = filter;
383
0b813ae17173 Added Point in Polygon Query Support to ArcSDE-Statement-Processing
Tim Englich <tim.englich@intevation.de>
parents: 380
diff changeset
261 }
266
1530890b28c9 Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause
Tim Englich <tim.englich@intevation.de>
parents: 263
diff changeset
262 }
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
264 SeQuery spatialQuery = null;
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
265 SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere);
267
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
266 spatialQuery = new SeQuery(con);//, pReturnFields, sqlCons);
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
267
267
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
268 SeQueryInfo queryInfo = new SeQueryInfo();
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
269 queryInfo.setColumns(pReturnFields);
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
270
267
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
271 if (byClause != null){
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
272 queryInfo.setByClause(byClause);
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
273 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
274
267
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
275 queryInfo.setConstruct(sqlCons);
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
276 spatialQuery.prepareQueryInfo(queryInfo);
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
277
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
278 /*
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
279 * Set spatial constraints
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
280 */
266
1530890b28c9 Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause
Tim Englich <tim.englich@intevation.de>
parents: 263
diff changeset
281 if (filters != null){
1530890b28c9 Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause
Tim Englich <tim.englich@intevation.de>
parents: 263
diff changeset
282 spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false,
1530890b28c9 Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause
Tim Englich <tim.englich@intevation.de>
parents: 263
diff changeset
283 filters);
1530890b28c9 Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause
Tim Englich <tim.englich@intevation.de>
parents: 263
diff changeset
284 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
285
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
286 if (!isRaster){
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
287 spatialQuery.execute();
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
288 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
289
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
290 return this.handleResultSet(spatialQuery,isRaster,g);
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
291
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
292 } catch (Exception e) {
267
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
293 if (e instanceof SeException){
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
294 ArcSDEUtils.printError((SeException)e);
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
295 }else{
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
296 log.error(e.getMessage(), e);
000e00592ba5 Added InnerJoin, Order By and Group By Support to Spatial-Queries
Tim Englich <tim.englich@intevation.de>
parents: 266
diff changeset
297 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
298
263
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
299 throw new SQLException(e.getMessage());
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
300 }
031ef9649cd1 Added SFS-Support to ArcSDE-Query-Part
Tim Englich <tim.englich@intevation.de>
parents: 143
diff changeset
301 }
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
302
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
303 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
304 * @see java.sql.Statement#executeUpdate(java.lang.String)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
305 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
306 public int executeUpdate(String arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
307 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
308 }
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
309
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
310 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
311 * @see java.sql.Statement#executeUpdate(java.lang.String, int)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
312 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
313 public int executeUpdate(String arg0, int arg1) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
314 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
315 }
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
316
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
317 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
318 * @see java.sql.Statement#executeUpdate(java.lang.String, int[])
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
319 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
320 public int executeUpdate(String arg0, int[] arg1) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
321 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
322 }
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
323
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
324 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
325 * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[])
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
326 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
327 public int executeUpdate(String arg0, String[] arg1) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
328 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
329 }
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
330
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
331 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
332 * @see java.sql.Statement#getConnection()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
333 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
334 public Connection getConnection() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
335 return this.connection;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
336 }
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
337
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
338 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
339 * @see java.sql.Statement#getFetchDirection()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
340 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
341 public int getFetchDirection() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
342 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
343 }
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
344
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
345 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
346 * @see java.sql.Statement#getFetchSize()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
347 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
348 public int getFetchSize() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
349 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
350 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
351
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
352 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
353 * @see java.sql.Statement#getGeneratedKeys()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
354 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
355 public ResultSet getGeneratedKeys() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
356 return null;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
357 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
358
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
359 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
360 * @see java.sql.Statement#getMaxFieldSize()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
361 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
362 public int getMaxFieldSize() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
363 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
364 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
365
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
366 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
367 * @see java.sql.Statement#getMaxRows()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
368 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
369 public int getMaxRows() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
370 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
371 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
372
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
373 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
374 * @see java.sql.Statement#getMoreResults()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
375 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
376 public boolean getMoreResults() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
377 return false;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
378 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
379
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
380 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
381 * @see java.sql.Statement#getMoreResults(int)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
382 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
383 public boolean getMoreResults(int arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
384 return false;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
385 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
386
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
387 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
388 * @see java.sql.Statement#getQueryTimeout()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
389 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
390 public int getQueryTimeout() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
391 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
392 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
393
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
394 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
395 * @see java.sql.Statement#getResultSet()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
396 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
397 public ResultSet getResultSet() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
398 return null;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
399 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
400
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
401 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
402 * @see java.sql.Statement#getResultSetConcurrency()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
403 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
404 public int getResultSetConcurrency() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
405 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
406 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
407
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
408 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
409 * @see java.sql.Statement#getResultSetHoldability()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
410 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
411 public int getResultSetHoldability() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
412 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
413 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
414
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
415 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
416 * @see java.sql.Statement#getResultSetType()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
417 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
418 public int getResultSetType() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
419 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
420 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
421
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
422 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
423 * @see java.sql.Statement#getUpdateCount()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
424 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
425 public int getUpdateCount() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
426 return 0;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
427 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
428
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
429 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
430 * @see java.sql.Statement#getWarnings()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
431 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
432 public SQLWarning getWarnings() throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
433 return null;
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
434 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
435
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
436 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
437 * @see java.sql.Statement#setCursorName(java.lang.String)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
438 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
439 public void setCursorName(String arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
440 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
441
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
442 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
443 * @see java.sql.Statement#setEscapeProcessing(boolean)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
444 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
445 public void setEscapeProcessing(boolean arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
446 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
447
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
448 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
449 * @see java.sql.Statement#setFetchDirection(int)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
450 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
451 public void setFetchDirection(int arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
452 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
453
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
454 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
455 * @see java.sql.Statement#setFetchSize(int)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
456 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
457 public void setFetchSize(int arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
458 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
459
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
460 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
461 * @see java.sql.Statement#setMaxFieldSize(int)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
462 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
463 public void setMaxFieldSize(int arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
464 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
465
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
466 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
467 * @see java.sql.Statement#setMaxRows(int)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
468 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
469 public void setMaxRows(int arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
470 }
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
471
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
472 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
473 * @see java.sql.Statement#setQueryTimeout(int)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
474 */
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
475 public void setQueryTimeout(int arg0) throws SQLException {
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
476 }
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
477
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
478 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
479 * This Method fetches all Rows from the SeQuery-Object and convert it into
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
480 * an @see java.sql.ResultSet.
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
481 *
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
482 * @param pSeQuery the Queryobject where the Data should be fetched from.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
483 * @param isRaster Flag which indicates if the Result is Rasterdata.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
484 * @param geometry The Geometry which might be used to limit the data.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
485 * @return an java.sql:ResultSet which contains the Data.
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
486 * @throws SeException
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
487 */
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
488 private ResultSet handleResultSet(SeQuery pSeQuery,
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
489 boolean isRaster,
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
490 Geometry geometry) throws SeException {
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
491 boolean debug = log.isDebugEnabled();
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
492
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
493 if (debug) {
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
494 log.debug("ArcSDEStatement.handleResultSet()");
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
495 }
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
496
1123
f76541120bcb Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 887
diff changeset
497 SDEResultSet lSet = isRaster
f76541120bcb Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 887
diff changeset
498 ? new UncacheableSDEResultSet()
f76541120bcb Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 887
diff changeset
499 : new SDEResultSet();
555
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
500 SeRow row = null;
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
501 int lCount;
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
502 if (!isRaster){
555
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
503 RedundancyRemover [] removers = null;
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
504 SeColumnDefinition [] lCols = null;
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
505
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
506 for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) {
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
507 // one time execution
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
508 if (lCount == 0) {
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
509 // analyze cols of result set
555
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
510 lCols = row.getColumns();
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
511 for (SeColumnDefinition lCol : lCols) {
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
512 lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType()));
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
513 // notice: esri-types have been copied into colDefinition class!
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
514 }
555
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
515 removers = new RedundancyRemover[lCols.length];
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
516 for (int i = 0; i < removers.length; ++i) {
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
517 removers[i] = new RedundancyRemover();
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
518 }
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
519 }
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
520 short lNumCols = row.getNumColumns();
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
521 Row lBackingRow = new Row(lNumCols);
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
522 for (int i = 0; i < lNumCols; i++) {
555
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
523 lBackingRow.addObject(
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
524 removers[i].filter(row.getObject(i)),
555
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
525 i);
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
526 }
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
527 lSet.addRow(lBackingRow);
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
528 }
555
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
529
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
530 if (debug && removers != null) {
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
531 log.debug("datasets: " + lCount);
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
532 StringBuilder sb = new StringBuilder("removed redundancy: ");
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
533 float percent = 100f/lCount;
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
534 for (int i = 0; i < removers.length; ++i) {
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
535 if (i > 0) sb.append(", ");
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
536 sb.append(lCols[i].getName())
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
537 .append(": ").append(removers[i].numRemoved())
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
538 .append(" (").append(removers[i].numRemoved()*percent)
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
539 .append("%)");
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
540 }
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
541 log.debug(sb.toString());
825781a39c70 Fixed gnv/issue107
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 552
diff changeset
542 }
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
543 }else{
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
544 try {
544
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
545 pSeQuery.execute();
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
546 row = pSeQuery.fetch();
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
547 SeRasterAttr attr = row.getRaster(0);
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
548 SeRaster raster = attr.getRasterInfo();
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
549 SeRasterBand [] bands = raster.getBands();
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
550 SeRasterBand rasterBand = bands[0];
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
551
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
552 SeExtent extent = rasterBand.getExtent();
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
553
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
554 double x = ((Point)geometry).getX();
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
555 double y = ((Point)geometry).getY();
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
556
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
557 boolean isPointInRaster =
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
558 x >= extent.getMinX() && x <= extent.getMaxX()
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
559 && y >= extent.getMinY() && y <= extent.getMaxY();
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
560
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
561 if (isPointInRaster){
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
562
544
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
563 if (row == null){
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
564 pSeQuery.execute();
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
565 row = pSeQuery.fetch();
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
566 }
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
567
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
568 double midX = 0.5d*(extent.getMinX() + extent.getMaxX());
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
569 double midY = 0.5d*(extent.getMinY() + extent.getMaxY());
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
570
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
571 SDEPoint origin = rasterBand.getTileOrigin();
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
572
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
573 double maxX = origin.getX() < midX
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
574 ? extent.getMaxX()
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
575 : extent.getMinX();
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
576
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
577 double maxY = origin.getY() < midY
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
578 ? extent.getMaxY()
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
579 : extent.getMinY();
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
580
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
581 double mx = rasterBand.getBandWidth()/(maxX-origin.getX());
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
582 double bx = -origin.getX()*mx;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
583 double px = mx*x + bx;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
584
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
585 double my = rasterBand.getBandHeight()/(maxY-origin.getY());
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
586 double by = -origin.getY()*my;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
587 double py = my*y + by;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
588
544
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
589 SeRasterConstraint constraint = new SeRasterConstraint();
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
590 constraint.setLevel(0); // best resolution
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
591 constraint.setBands(rasterBand.getBandNumber());
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
592 int tx = (int)Math.floor(px / rasterBand.getTileWidth());
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
593 int ty = (int)Math.floor(py / rasterBand.getTileHeight());
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
594 constraint.setEnvelope(tx, ty, tx, ty);
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
595
544
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
596 pSeQuery.queryRasterTile(constraint);
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
597 SeRasterTile tile = row.getRasterTile();
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
598
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
599 if (tile != null){
544
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
600 double[] tileValues = new double[tile.getNumPixels()];
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
601 tileValues = tile.getPixels(tileValues);
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
602 lSet.addCol(new ColDefinition("tile", ColDefinition.FLOAT64));
544
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
603 Row lBackingRow = new Row(1);
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
604
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
605 double wx1 = (rasterBand.getTileWidth()*tx - bx)/mx;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
606 double wx2 = (rasterBand.getTileWidth()*(tx+1) - bx)/mx;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
607 double mxt = (rasterBand.getTileWidth()-1e-5d)/(wx2 - wx1);
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
608 double bxt = -wx1*mxt;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
609
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
610 double wy1 = (rasterBand.getTileHeight()*ty - by)/my;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
611 double wy2 = (rasterBand.getTileHeight()*(ty+1) - by)/my;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
612 double myt = (rasterBand.getTileHeight()-1e-5d)/(wy2 - wy1);
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
613 double byt = -wy1*myt;
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
614
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
615 RasterObject ro = new RasterObject(
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
616 mxt, bxt,
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
617 myt, byt,
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
618 tile.getColumnIndex(),
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
619 tile.getRowIndex(),
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
620 tileValues,
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
621 rasterBand.getTileWidth(),
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
622 rasterBand.getTileHeight());
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
623 lBackingRow.addObject(ro, 0);
544
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
624 lSet.addRow(lBackingRow);
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
625
544
33f93898cbbf Added RasterObject for caching the Rastertiles to get a better performance
Tim Englich <tim.englich@intevation.de>
parents: 543
diff changeset
626 }
547
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
627 }
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
628 else{
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
629 log.debug("The Query doesn't deliver any Information " +
23d5cc37dd5b Fixed access to raster data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 546
diff changeset
630 "because the Point is located outside the Raster.");
543
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
631 }
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
632 } catch (Exception e) {
fac02bf1c685 Added Rasterdatasupport to the ARCSDE-Statement
Tim Englich <tim.englich@intevation.de>
parents: 383
diff changeset
633 log.error(e,e);
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
634 }
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
635 }
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
636 pSeQuery.close();
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
637 return lSet;
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
638 }
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
639
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
640 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
641 * @see java.sql.Statement#isClosed()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
642 */
380
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
643 public boolean isClosed() throws SQLException {
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
644 return false;
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
645 }
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
646
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
647 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
648 * @see java.sql.Statement#isPoolable()
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
649 */
380
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
650 public boolean isPoolable() throws SQLException {
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
651 return false;
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
652 }
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
653
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
654 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
655 * @see java.sql.Statement#setPoolable(boolean)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
656 */
380
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
657 public void setPoolable(boolean arg0) throws SQLException {
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
658 }
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
659
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
660 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
661 * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
662 */
380
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
663 public boolean isWrapperFor(Class<?> iface) throws SQLException {
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
664 return false;
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
665 }
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
666
884
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
667 /**
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
668 * @see java.sql.Wrapper#unwrap(java.lang.Class)
12f88239fb33 Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents: 879
diff changeset
669 */
380
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
670 public <T> T unwrap(Class<T> iface) throws SQLException {
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
671 return null;
885
1c3efbd2fc5a Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 884
diff changeset
672
380
0100ebf6630f Added missing Methodstubs for Java 1.6 compability.
Tim Englich <tim.englich@intevation.de>
parents: 377
diff changeset
673 }
130
e4eacd613356 Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
674 }

http://dive4elements.wald.intevation.org