Revision 11867 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/DefaultDBDriver.java
DefaultDBDriver.java | ||
---|---|---|
113 | 113 |
protected String dbUrl; |
114 | 114 |
protected String className; |
115 | 115 |
protected String catalogName; |
116 |
protected String schema; |
|
116 | 117 |
protected String tableName; |
117 | 118 |
protected String[] fields; |
118 | 119 |
protected String FIDfield; |
... | ... | |
220 | 221 |
{ |
221 | 222 |
IFeatureIterator itGeom = getFeatureIterator("SELECT " + |
222 | 223 |
getGeometryField(getLyrDef().getFieldGeometry()) + ", " + getLyrDef().getFieldID() + " FROM " + |
223 |
getLyrDef().getTableName() + " " + getCompleteWhere()); |
|
224 |
getLyrDef().getComposedTableName() + " " + getCompleteWhere());
|
|
224 | 225 |
IGeometry geom; |
225 | 226 |
int cont = 0; |
226 | 227 |
while (itGeom.hasNext()) |
... | ... | |
425 | 426 |
hashRelate = new Hashtable(); |
426 | 427 |
|
427 | 428 |
|
428 |
String strSQL = "SELECT " + getLyrDef().getFieldID() + " FROM " + getLyrDef().getTableName() |
|
429 |
String strSQL = "SELECT " + getLyrDef().getFieldID() + " FROM " + getLyrDef().getComposedTableName()
|
|
429 | 430 |
+ " " + getCompleteWhere() + " ORDER BY " + getLyrDef().getFieldID(); |
430 | 431 |
Statement s = getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); |
431 | 432 |
ResultSet r = s.executeQuery(strSQL); |
... | ... | |
478 | 479 |
catalogName = xml.getStringProperty("catalog"); |
479 | 480 |
userName =xml.getStringProperty("username"); |
480 | 481 |
driverClass =xml.getStringProperty("driverclass"); |
482 |
if (xml.contains("schema")) |
|
483 |
{ |
|
484 |
schema = xml.getStringProperty("schema"); |
|
485 |
} |
|
481 | 486 |
tableName = xml.getStringProperty("tablename"); |
482 | 487 |
fields = xml.getStringArrayProperty("fields"); |
483 | 488 |
FIDfield = xml.getStringProperty("FID"); |
... | ... | |
510 | 515 |
|
511 | 516 |
DBLayerDefinition lyrDef = new DBLayerDefinition(); |
512 | 517 |
lyrDef.setCatalogName(catalogName); |
518 |
lyrDef.setSchema(schema); |
|
513 | 519 |
lyrDef.setTableName(tableName); |
514 | 520 |
lyrDef.setFieldNames(fields); |
515 | 521 |
lyrDef.setFieldID(FIDfield); |
... | ... | |
598 | 604 |
DBLayerDefinition lyrDef = new DBLayerDefinition(); |
599 | 605 |
if (getLyrDef() == null) { |
600 | 606 |
lyrDef.setCatalogName(catalogName); |
607 |
lyrDef.setSchema(schema); |
|
601 | 608 |
lyrDef.setTableName(tableName); |
602 | 609 |
lyrDef.setFieldNames(fields); |
603 | 610 |
lyrDef.setFieldID(FIDfield); |
... | ... | |
651 | 658 |
Driver drv = DriverManager.getDriver(metadata.getURL()); |
652 | 659 |
// System.out.println(drv.getClass().getName()); |
653 | 660 |
xml.putProperty("driverclass", drv.getClass().getName()); |
654 |
|
|
661 |
xml.putProperty("schema", lyrDef.getSchema()); |
|
655 | 662 |
xml.putProperty("tablename", getTableName()); |
656 | 663 |
xml.putProperty("fields", lyrDef.getFieldNames()); |
657 | 664 |
xml.putProperty("FID", lyrDef.getFieldID()); |
... | ... | |
824 | 831 |
ResultSet rs = dbmd.getTables(catalog, null, null, types); |
825 | 832 |
TreeMap ret = new TreeMap(); |
826 | 833 |
while (rs.next()){ |
827 |
ret.put(rs.getString("TABLE_NAME"), rs.getString("TABLE_NAME")); |
|
834 |
// ret.put(rs.getString("TABLE_NAME"), rs.getString("TABLE_NAME")); |
|
835 |
// As suggested by Jorge Agudo, to allow charging tables from other schemas |
|
836 |
ret.put((rs.getString("TABLE_SCHEM")!=null?(rs.getString("TABLE_SCHEM") + "."): "") + rs.getString("TABLE_NAME"), (rs.getString("TABLE_SCHEM")!=null?(rs.getString("TABLE_SCHEM") + "."): "") + rs.getString("TABLE_NAME")); |
|
837 |
|
|
828 | 838 |
} |
829 | 839 |
rs.close(); |
830 | 840 |
return (String[]) ret.keySet().toArray(new String[0]); |
Also available in: Unified diff