Revision 1828 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/DefaultDBDriver.java
DefaultDBDriver.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap.drivers; |
42 | 42 |
|
43 |
import java.awt.geom.Rectangle2D; |
|
44 | 43 |
import java.io.IOException; |
45 | 44 |
import java.sql.Connection; |
46 | 45 |
import java.sql.ResultSet; |
... | ... | |
48 | 47 |
import java.sql.SQLException; |
49 | 48 |
import java.sql.Statement; |
50 | 49 |
import java.sql.Types; |
51 |
import java.util.Date; |
|
52 | 50 |
|
53 |
import org.postgis.Geometry; |
|
54 |
import org.postgis.PGbox3d; |
|
55 |
import org.postgis.Point; |
|
56 |
|
|
57 |
import com.hardcode.gdbms.engine.data.DataSource; |
|
58 |
import com.hardcode.gdbms.engine.data.ReadDriver; |
|
51 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
|
59 | 52 |
import com.hardcode.gdbms.engine.values.Value; |
60 | 53 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
61 | 54 |
import com.iver.cit.gvsig.fmap.DriverException; |
62 | 55 |
import com.iver.cit.gvsig.fmap.core.FShape; |
63 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
64 |
import com.iver.cit.gvsig.fmap.drivers.jdbc.postgis.WKTParser; |
|
65 |
import com.vividsolutions.jts.io.ParseException; |
|
66 | 56 |
|
67 | 57 |
|
68 | 58 |
|
69 | 59 |
/** |
70 | 60 |
* Clase abstracta qu |
71 | 61 |
*/ |
72 |
public abstract class DefaultDBDriver implements VectorialDatabaseDriver, ReadDriver {
|
|
62 |
public abstract class DefaultDBDriver implements VectorialDatabaseDriver, ObjectDriver {
|
|
73 | 63 |
/** |
74 | 64 |
* |
75 | 65 |
*/ |
... | ... | |
143 | 133 |
return FShape.MULTI; |
144 | 134 |
} |
145 | 135 |
|
146 |
public int getFieldType(int idField) throws com.hardcode.gdbms.engine.data.DriverException |
|
136 |
public int getFieldType(int idField) throws com.hardcode.gdbms.engine.data.driver.DriverException
|
|
147 | 137 |
{ |
148 | 138 |
String str = ""; |
149 | 139 |
try { |
... | ... | |
165 | 155 |
if (metaData.getColumnType(i) == Types.DATE) |
166 | 156 |
return Types.DATE; |
167 | 157 |
} catch (SQLException e) { |
168 |
throw new com.hardcode.gdbms.engine.data.DriverException(e); |
|
158 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException(e);
|
|
169 | 159 |
} |
170 |
throw new com.hardcode.gdbms.engine.data.DriverException("Tipo no soportado: " + str); |
|
160 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException("Tipo no soportado: " + str);
|
|
171 | 161 |
} |
172 | 162 |
/** |
173 | 163 |
* Obtiene el valor que se encuentra en la fila y columna indicada |
... | ... | |
183 | 173 |
* @throws DriverException Si se produce un error accediendo al DataSource |
184 | 174 |
*/ |
185 | 175 |
public Value getFieldValue(long rowIndex, int idField) |
186 |
throws com.hardcode.gdbms.engine.data.DriverException |
|
176 |
throws com.hardcode.gdbms.engine.data.driver.DriverException
|
|
187 | 177 |
{ |
188 | 178 |
int i = (int) (rowIndex + 1); |
189 | 179 |
int fieldId = idField+2; |
... | ... | |
204 | 194 |
if (metaData.getColumnType(fieldId) == Types.DATE) |
205 | 195 |
return ValueFactory.createValue(rs.getDate(fieldId)); |
206 | 196 |
} catch (SQLException e) { |
207 |
throw new com.hardcode.gdbms.engine.data.DriverException("Tipo no soportado: columna " + fieldId ); |
|
197 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException("Tipo no soportado: columna " + fieldId );
|
|
208 | 198 |
} |
209 | 199 |
return null; |
210 | 200 |
|
... | ... | |
219 | 209 |
* @throws DriverException Si se produce alg?n error accediendo al |
220 | 210 |
* DataSource |
221 | 211 |
*/ |
222 |
public int getFieldCount() throws com.hardcode.gdbms.engine.data.DriverException |
|
212 |
public int getFieldCount() throws com.hardcode.gdbms.engine.data.driver.DriverException
|
|
223 | 213 |
{ |
224 | 214 |
try { |
225 | 215 |
// Suponemos que el primer campo es el de las geometries, y no lo |
226 | 216 |
// contamos |
227 | 217 |
return rs.getMetaData().getColumnCount()-1; |
228 | 218 |
} catch (SQLException e) { |
229 |
throw new com.hardcode.gdbms.engine.data.DriverException(e); |
|
219 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException(e);
|
|
230 | 220 |
} |
231 | 221 |
|
232 | 222 |
} |
... | ... | |
237 | 227 |
* @param fieldId ?ndice del campo cuyo nombre se quiere obtener |
238 | 228 |
* |
239 | 229 |
* @return |
240 |
* @throws com.hardcode.gdbms.engine.data.DriverException |
|
230 |
* @throws com.hardcode.gdbms.engine.data.driver.DriverException
|
|
241 | 231 |
* |
242 | 232 |
* @throws DriverException Si se produce alg?n error accediendo al |
243 | 233 |
* DataSource |
244 | 234 |
*/ |
245 |
public String getFieldName(int fieldId) throws com.hardcode.gdbms.engine.data.DriverException |
|
235 |
public String getFieldName(int fieldId) throws com.hardcode.gdbms.engine.data.driver.DriverException
|
|
246 | 236 |
{ |
247 | 237 |
try { |
248 | 238 |
return rs.getMetaData().getColumnName(fieldId+2); |
249 | 239 |
} catch (SQLException e) { |
250 |
throw new com.hardcode.gdbms.engine.data.DriverException(e); |
|
240 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException(e);
|
|
251 | 241 |
} |
252 | 242 |
} |
253 | 243 |
|
Also available in: Unified diff