Package com.esri.sde.sdk.client

Examples of com.esri.sde.sdk.client.SeQuery


      // query table containing XML metadata
      SeSqlConstruct sqlConstruct = new SeSqlConstruct();
      String[] tables = {METADATA_TABLE };
      sqlConstruct.setTables(tables);
      String[] propertyNames = { METADATA_COLUMN };     
      SeQuery query = new SeQuery(seConnection);
      query.prepareQuery(propertyNames, sqlConstruct);
      query.execute();
     
      // it is not documented in the ArcSDE API how you know there are no more rows to fetch!
      // I'm assuming: query.fetch returns null (empiric tests indicate this assumption is correct).
      boolean allRowsFetched = false;
      while(! allRowsFetched) {
        SeRow row = query.fetch();
        if(row != null) {
          ByteArrayInputStream bytes = row.getBlob(0);
          byte [] buff = new byte[bytes.available()];
          bytes.read(buff);
          String document = new String(buff, Constants.ENCODING);
          if(document.contains(ISO_METADATA_IDENTIFIER)) {
            System.out.println("ISO metadata found");
            results.add(document);
          }
        }
        else {
          allRowsFetched = true;
        }
      }     
      query.close();
      System.out.println("cool");
      return results;
    }
    catch(SeException x) {
      SeError error = x.getSeError();
View Full Code Here


        final Command<SeColumnDefinition[]> testQueryCmd = new Command<SeColumnDefinition[]>() {
            @Override
            public SeColumnDefinition[] execute(ISession session, SeConnection connection)
                    throws SeException, IOException {
                final SeQuery testQuery = new SeQuery(connection);

                try {
                    testQuery.prepareQueryInfo(queryInfo);
                    testQuery.execute();
                    LOGGER.fine("definition query executed successfully");

                    LOGGER.fine("fetching row to obtain view's types");

                    SeRow testRow = testQuery.fetch();
                    SeColumnDefinition[] colDefs = testRow.getColumns();
                    return colDefs;
                } finally {
                    try {
                        testQuery.close();
                    } catch (SeException e) {
                        throw new ArcSdeException(e);
                    }
                }
            }
View Full Code Here

        session.issue(queryCommand);

        final SeRow row = queryCommand.getSeRow();

        final SeQuery preparedQuery = queryCommand.getPreparedQuery();

        return new QueryObjects(preparedQuery, row);
    }
View Full Code Here

        final int width = 1;
        final int height = 1;
        final GridEnvelope requestTiles = new GridEnvelope2D(tileX, tileY, width, height);

        final QueryObjects singleTileQueryObjects = execute(requestTiles);
        final SeQuery query = singleTileQueryObjects.preparedQuery;
        final SeRow row = singleTileQueryObjects.row;
        final TileFetchCommand command = new TileFetchCommand(row, nativeCellType);
        SeRasterTile[] tileData;

        try {
View Full Code Here

                LOGGER.finer("TileReader disposing " + session + " on Thread "
                        + Thread.currentThread().getName());
            }
            if (queryObjects != null) {
                try {
                    SeQuery preparedQuery = queryObjects.preparedQuery;
                    session.close(preparedQuery);
                } catch (Exception e) {
                    LOGGER.log(Level.WARNING, "Closing tile reader's prepared Query", e);
                }
            }
View Full Code Here

            }
        }

        ISessionPool connectionPool = testData.getConnectionPool();
        ISession session = connectionPool.getSession();
        SeQuery seQuery;
        try {
            int objectId = (int) ArcSDEAdapter.getNumericFid(fid);
            final String whereClause = "ROW_ID=" + objectId;
            seQuery = session.issue(new Command<SeQuery>() {
                @Override
                public SeQuery execute(ISession session, SeConnection connection)
                        throws SeException, IOException {
                    SeQuery seQuery = new SeQuery(connection, new String[] { "ROW_ID", "INT32_COL",
                            "STRING_COL" }, new SeSqlConstruct(typeName, whereClause));
                    seQuery.prepareQuery();
                    seQuery.execute();
                    return seQuery;
                }
            });

            SdeRow row = session.fetch(seQuery);
View Full Code Here

             */
            final String rasterIdFilter = rasterColumn + " = " + rasterId;
            sqlConstruct.setWhere(rasterIdFilter);

            final String[] rasterColumns = { rasterColumn };
            preparedQuery = new SeQuery(connection, rasterColumns, sqlConstruct);
            preparedQuery.prepareQuery();
            preparedQuery.execute();

            this.row = preparedQuery.fetch();
            if (row == null) {
View Full Code Here

                Integer.parseInt(String.valueOf(props.get("port"))), String.valueOf(props
                        .get("instance")), String.valueOf(props.get("user")), String.valueOf(props
                        .get("password")));

        try {
            SeQuery query;
            SeQueryInfo queryInfo;

            queryInfo = new SeQueryInfo();
            queryInfo.setColumns(new String[] { "SHAPE" });
            queryInfo.setConstruct(new SeSqlConstruct(typeName));

            long runTime = 0;
            for (int run = 0; run < numRuns; run++) {
                query = new SeQuery(conn);
                runTime += iterateWithSeShapeFetching(query, queryInfo);
            }
            double avg = runTime / numRuns;
            log("--- Avg iteration time with SeShape fetching for " + numRuns + " runs: "
                    + (avg / 1000D) + "s");
View Full Code Here

                Integer.parseInt(String.valueOf(props.get("port"))), String.valueOf(props
                        .get("instance")), String.valueOf(props.get("user")), String.valueOf(props
                        .get("password")));

        try {
            SeQuery query;
            SeQueryInfo queryInfo;

            queryInfo = new SeQueryInfo();
            queryInfo.setColumns(new String[] { "SHAPE" });
            queryInfo.setConstruct(new SeSqlConstruct(typeName));

            long runTime = 0;
            for (int run = 0; run < numRuns; run++) {
                query = new SeQuery(conn);
                runTime += iterateWithGeometryFactory(query, queryInfo);
            }
            double avg = runTime / numRuns;
            log("--- Avg iteration time with GeometryFactory for " + numRuns + " runs: "
                    + (avg / 1000D) + "s");
View Full Code Here

        if (LOGGER.isLoggable(Level.FINER)) {
            String msg = "ArcSDE query is: " + toString(qInfo);
            LOGGER.finer(msg);
        }

        final SeQuery seQuery;

        seQuery = session.prepareQuery(qInfo, spatialConstraints, versioningHandler);

        return seQuery;
    }
View Full Code Here

TOP

Related Classes of com.esri.sde.sdk.client.SeQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.