Package com.esri.sde.sdk.client

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


                        queryColumns = cols.toArray(new String[cols.size()]);
                    }

                    // fullConstruct may hold information about multiple tables in case of an
                    // in-process view
                    final SeSqlConstruct fullConstruct = filters.getQueryInfo(queryColumns)
                            .getConstruct();
                    String whereClause = fullConstruct.getWhere();
                    if (whereClause == null) {
                        /*
                         * we really need a where clause or will get a famous -51 DATABASE LEVEL
                         * ERROR with no other explanation on some oracle databases
                         */
                        whereClause = "1 = 1";
                    }
                    final SeFilter[] spatialConstraints = filters.getSpatialFilters();

                    SeExtent extent;

                    final SeQuery extentQuery = new SeQuery(connection);
                    try {
                        versioningHandler.setUpStream(session, extentQuery);

                        if (spatialConstraints.length > 0) {
                            extentQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false,
                                    spatialConstraints);
                        }

                        SeSqlConstruct sqlCons = new SeSqlConstruct();
                        sqlCons.setTables(fullConstruct.getTables());
                        sqlCons.setWhere(whereClause);

                        final SeQueryInfo seQueryInfo = new SeQueryInfo();
                        seQueryInfo.setColumns(queryColumns);
                        seQueryInfo.setConstruct(sqlCons);

                        extent = extentQuery.calculateLayerExtent(seQueryInfo);
                    } finally {
                        extentQuery.close();
                    }

                    return extent;
                }
            });
        } catch (IOException ex) {
            SeSqlConstruct sqlCons = this.filters.getSeSqlConstruct();
            String sql = (sqlCons == null) ? null : sqlCons.getWhere();
            String tables = (sqlCons == null) ? null : Arrays.asList(sqlCons.getTables())
                    .toString();
            if (ex.getCause() instanceof SeException) {
                SeException sdeEx = (SeException) ex.getCause();
                if (sdeEx.getSeError().getSdeError() == -288) {
                    // gah, the dreaded 'LOGFILE SYSTEM TABLES DO NOT EXIST'
View Full Code Here


        public SeQueryInfo getQueryInfo(final String[] unqualifiedPropertyNames) throws IOException {
            assert unqualifiedPropertyNames != null;
            String[] tables;
            String byClause = null;

            final SeSqlConstruct plainSqlConstruct = getSeSqlConstruct();

            String where = plainSqlConstruct.getWhere();

            try {
                if (definitionQuery == null) {
                    tables = new String[] { this.sdeTable.getQualifiedName() };
                } else {
                    tables = definitionQuery.getConstruct().getTables();
                    String joinWhere = definitionQuery.getConstruct().getWhere();
                    if (where == null) {
                        where = joinWhere;
                    } else {
                        where = joinWhere == null ? where : (joinWhere + " AND " + where);
                    }
                    try {
                        byClause = definitionQuery.getByClause();
                    } catch (NullPointerException e) {
                        // no-op
                    }
                }

                final SeQueryInfo qInfo = new SeQueryInfo();
                final SeSqlConstruct sqlConstruct = new SeSqlConstruct();
                sqlConstruct.setTables(tables);
                if (where != null && where.length() > 0) {
                    sqlConstruct.setWhere(where);
                }

                final int queriedAttCount = unqualifiedPropertyNames.length;

                if (queriedAttCount > 0) {
View Full Code Here

         *             the SeSqlConstruct for the given layer and where clause.
         */
        public SeSqlConstruct getSeSqlConstruct() throws DataSourceException {
            if (this.sdeSqlConstruct == null) {
                final String layerName = this.sdeTable.getQualifiedName();
                this.sdeSqlConstruct = new SeSqlConstruct(layerName);

                Filter sqlFilter = getSqlFilter();

                if (!Filter.INCLUDE.equals(sqlFilter)) {
                    String whereClause = null;
View Full Code Here

        // build SeQueryInfo
        SeQueryInfo qinfo = new SeQueryInfo();
        qinfo.setColumns(columns);

        SeSqlConstruct sqlConstruct = new SeSqlConstruct();
        sqlConstruct.setTables(tables);
        if (where != null) {
            sqlConstruct.setWhere(where);
        }

        qinfo.setConstruct(sqlConstruct);

        if (orderAndOrGroupByClause != null) {
View Full Code Here

        LOGGER.fine("Gathering raster attributes for " + rasterTable);
        SeRasterAttr rasterAttributes;
        LinkedList<SeRasterAttr> rasterAttList = new LinkedList<SeRasterAttr>();
        SeQuery query = null;
        try {
            query = new SeQuery(scon, rasterColumns, new SeSqlConstruct(rasterTable));
            query.prepareQuery();
            query.execute();

            SeRow row = query.fetch();
            while (row != null) {
View Full Code Here

        LOGGER.fine("Quering auxiliary table " + auxTableName + " for color map data");

        Map<Long, IndexColorModel> colorMaps = new HashMap<Long, IndexColorModel>();
        SeQuery query = null;
        try {
            SeSqlConstruct sqlConstruct = new SeSqlConstruct();
            sqlConstruct.setTables(new String[] { auxTableName });
            String whereClause = "TYPE = 3";
            sqlConstruct.setWhere(whereClause);

            query = new SeQuery(scon, new String[] { "RASTERBAND_ID", "OBJECT" }, sqlConstruct);
            query.prepareQuery();
            query.execute();
View Full Code Here

        SeQuery query = null;
        try {
            final String dbaName = scon.getSdeDbaName();
            String rastersColumnsTable = dbaName + ".SDE_RASTER_COLUMNS";

            SeSqlConstruct sqlCons = new SeSqlConstruct(rastersColumnsTable);
            sqlCons.setWhere("RASTERCOLUMN_ID = " + rasterColumnId);

            try {
                query = new SeQuery(scon, new String[] { "OWNER" }, sqlCons);
                query.prepareQuery();
            } catch (SeException e) {
                // sde 9.3 calls it raster_columns, not sde_raster_columns...
                rastersColumnsTable = dbaName + ".RASTER_COLUMNS";
                sqlCons = new SeSqlConstruct(rastersColumnsTable);
                sqlCons.setWhere("RASTERCOLUMN_ID = " + rasterColumnId);
                query = new SeQuery(scon, new String[] { "OWNER" }, sqlCons);
                query.prepareQuery();
            }
            query.execute();
View Full Code Here

    }

    @Test
    public void testNullSQLConstruct() throws Exception {
        String[] columns = { TestData.TEST_TABLE_COLS[0] };
        SeSqlConstruct sql = null;

        try {
            session.createAndExecuteQuery(columns, sql);
            fail("A null SeSqlConstruct should have thrown an exception!");
        } catch (IOException e) {
View Full Code Here

    @Test
    public void testEmptySQLConstruct() throws Exception {
        String typeName = testData.getTempTableName();
        String[] columns = { TestData.TEST_TABLE_COLS[0] };
        SeSqlConstruct sql = new SeSqlConstruct(typeName);

        SeQuery rowQuery = null;
        try {
            rowQuery = session.createAndExecuteQuery(columns, sql);
        } finally {
View Full Code Here

    @Test
    public void testGetBoundsWhileFetchingRows() throws Exception {
        final String typeName = testData.getTempTableName();
        final String[] columns = { TestData.TEST_TABLE_COLS[0] };
        final SeSqlConstruct sql = new SeSqlConstruct(typeName);

        final SeQueryInfo qInfo = new SeQueryInfo();
        qInfo.setConstruct(sql);

        // add a bounding box filter and verify both spatial and non spatial
View Full Code Here

TOP

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

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.