Revision 17693 trunk/extensions/extOracleSpatial/src/es/prodevelop/cit/gvsig/fmap/drivers/jdbc/oracle/OracleSpatialDriver.java
OracleSpatialDriver.java | ||
---|---|---|
311 | 311 |
setUpperCase(lyrDef); |
312 | 312 |
lyrDef.setConnection(conn); |
313 | 313 |
|
314 |
String geo_can[]; |
|
315 |
try { |
|
316 |
geo_can = getGeometryFieldsCandidates(conn, lyrDef.getTableName()); |
|
317 |
removeStructFields(lyrDef, geo_can); |
|
318 |
} catch (DBException e) { |
|
319 |
logger.error("While removing STRUCT fields: " + e.getMessage()); |
|
320 |
} |
|
321 |
|
|
314 | 322 |
setLyrDef(lyrDef); |
315 | 323 |
|
316 | 324 |
geoColName = lyrDef.getFieldGeometry(); |
... | ... | |
356 | 364 |
idLoader.start(); |
357 | 365 |
} |
358 | 366 |
|
367 |
private void removeStructFields(DBLayerDefinition def, String[] arr) { |
|
368 |
|
|
369 |
FieldDescription[] flds = def.getFieldsDesc(); |
|
370 |
ArrayList aux = new ArrayList(); |
|
371 |
|
|
372 |
for (int i=0; i<flds.length; i++) { |
|
373 |
if (!isOneOfThese(flds[i].getFieldName(), arr)) { |
|
374 |
aux.add(flds[i]); |
|
375 |
} |
|
376 |
} |
|
377 |
|
|
378 |
FieldDescription[] flds_new = |
|
379 |
(FieldDescription[]) aux.toArray(new FieldDescription[0]); |
|
380 |
def.setFieldsDesc(flds_new); |
|
381 |
} |
|
382 |
|
|
383 |
private boolean isOneOfThese(String name, String[] arr) { |
|
384 |
|
|
385 |
for (int i=0; i<arr.length; i++) { |
|
386 |
if (arr[i].compareToIgnoreCase(name) == 0) return true; |
|
387 |
} |
|
388 |
return false; |
|
389 |
} |
|
390 |
|
|
359 | 391 |
private void setUpperCase(DBLayerDefinition def) { |
360 | 392 |
|
361 | 393 |
String aux = def.getCatalogName(); |
... | ... | |
549 | 581 |
{ |
550 | 582 |
qry = "select * from " + ORACLE_GEOMETADATA_VIEW + |
551 | 583 |
" where OWNER = '" + tokens[0] + "' AND TABLE_NAME = '" + |
552 |
tokens[1] + "'"; |
|
584 |
tokens[1] + "' AND COLUMN_NAME = '" + geoColName + "'";
|
|
553 | 585 |
} |
554 | 586 |
else |
555 | 587 |
{ |
556 | 588 |
qry = "select * from " + ORACLE_GEOMETADATA_VIEW + |
557 |
" where TABLE_NAME = " + "'" + getTableName() + "'"; |
|
589 |
" where TABLE_NAME = " + "'" + getTableName() |
|
590 |
+ "' AND COLUMN_NAME = '" |
|
591 |
+ geoColName + "'"; |
|
558 | 592 |
|
559 | 593 |
} |
560 | 594 |
|
... | ... | |
4749 | 4783 |
|
4750 | 4784 |
return res; |
4751 | 4785 |
} |
4786 |
|
|
4787 |
public boolean canWriteGeometry(int gvSIGgeometryType) { |
|
4788 |
if (writer == null) { |
|
4789 |
return true; |
|
4790 |
} else { |
|
4791 |
return writer.canWriteGeometry(gvSIGgeometryType); |
|
4792 |
} |
|
4793 |
|
|
4794 |
} |
|
4795 |
|
|
4752 | 4796 |
|
4753 | 4797 |
|
4754 | 4798 |
} |
Also available in: Unified diff