Revision 46493

View differences:

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/CreateTableOperation.java
118 118
                continue;
119 119
            }
120 120
            if( attr.getType()==DataTypes.GEOMETRY ) {
121
                sqlbuilder.create_table().add_geometry_column(
122
                        attr.getName(),
123
                        attr.getGeomType().getType(),
124
                        attr.getGeomType().getSubType(),
125
                        attr.getSRS(),
126
                        attr.isIndexed(),
127
                        attr.allowNull()
128
                );
121
                sqlbuilder.create_table().add_column(attr);
122
//                sqlbuilder.create_table().add_geometry_column(attr);
123
//                        attr.getName(),
124
//                        attr.getGeomType().getType(),
125
//                        attr.getGeomType().getSubType(),
126
//                        attr.getSRS(),
127
//                        attr.isIndexed(),
128
//                        attr.allowNull()
129
//                );
129 130
            } else {
130 131
                Object defaultValue = attr.getDefaultValue();
131 132
                if( defaultValue instanceof CharSequence ) {
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/SQLBuilder.java
10 10
import org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper.GeometrySupportType;
11 11
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
12 12
import org.gvsig.fmap.geom.Geometry;
13
import org.gvsig.fmap.geom.primitive.Envelope;
13 14

  
14 15
public interface SQLBuilder {
15 16

  
......
83 84
        public void setGeometrySubtype(int geom_subtype);
84 85

  
85 86
        public void setGeometrySRSId(Object geom_srsid);
87

  
88
        public Envelope getTableBBox();
89
        
90
        public void setTableBBox(Envelope bbox);
86 91
    }
87 92

  
88 93
    public interface StatementPart extends Value {
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/SQLBuilderBase.java
50 50
import org.gvsig.fmap.dal.SQLBuilder.UpdateTableStatisticsBuilder;
51 51
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
52 52
import org.gvsig.fmap.geom.Geometry;
53
import org.gvsig.fmap.geom.GeometryUtils;
54
import org.gvsig.fmap.geom.primitive.Envelope;
53 55
import org.gvsig.tools.dataTypes.DataType;
56
import org.gvsig.tools.dynobject.Tags;
54 57
import org.slf4j.Logger;
55 58
import org.slf4j.LoggerFactory;
56 59

  
......
97 100
        private int geom_type;
98 101
        private int geom_subtype;
99 102
        private Object geom_srsdbcode;
103
        private Envelope tablebbox;
100 104
        private boolean _isIndexed;
101 105
        private DataStoreParameters parameters = null;
102 106

  
......
113 117
            this.geom_type = Geometry.TYPES.GEOMETRY;
114 118
            this.geom_subtype = Geometry.SUBTYPES.GEOM2D;
115 119
            this.geom_srsdbcode = null;
120
            this.tablebbox = null;
116 121
            this._isIndexed = false;
117 122
        }
118 123

  
......
129 134
            this.geom_type = Geometry.TYPES.GEOMETRY;
130 135
            this.geom_subtype = Geometry.SUBTYPES.GEOM2D;
131 136
            this.geom_srsdbcode = null;
137
            this.tablebbox = null;
132 138
            this._isIndexed = isIndexed;
133 139
        }
134 140

  
......
145 151
            this.geom_type = geom_type;
146 152
            this.geom_subtype = geom_subtype;
147 153
            this.geom_srsdbcode = srs_id(proj);
154
            this.tablebbox = null;
148 155
            this._isIndexed = isIndexed;
149 156
        }
150 157

  
......
161 168
            this.geom_type = geom_type;
162 169
            this.geom_subtype = geom_subtype;
163 170
            this.geom_srsdbcode = srsdbcode;
171
            this.tablebbox = null;
164 172
            this._isIndexed = isIndexed;
165 173
        }
166 174

  
......
177 185
            if (fad.getType() == org.gvsig.fmap.geom.DataTypes.GEOMETRY) {
178 186
                this.geom_type = fad.getGeomType().getType();
179 187
                this.geom_subtype = fad.getGeomType().getSubType();
180
                this.geom_srsdbcode = fad.getSRS();
188
                this.geom_srsdbcode =  srs_id(fad.getSRS());
189
                this.tablebbox = null;
190
                Tags tags = fad.getTags();
191
                String s = tags.getString("tablebbox", null);
192
                if( StringUtils.isNotBlank(s) ) {
193
                    try {
194
                        Geometry g = GeometryUtils.createFrom(s);
195
                        if( g!=null ) {
196
                            this.tablebbox = g.getEnvelope();
197
                        }
198
                    } catch(Exception ex) {
199
                        LOGGER.warn("Can't parse tablebbox for column '"+s+"'.",ex);
200
                    }
201
                }
181 202
            }
182 203
        }
183 204
    
......
320 341
        public DataStoreParameters getStoreParameters() {
321 342
            return this.parameters;
322 343
        }
344
        
345
        public Envelope getTableBBox() {
346
            return this.tablebbox;
347
        }
348
        
349
        public void setTableBBox(Envelope bbox) {
350
            this.tablebbox = bbox;
351
        }
323 352
    }
324 353

  
325 354
    public class ColumnBase extends AbstractValue implements Column {

Also available in: Unified diff