# HG changeset patch # User Tim Englich # Date 1259327388 0 # Node ID 9ed654c21f9b84bac2427ac5b182c4d40470556b # Parent 6a585e87c18b3fd5f8f6cd4706a89b15e3aee182 Changed Splitalgorithm of Statements so that it is Possible to add to_date Colums into a Statement with Spatial-Columns or Spatial-Filters geo-backend/trunk@379 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 6a585e87c18b -r 9ed654c21f9b geo-backend/ChangeLog --- a/geo-backend/ChangeLog Fri Nov 27 12:59:04 2009 +0000 +++ b/geo-backend/ChangeLog Fri Nov 27 13:09:48 2009 +0000 @@ -1,3 +1,12 @@ +2009-11-27 Tim Englich + + * src/test/ressources/QueryExecutorTestCase.properties, + src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java: + Revert Changes of the last. Commit of Revision 377 which was unintended + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java (executeQuery): + Changed Splitalgorithm of Statements so that it is Possible to add to_date Colums into a Statement + with Spatial-Columns or Spatial-Filters + 2009-11-13 Hans Plum RELEASE 0.2 diff -r 6a585e87c18b -r 9ed654c21f9b geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java --- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java Fri Nov 27 12:59:04 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -package de.intevation.gnv.geobackend.base.query; - -import com.esri.sde.sdk.client.SDEPoint; -import com.esri.sde.sdk.client.SeColumnDefinition; -import com.esri.sde.sdk.client.SeConnection; -import com.esri.sde.sdk.client.SeException; -import com.esri.sde.sdk.client.SeFilter; -import com.esri.sde.sdk.client.SeLayer; -import com.esri.sde.sdk.client.SeQuery; -import com.esri.sde.sdk.client.SeQueryInfo; -import com.esri.sde.sdk.client.SeRow; -import com.esri.sde.sdk.client.SeShape; -import com.esri.sde.sdk.client.SeShapeFilter; -import com.esri.sde.sdk.client.SeSqlConstruct; - -public class GroupBySample { - - - public void executeQuery(SeConnection con, String[] pLayername, - String pSpatialColumnName, String pWhere, - SDEPoint[] g, String[] pReturnFields, String byClause) { - - try { - // get the layer for querying - - SeShapeFilter[] filters = null; - if (g != null){ - SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName); - SeShape shape = new SeShape(); - shape.setCoordRef(lLayer.getCoordRef()); - - - - shape.generatePolygon(g.length, 1, null, g); - SeShapeFilter filter = new SeShapeFilter(pLayername[0], - pSpatialColumnName, shape, SeFilter.METHOD_AI); - filters = new SeShapeFilter[1]; - filters[0] = filter; - } - - SeQuery spatialQuery = null; - SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); - spatialQuery = new SeQuery(con); - - SeQueryInfo queryInfo = new SeQueryInfo(); - queryInfo.setColumns(pReturnFields); - - if (byClause != null){ - queryInfo.setByClause(byClause); - } - - queryInfo.setConstruct(sqlCons); - spatialQuery.prepareQueryInfo(queryInfo); - - /* - * Set spatial constraints - */ - if (filters != null){ - spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, - filters); - } - spatialQuery.execute(); - - SeRow row; - int lCount; - for (lCount = 0; (row =spatialQuery.fetch()) != null; lCount++) { - // one time execution - if (lCount == 0) { - // analyze cols of result set - SeColumnDefinition[] lCols = row.getColumns(); - - } - short lNumCols = row.getNumColumns(); - - for (int i = 0; i < lNumCols; i++) { - System.out.println(row.getObject(i)); - } - - } - spatialQuery.close(); - - } catch (Exception e){ - e.printStackTrace(); - } - - } - - - /** - * @param args - */ - public static void main(String[] args) { - - try { - String[] layerNames = new String[] { "median.meshpoint", "median.mesh" }; - String spatialColumnName = "SHAPE"; - String where = "median.meshpoint.meshid = median.mesh.meshid"; - String[] returnFields = new String[] { "sourceid" }; - String byClause = "group by sourceid"; - SDEPoint[] g = new SDEPoint[4]; - g[0] = new SDEPoint(52, 8); - g[1] = new SDEPoint(52, 9); - g[2] = new SDEPoint(53, 9); - g[3] = new SDEPoint(53, 8); - - String server = ""; - String port = ""; - String database = ""; - String username = ""; - String credentials = ""; - SeConnection con = new SeConnection(server, port, - database, username, - credentials); - new GroupBySample().executeQuery(con, layerNames, spatialColumnName, - where, g, returnFields, byClause); - - - } catch (SeException e) { - e.printStackTrace(); - } - } -}