Revision 44058 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/operations/CalculateEnvelopeOfColumnOperation.java

View differences:

CalculateEnvelopeOfColumnOperation.java
10 10
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCSQLException;
11 11
import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper;
12 12
import org.gvsig.fmap.dal.store.jdbc2.JDBCUtils;
13
import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory.TableReference;
13 14
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase;
14 15
import org.gvsig.fmap.geom.Geometry;
15 16
import org.gvsig.fmap.geom.primitive.Envelope;
16 17

  
17 18
public class CalculateEnvelopeOfColumnOperation extends AbstractConnectionOperation {
18 19

  
19
    private final String subquery;
20
    private final String schemaName;
21
    private final String tableName;
20
    private final TableReference table;
22 21
    private final String columnName;
23 22
    private final String baseFilter;
24 23
    private final Envelope limit;
25 24
    private final IProjection crs;
26
    private final String dbName;
27 25

  
28 26
    public CalculateEnvelopeOfColumnOperation(
29 27
            JDBCHelper helper,
30
            String subquery,
31
            String dbName,
32
            String schemaName,
33
            String tableName,
28
            TableReference table,
34 29
            String columnName,
35 30
            String baseFilter,
36 31
            Envelope limit,
37 32
            IProjection crs
38 33
    ) {
39 34
        super(helper);
40
        this.subquery = subquery;
41
        this.dbName = dbName;
42
        this.schemaName = schemaName;
43
        this.tableName = tableName;
35
        this.table = table;
44 36
        this.columnName = columnName;
45 37
        this.baseFilter = baseFilter;
46 38
        this.limit = limit;
......
51 43
    public final Object perform(Connection conn) throws DataException {
52 44
        Envelope env = calculateEnvelopeOfColumn(
53 45
            conn,
54
            subquery,
55
            dbName,
56
            schemaName,
57
            tableName,
46
            table,
58 47
            columnName,
59 48
            baseFilter,
60 49
            limit,
......
65 54

  
66 55
    public Envelope calculateEnvelopeOfColumn(
67 56
            Connection conn,
68
            String subquery,
69
            String dbName,
70
            String schemaName,
71
            String tableName,
57
            TableReference table,
72 58
            String columnName,
73 59
            String baseFilter,
74 60
            Envelope limit,
......
92 78
            )
93 79
        );
94 80

  
95
        if (StringUtils.isEmpty(subquery)) {
96
            sqlbuilder.select().from().table().database(dbName).schema(schemaName).name(tableName);
97
        } else {
98
            sqlbuilder.select().from().subquery(subquery);
99
        }
81
        sqlbuilder.select().from().table()
82
                .database(this.table.getDatabase())
83
                .schema(this.table.getSchema())
84
                .name(this.table.getTable());
85
        sqlbuilder.select().from().subquery(this.table.getSubquery());
100 86

  
101 87
        if (StringUtils.isEmpty(baseFilter)) {
102 88
            if (limit != null) {

Also available in: Unified diff