Revision 11867
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/DBLayerDefinition.java | ||
---|---|---|
45 | 45 |
|
46 | 46 |
import java.awt.geom.Rectangle2D; |
47 | 47 |
import java.sql.Connection; |
48 |
import java.sql.Types; |
|
49 | 48 |
|
50 |
import com.hardcode.gdbms.engine.instruction.Field; |
|
51 |
|
|
52 | 49 |
public class DBLayerDefinition extends LayerDefinition { |
53 | 50 |
private Connection conn; |
54 | 51 |
private String catalogName; |
52 |
private String schema; |
|
55 | 53 |
private String tableName; |
56 | 54 |
// private String[] fieldNames; // GeometryField not included |
57 | 55 |
private String fieldID; // Estos 2 campos en PostGIS los sabremos |
... | ... | |
130 | 128 |
fieldsDesc[i].setFieldName(fieldNames[i]); |
131 | 129 |
} |
132 | 130 |
} |
131 |
/** |
|
132 |
* @deprecated Better use getCompoundTableName to deal with schemas. |
|
133 |
* This method should be used only by drivers when it is necessary to distinguish between table and schema. |
|
134 |
* @return |
|
135 |
*/ |
|
133 | 136 |
public String getTableName() { |
134 |
return tableName;
|
|
137 |
return tableName;
|
|
135 | 138 |
} |
136 | 139 |
public void setTableName(String tableName) { |
137 | 140 |
this.tableName = tableName; |
... | ... | |
232 | 235 |
public void setDimension(int dim) { |
233 | 236 |
dimension = dim; |
234 | 237 |
} |
238 |
public void setSchema(String schema) { |
|
239 |
this.schema = schema; |
|
240 |
} |
|
241 |
public String getSchema() { |
|
242 |
return schema; |
|
243 |
} |
|
244 |
/** |
|
245 |
* @return schema.tableName or only tableName if schema is not defined |
|
246 |
*/ |
|
247 |
public String getComposedTableName() { |
|
248 |
String compoundTable = getSchema()!=null?(getSchema() + "." + getTableName()):getTableName(); |
|
249 |
return compoundTable; |
|
250 |
} |
|
235 | 251 |
|
236 | 252 |
} |
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/jdbc/utils/ConnectionWithParams.java | ||
---|---|---|
29 | 29 |
private String host; |
30 | 30 |
private String port; |
31 | 31 |
private String db; |
32 |
private String schema; |
|
32 | 33 |
|
33 | 34 |
private boolean isNull = false; |
34 | 35 |
|
... | ... | |
215 | 216 |
return isNull; |
216 | 217 |
} |
217 | 218 |
|
219 |
public String getSchema() { |
|
220 |
return schema; |
|
221 |
} |
|
222 |
|
|
223 |
public void setSchema(String schema) { |
|
224 |
this.schema = schema; |
|
225 |
} |
|
226 |
|
|
218 | 227 |
} |
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/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]); |
branches/v10/extensions/extCAD/src/com/iver/cit/gvsig/ExportTo.java | ||
---|---|---|
298 | 298 |
.getConnectionString(), cs.getUser(), cs.getPassw()); |
299 | 299 |
|
300 | 300 |
DBLayerDefinition dbLayerDef = new DBLayerDefinition(); |
301 |
dbLayerDef.setCatalogName(cs.getDb()); |
|
301 |
// Fjp: |
|
302 |
// Cambio: En Postgis, el nombre de cat?logo est? siempre vac?o. Es algo heredado de Oracle, que no se usa. |
|
303 |
// dbLayerDef.setCatalogName(cs.getDb()); |
|
304 |
dbLayerDef.setCatalogName(""); |
|
305 |
|
|
306 |
// A?adimos el schema dentro del layer definition para poder tenerlo en cuenta. |
|
307 |
dbLayerDef.setSchema(cs.getSchema()); |
|
308 |
|
|
302 | 309 |
dbLayerDef.setTableName(tableName); |
303 | 310 |
dbLayerDef.setName(tableName); |
304 | 311 |
dbLayerDef.setShapeType(layer.getShapeType()); |
branches/v10/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/MyFinishAction.java | ||
---|---|---|
178 | 178 |
|
179 | 179 |
DBLayerDefinition dbLayerDef = new DBLayerDefinition(); |
180 | 180 |
dbLayerDef.setCatalogName(cs.getDb()); |
181 |
dbLayerDef.setSchema(cs.getSchema()); |
|
181 | 182 |
dbLayerDef.setTableName(layerName); |
182 | 183 |
dbLayerDef.setShapeType(geometryType); |
183 | 184 |
dbLayerDef.setFieldsDesc(fieldsDesc); |
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/jdbc_spatial/gui/jdbcwizard/ConnectionPanel.java | ||
---|---|---|
22 | 22 |
import com.iver.utiles.swing.JComboBox; |
23 | 23 |
import com.iver.utiles.swing.wizard.Step; |
24 | 24 |
import com.iver.utiles.swing.wizard.WizardControl; |
25 |
import java.awt.Rectangle; |
|
26 |
import java.awt.Dimension; |
|
27 |
import javax.swing.SwingConstants; |
|
28 |
import java.lang.String; |
|
25 | 29 |
|
26 | 30 |
|
27 | 31 |
/** |
... | ... | |
52 | 56 |
|
53 | 57 |
private JPanel jPanel = null; |
54 | 58 |
|
59 |
private JLabel jLabelSchema = null; |
|
55 | 60 |
|
61 |
private ConnectionPanel XYZ = null; |
|
56 | 62 |
|
63 |
private JPanel jPanel1 = null; |
|
64 |
|
|
65 |
private JPanel jPanelLabels1 = null; |
|
66 |
|
|
67 |
private JLabel jLabel61 = null; |
|
68 |
|
|
69 |
private JLabel jLabel7 = null; |
|
70 |
|
|
71 |
private JLabel jLabel11 = null; |
|
72 |
|
|
73 |
private JLabel jLabel21 = null; |
|
74 |
|
|
75 |
private JLabel jLabel31 = null; |
|
76 |
|
|
77 |
private JLabel jLabel51 = null; |
|
78 |
|
|
79 |
private JPanel jPanelTexts1 = null; |
|
80 |
|
|
81 |
private JComboBox cmbName1 = null; |
|
82 |
|
|
83 |
private JTextField txtHost1 = null; |
|
84 |
|
|
85 |
private JTextField txtPort1 = null; |
|
86 |
|
|
87 |
private JTextField txtUser1 = null; |
|
88 |
|
|
89 |
private JPasswordField txtPassword1 = null; |
|
90 |
|
|
91 |
private JTextField txtBD1 = null; |
|
92 |
|
|
93 |
private JComboBox cmbDriver1 = null; |
|
94 |
|
|
95 |
private JTextField txtSchema = null; |
|
96 |
|
|
97 |
|
|
98 |
|
|
57 | 99 |
/** |
58 | 100 |
* This is the default constructor |
59 | 101 |
*/ |
... | ... | |
82 | 124 |
*/ |
83 | 125 |
private JPanel getJPanelLabels() { |
84 | 126 |
if (jPanelLabels == null) { |
127 |
String string = PluginServices.getText(getXYZ(), "schema") + ":"; |
|
128 |
jLabelSchema = new JLabel(); |
|
129 |
jLabelSchema.setName("jLabel4"); |
|
130 |
jLabelSchema.setHorizontalAlignment(SwingConstants.RIGHT); |
|
131 |
jLabelSchema.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
132 |
jLabelSchema.setText(string); |
|
133 |
jLabelSchema.setPreferredSize(new Dimension(140, 19)); |
|
85 | 134 |
FlowLayout flowLayout3 = new FlowLayout(); |
86 | 135 |
flowLayout3.setVgap(15); |
87 | 136 |
jLabel5 = new JLabel(); |
... | ... | |
128 | 177 |
jPanelLabels.add(jLabel2, null); |
129 | 178 |
jPanelLabels.add(jLabel3, null); |
130 | 179 |
jPanelLabels.add(jLabel4, null); |
180 |
jPanelLabels.add(jLabelSchema, null); |
|
131 | 181 |
jPanelLabels.add(jLabel5, null); |
132 | 182 |
|
133 | 183 |
} |
... | ... | |
161 | 211 |
flowLayout2.setVgap(15); |
162 | 212 |
jPanelTexts = new JPanel(); |
163 | 213 |
jPanelTexts.setLayout(flowLayout2); |
164 |
jPanelTexts.setPreferredSize(new java.awt.Dimension(200,400));
|
|
214 |
jPanelTexts.setPreferredSize(new Dimension(200, 300));
|
|
165 | 215 |
|
166 | 216 |
jPanelTexts.setName("jPanelText"); |
167 | 217 |
jPanelTexts.add(getCmbName(), null); |
... | ... | |
170 | 220 |
jPanelTexts.add(getTxtUser(), null); |
171 | 221 |
jPanelTexts.add(getTxtPassword(), null); |
172 | 222 |
jPanelTexts.add(getTxtBD(), null); |
223 |
jPanelTexts.add(getTxtSchema(), null); |
|
173 | 224 |
jPanelTexts.add(getCmbDriver(), null); |
174 | 225 |
} |
175 | 226 |
|
... | ... | |
321 | 372 |
{ |
322 | 373 |
ConnectionSettings cs = new ConnectionSettings(); |
323 | 374 |
cs.setDb(getDBName()); |
375 |
cs.setSchema(getSchema()); |
|
324 | 376 |
cs.setDriver(getDriver()); |
325 | 377 |
cs.setHost(getHost()); |
326 | 378 |
cs.setPort(getPort()); |
... | ... | |
329 | 381 |
cs.setName(getSettingsName()); |
330 | 382 |
return cs; |
331 | 383 |
} |
384 |
|
|
385 |
public String getSchema() { |
|
386 |
return txtSchema.getText(); |
|
387 |
} |
|
332 | 388 |
|
333 | 389 |
/** |
334 | 390 |
* Makes persistent the connection settings of this panel. |
... | ... | |
337 | 393 |
{ |
338 | 394 |
ConnectionSettings cs = new ConnectionSettings(); |
339 | 395 |
cs.setDb(getDBName()); |
396 |
cs.setSchema(getSchema()); |
|
340 | 397 |
cs.setDriver(getDriver()); |
341 | 398 |
cs.setHost(getHost()); |
342 | 399 |
cs.setPort(getPort()); |
... | ... | |
493 | 550 |
if (jPanel == null) { |
494 | 551 |
jPanel = new JPanel(); |
495 | 552 |
jPanel.setLayout(new BorderLayout()); |
496 |
jPanel.setBounds(0, 0, 400, 240);
|
|
553 |
jPanel.setBounds(0, 0, 363, 240);
|
|
497 | 554 |
jPanel.add(getJPanelLabels(), java.awt.BorderLayout.WEST); |
498 | 555 |
jPanel.add(getJPanelTexts(), java.awt.BorderLayout.EAST); |
499 | 556 |
} |
500 | 557 |
return jPanel; |
501 | 558 |
} |
559 |
|
|
560 |
/** |
|
561 |
* This method initializes XYZ |
|
562 |
* |
|
563 |
* @return com.iver.cit.gvsig.jdbc_spatial.gui.jdbcwizard.ConnectionPanel |
|
564 |
*/ |
|
565 |
private ConnectionPanel getXYZ() { |
|
566 |
if (XYZ == null) { |
|
567 |
XYZ = new ConnectionPanel(); |
|
568 |
XYZ.setLayout(null); |
|
569 |
XYZ.setSize(new java.awt.Dimension(335,240)); |
|
570 |
XYZ.add(getJPanel1(), null); |
|
571 |
} |
|
572 |
return XYZ; |
|
573 |
} |
|
574 |
|
|
575 |
/** |
|
576 |
* This method initializes jPanel1 |
|
577 |
* |
|
578 |
* @return javax.swing.JPanel |
|
579 |
*/ |
|
580 |
private JPanel getJPanel1() { |
|
581 |
if (jPanel1 == null) { |
|
582 |
jPanel1 = new JPanel(); |
|
583 |
jPanel1.setLayout(new BorderLayout()); |
|
584 |
jPanel1.setBounds(new Rectangle(0, 0, 363, 240)); |
|
585 |
jPanel1.add(getJPanelLabels1(), java.awt.BorderLayout.WEST); |
|
586 |
jPanel1.add(getJPanelTexts1(), java.awt.BorderLayout.EAST); |
|
587 |
} |
|
588 |
return jPanel1; |
|
589 |
} |
|
590 |
|
|
591 |
/** |
|
592 |
* This method initializes jPanelLabels1 |
|
593 |
* |
|
594 |
* @return javax.swing.JPanel |
|
595 |
*/ |
|
596 |
private JPanel getJPanelLabels1() { |
|
597 |
if (jPanelLabels1 == null) { |
|
598 |
jLabel51 = new JLabel(); |
|
599 |
jLabel51.setName("jLabel5"); |
|
600 |
jLabel51.setHorizontalAlignment(SwingConstants.RIGHT); |
|
601 |
jLabel51.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
602 |
jLabel51.setText(PluginServices.getText(getXYZ(), "driver") + ":"); |
|
603 |
jLabel51.setPreferredSize(new Dimension(140, 19)); |
|
604 |
jLabel31 = new JLabel(); |
|
605 |
jLabel31.setName("jLabel3"); |
|
606 |
jLabel31.setHorizontalAlignment(SwingConstants.RIGHT); |
|
607 |
jLabel31.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
608 |
jLabel31.setText(PluginServices.getText(getXYZ(), "password") + ":"); |
|
609 |
jLabel31.setPreferredSize(new Dimension(140, 19)); |
|
610 |
jLabel21 = new JLabel(); |
|
611 |
jLabel21.setName("jLabel2"); |
|
612 |
jLabel21.setHorizontalAlignment(SwingConstants.RIGHT); |
|
613 |
jLabel21.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
614 |
jLabel21.setText(PluginServices.getText(getXYZ(), "usuario") + ":"); |
|
615 |
jLabel21.setPreferredSize(new Dimension(140, 19)); |
|
616 |
jLabel11 = new JLabel(); |
|
617 |
jLabel11.setName("jLabel1"); |
|
618 |
jLabel11.setHorizontalAlignment(SwingConstants.TRAILING); |
|
619 |
jLabel11.setText(PluginServices.getText(getXYZ(), "puerto") + ":"); |
|
620 |
jLabel11.setPreferredSize(new Dimension(140, 19)); |
|
621 |
jLabel7 = new JLabel(); |
|
622 |
jLabel7.setName("jLabel"); |
|
623 |
jLabel7.setHorizontalAlignment(SwingConstants.RIGHT); |
|
624 |
jLabel7.setText(PluginServices.getText(getXYZ(), "host") + ":"); |
|
625 |
jLabel7.setPreferredSize(new Dimension(140, 19)); |
|
626 |
jLabel61 = new JLabel(); |
|
627 |
jLabel61.setPreferredSize(new Dimension(140, 19)); |
|
628 |
jLabel61.setText(PluginServices.getText(getXYZ(), "connection_name") + ":"); |
|
629 |
jLabel61.setHorizontalAlignment(SwingConstants.RIGHT); |
|
630 |
FlowLayout flowLayout31 = new FlowLayout(); |
|
631 |
flowLayout31.setVgap(15); |
|
632 |
jPanelLabels1 = new JPanel(); |
|
633 |
jPanelLabels1.setPreferredSize(new Dimension(150, 400)); |
|
634 |
jPanelLabels1.setLayout(flowLayout31); |
|
635 |
jPanelLabels1.setName("jPanelLabels"); |
|
636 |
jPanelLabels1.add(jLabel61, null); |
|
637 |
jPanelLabels1.add(jLabel7, null); |
|
638 |
jPanelLabels1.add(jLabel11, null); |
|
639 |
jPanelLabels1.add(jLabel21, null); |
|
640 |
jPanelLabels1.add(jLabel31, null); |
|
641 |
jPanelLabels1.add(jLabelSchema, jLabelSchema.getName()); |
|
642 |
jPanelLabels1.add(jLabel51, null); |
|
643 |
} |
|
644 |
return jPanelLabels1; |
|
645 |
} |
|
646 |
|
|
647 |
/** |
|
648 |
* This method initializes jPanelTexts1 |
|
649 |
* |
|
650 |
* @return javax.swing.JPanel |
|
651 |
*/ |
|
652 |
private JPanel getJPanelTexts1() { |
|
653 |
if (jPanelTexts1 == null) { |
|
654 |
FlowLayout flowLayout21 = new FlowLayout(FlowLayout.LEFT); |
|
655 |
flowLayout21.setVgap(15); |
|
656 |
jPanelTexts1 = new JPanel(); |
|
657 |
jPanelTexts1.setPreferredSize(new Dimension(200, 300)); |
|
658 |
jPanelTexts1.setLayout(flowLayout21); |
|
659 |
jPanelTexts1.setName("jPanelText"); |
|
660 |
jPanelTexts1.add(getCmbName1(), null); |
|
661 |
jPanelTexts1.add(getTxtHost1(), null); |
|
662 |
jPanelTexts1.add(getTxtPort1(), null); |
|
663 |
jPanelTexts1.add(getTxtUser1(), null); |
|
664 |
jPanelTexts1.add(getTxtPassword1(), null); |
|
665 |
jPanelTexts1.add(getTxtBD1(), null); |
|
666 |
jPanelTexts1.add(getCmbDriver1(), null); |
|
667 |
} |
|
668 |
return jPanelTexts1; |
|
669 |
} |
|
670 |
|
|
671 |
/** |
|
672 |
* This method initializes cmbName1 |
|
673 |
* |
|
674 |
* @return com.iver.utiles.swing.JComboBox |
|
675 |
*/ |
|
676 |
private JComboBox getCmbName1() { |
|
677 |
if (cmbName1 == null) { |
|
678 |
cmbName1 = new JComboBox(); |
|
679 |
cmbName1.setPreferredSize(new Dimension(170, 19)); |
|
680 |
cmbName1.setModel(new DefaultComboBoxModel()); |
|
681 |
cmbName1.setEditable(true); |
|
682 |
} |
|
683 |
return cmbName1; |
|
684 |
} |
|
685 |
|
|
686 |
/** |
|
687 |
* This method initializes txtHost1 |
|
688 |
* |
|
689 |
* @return javax.swing.JTextField |
|
690 |
*/ |
|
691 |
private JTextField getTxtHost1() { |
|
692 |
if (txtHost1 == null) { |
|
693 |
txtHost1 = new JTextField(); |
|
694 |
txtHost1.setName("txtHost"); |
|
695 |
txtHost1.setPreferredSize(new Dimension(170, 19)); |
|
696 |
} |
|
697 |
return txtHost1; |
|
698 |
} |
|
699 |
|
|
700 |
/** |
|
701 |
* This method initializes txtPort1 |
|
702 |
* |
|
703 |
* @return javax.swing.JTextField |
|
704 |
*/ |
|
705 |
private JTextField getTxtPort1() { |
|
706 |
if (txtPort1 == null) { |
|
707 |
txtPort1 = new JTextField(); |
|
708 |
txtPort1.setName("txtPort"); |
|
709 |
txtPort1.setText("3306"); |
|
710 |
txtPort1.setHorizontalAlignment(JTextField.LEFT); |
|
711 |
txtPort1.setPreferredSize(new Dimension(40, 19)); |
|
712 |
} |
|
713 |
return txtPort1; |
|
714 |
} |
|
715 |
|
|
716 |
/** |
|
717 |
* This method initializes txtUser1 |
|
718 |
* |
|
719 |
* @return javax.swing.JTextField |
|
720 |
*/ |
|
721 |
private JTextField getTxtUser1() { |
|
722 |
if (txtUser1 == null) { |
|
723 |
txtUser1 = new JTextField(); |
|
724 |
txtUser1.setName("txtUser"); |
|
725 |
txtUser1.setPreferredSize(new Dimension(170, 19)); |
|
726 |
} |
|
727 |
return txtUser1; |
|
728 |
} |
|
729 |
|
|
730 |
/** |
|
731 |
* This method initializes txtPassword1 |
|
732 |
* |
|
733 |
* @return javax.swing.JPasswordField |
|
734 |
*/ |
|
735 |
private JPasswordField getTxtPassword1() { |
|
736 |
if (txtPassword1 == null) { |
|
737 |
txtPassword1 = new JPasswordField(); |
|
738 |
txtPassword1.setName("txtPassword"); |
|
739 |
txtPassword1.setPreferredSize(new Dimension(170, 19)); |
|
740 |
} |
|
741 |
return txtPassword1; |
|
742 |
} |
|
743 |
|
|
744 |
/** |
|
745 |
* This method initializes txtBD1 |
|
746 |
* |
|
747 |
* @return javax.swing.JTextField |
|
748 |
*/ |
|
749 |
private JTextField getTxtBD1() { |
|
750 |
if (txtBD1 == null) { |
|
751 |
txtBD1 = new JTextField(); |
|
752 |
txtBD1.setName("txtBD"); |
|
753 |
txtBD1.setPreferredSize(new Dimension(170, 19)); |
|
754 |
} |
|
755 |
return txtBD1; |
|
756 |
} |
|
757 |
|
|
758 |
/** |
|
759 |
* This method initializes cmbDriver1 |
|
760 |
* |
|
761 |
* @return com.iver.utiles.swing.JComboBox |
|
762 |
*/ |
|
763 |
private JComboBox getCmbDriver1() { |
|
764 |
if (cmbDriver1 == null) { |
|
765 |
cmbDriver1 = new JComboBox(); |
|
766 |
cmbDriver1.setName("cmbDriver"); |
|
767 |
cmbDriver1.setPreferredSize(new Dimension(170, 19)); |
|
768 |
} |
|
769 |
return cmbDriver1; |
|
770 |
} |
|
771 |
|
|
772 |
/** |
|
773 |
* This method initializes txtSchema |
|
774 |
* |
|
775 |
* @return javax.swing.JTextField |
|
776 |
*/ |
|
777 |
private JTextField getTxtSchema() { |
|
778 |
if (txtSchema == null) { |
|
779 |
txtSchema = new JTextField(); |
|
780 |
txtSchema.setName("txtBD"); |
|
781 |
txtSchema.setPreferredSize(new Dimension(170, 19)); |
|
782 |
} |
|
783 |
return txtSchema; |
|
784 |
} |
|
502 | 785 |
} // @jve:decl-index=0:visual-constraint="7,3" |
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/jdbc_spatial/gui/jdbcwizard/ConnectionSettings.java | ||
---|---|---|
12 | 12 |
private String host; |
13 | 13 |
private String port; |
14 | 14 |
private String db; |
15 |
private String schema; |
|
15 | 16 |
private String driver; |
16 | 17 |
private String user; |
17 | 18 |
private String name; |
... | ... | |
86 | 87 |
|
87 | 88 |
return connectionString; |
88 | 89 |
} |
90 |
public String getSchema() { |
|
91 |
return schema; |
|
92 |
} |
|
93 |
public void setSchema(String schema) { |
|
94 |
this.schema = schema; |
|
95 |
} |
|
89 | 96 |
} |
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/jdbc_spatial/gui/jdbcwizard/WizardJDBC.java | ||
---|---|---|
257 | 257 |
ResultSet rs = dbmd.getTables(catalog, null, null, types); |
258 | 258 |
TreeMap ret = new TreeMap(); |
259 | 259 |
while (rs.next()){ |
260 |
ret.put(rs.getString("TABLE_NAME"), rs.getString("TABLE_NAME")); |
|
260 |
// ret.put(rs.getString("TABLE_NAME"), rs.getString("TABLE_NAME")); |
|
261 |
// As suggested by Jorge Agudo, to allow chargin tables from other schemas |
|
262 |
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")); |
|
261 | 263 |
} |
262 | 264 |
|
263 | 265 |
return (String[]) ret.keySet().toArray(new String[0]); |
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/PostGisDriver.java | ||
---|---|---|
226 | 226 |
try { |
227 | 227 |
conn.setAutoCommit(false); |
228 | 228 |
sqlOrig = "SELECT " + getTotalFields() + " FROM " |
229 |
+ getLyrDef().getTableName() + " "; |
|
229 |
+ getLyrDef().getComposedTableName() + " ";
|
|
230 | 230 |
// + getLyrDef().getWhereClause(); |
231 | 231 |
if (canReproject(strEPSG)) { |
232 | 232 |
completeWhere = getCompoundWhere(sqlOrig, workingArea, strEPSG); |
... | ... | |
280 | 280 |
Statement s = conn.createStatement(); |
281 | 281 |
ResultSet r = s.executeQuery("SELECT extent(" |
282 | 282 |
+ getLyrDef().getFieldGeometry() |
283 |
+ ") AS FullExtent FROM " + getLyrDef().getTableName() |
|
283 |
+ ") AS FullExtent FROM " + getLyrDef().getComposedTableName()
|
|
284 | 284 |
+ " " + getCompleteWhere()); |
285 | 285 |
r.next(); |
286 | 286 |
String strAux = r.getString(1); |
... | ... | |
678 | 678 |
hashRelate = new Hashtable(); |
679 | 679 |
try { |
680 | 680 |
String strSQL = "SELECT " + getLyrDef().getFieldID() + " FROM " |
681 |
+ getLyrDef().getTableName() + " "; |
|
681 |
+ getLyrDef().getComposedTableName() + " ";
|
|
682 | 682 |
// + getLyrDef().getWhereClause(); |
683 | 683 |
if (canReproject(strEPSG)) { |
684 | 684 |
strSQL = strSQL |
... | ... | |
791 | 791 |
strAux = strAux + ", " + getLyrDef().getFieldID(); |
792 | 792 |
|
793 | 793 |
String sqlProv = "SELECT " + strAux + " FROM " |
794 |
+ getLyrDef().getTableName() + " "; |
|
794 |
+ getLyrDef().getComposedTableName() + " ";
|
|
795 | 795 |
// + getLyrDef().getWhereClause(); |
796 | 796 |
|
797 | 797 |
|
... | ... | |
866 | 866 |
|
867 | 867 |
public String[] getGeometryFieldsCandidates(Connection conn, String table_name) throws SQLException { |
868 | 868 |
Statement stAux = conn.createStatement(); |
869 |
String[] tokens = table_name.split("\\u002E", 2); |
|
870 |
String sql; |
|
871 |
if (tokens.length > 1) |
|
872 |
{ |
|
873 |
sql = "select * from GEOMETRY_COLUMNS WHERE F_TABLE_SCHEMA = '" |
|
874 |
+ tokens[0] + "' AND F_TABLE_NAME = '" + |
|
875 |
tokens[1] + "'"; |
|
876 |
} |
|
877 |
else |
|
878 |
{ |
|
879 |
sql = "select * from GEOMETRY_COLUMNS" + |
|
880 |
" where F_TABLE_NAME = " + "'" + table_name + "'"; |
|
869 | 881 |
|
870 |
String sql = "SELECT * FROM GEOMETRY_COLUMNS WHERE F_TABLE_NAME = '" |
|
871 |
+ table_name + "'"; |
|
882 |
} |
|
883 |
|
|
884 |
// String sql = "SELECT * FROM GEOMETRY_COLUMNS WHERE F_TABLE_NAME = '" |
|
885 |
// + table_name + "'"; |
|
872 | 886 |
ResultSet rs = stAux.executeQuery(sql); |
873 | 887 |
ArrayList list = new ArrayList(); |
874 | 888 |
while (rs.next()) |
... | ... | |
880 | 894 |
return (String[]) list.toArray(new String[0]); |
881 | 895 |
} |
882 | 896 |
|
897 |
public String[] getTableNames(Connection conn, String catalog) throws SQLException { |
|
898 |
// TODO Auto-generated method stub |
|
899 |
return super.getTableNames(conn, catalog); |
|
900 |
} |
|
883 | 901 |
|
902 |
|
|
884 | 903 |
} |
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/PostGISWriter.java | ||
---|---|---|
59 | 59 |
|
60 | 60 |
if (bCreateTable) { |
61 | 61 |
try { |
62 |
st.execute("DROP TABLE " + lyrDef.getTableName() + ";"); |
|
62 |
st.execute("DROP TABLE " + lyrDef.getComposedTableName() + ";");
|
|
63 | 63 |
} catch (SQLException e1) { |
64 | 64 |
// Si no existe la tabla, no hay que borrarla. |
65 | 65 |
} |
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/PostGIS.java | ||
---|---|---|
111 | 111 |
resul = "CREATE TABLE " + dbLayerDef.getTableName() + " ("; |
112 | 112 |
else */ |
113 | 113 |
// FJP: NUEVO: NO TOLERAMOS CAMPOS QUE SE LLAMEN GID. Lo reservamos para uso nuestro. |
114 |
resul = "CREATE TABLE " + dbLayerDef.getTableName() |
|
114 |
resul = "CREATE TABLE " + dbLayerDef.getComposedTableName()
|
|
115 | 115 |
+ " (gid serial PRIMARY KEY "; |
116 | 116 |
int j=0; |
117 | 117 |
for (int i = 0; i < dbLayerDef.getFieldNames().length; i++) { |
... | ... | |
151 | 151 |
} |
152 | 152 |
|
153 | 153 |
String result = "SELECT AddGeometryColumn('" |
154 |
+ dbLayerDef.getCatalogName() + "', '"
|
|
154 |
+ dbLayerDef.getSchema() + "', '"
|
|
155 | 155 |
+ dbLayerDef.getTableName() + "', '" |
156 | 156 |
+ dbLayerDef.getFieldGeometry() + "', " |
157 | 157 |
+ dbLayerDef.getSRID_EPSG() + ", '" + strGeometryFieldType + "', " |
... | ... | |
215 | 215 |
* @return |
216 | 216 |
*/ |
217 | 217 |
public String getSqlInsertFeature(DBLayerDefinition dbLayerDef, |
218 |
IFeature feat) { |
|
218 |
IFeature feat) {
|
|
219 | 219 |
StringBuffer sqlBuf = new StringBuffer("INSERT INTO " |
220 |
+ dbLayerDef.getTableName() + " ("); |
|
220 |
+ dbLayerDef.getComposedTableName() + " (");
|
|
221 | 221 |
String sql = null; |
222 | 222 |
int numAlphanumericFields = dbLayerDef.getFieldNames().length; |
223 | 223 |
|
... | ... | |
273 | 273 |
WHERE date > '1994-11-28'; |
274 | 274 |
*/ |
275 | 275 |
StringBuffer sqlBuf = new StringBuffer("UPDATE " |
276 |
+ dbLayerDef.getTableName() + " SET"); |
|
276 |
+ dbLayerDef.getComposedTableName() + " SET");
|
|
277 | 277 |
String sql = null; |
278 | 278 |
int numAlphanumericFields = dbLayerDef.getFieldsDesc().length; |
279 | 279 |
|
... | ... | |
325 | 325 |
// nos sirve dentro de un writer para modificar y/o borrar entidades |
326 | 326 |
// Por ahora, cojo el ID del campo que me indica el dbLayerDev |
327 | 327 |
StringBuffer sqlBuf = new StringBuffer("DELETE FROM " |
328 |
+ dbLayerDef.getTableName() + " WHERE "); |
|
328 |
+ dbLayerDef.getComposedTableName() + " WHERE ");
|
|
329 | 329 |
String sql = null; |
330 | 330 |
int indexFieldId = dbLayerDef.getIdFieldID(); |
331 | 331 |
sqlBuf.append(dbLayerDef.getFieldID() + " = " + row.getAttribute(indexFieldId)); |
branches/v10/applications/appgvSIG/src/com/iver/cit/gvsig/Version.java | ||
---|---|---|
8 | 8 |
|
9 | 9 |
public class Version { |
10 | 10 |
public final static int MAJOR_VERSION_NUMBER = 1; |
11 |
public final static int MINOR_VERSION_NUMBER = 0;
|
|
12 |
public final static int RELEASE_NUMBER = 2;
|
|
11 |
public final static int MINOR_VERSION_NUMBER = 1;
|
|
12 |
public final static int RELEASE_NUMBER = 0;
|
|
13 | 13 |
|
14 | 14 |
private static String BUILD = null; |
15 | 15 |
|
branches/v10/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/legend/scale/gui/FPanelScaleManager.java | ||
---|---|---|
770 | 770 |
} |
771 | 771 |
|
772 | 772 |
info = info + |
773 |
PluginServices.getText(this,"Tabla") +": " + dbdef.getTableName() + "\n"; |
|
773 |
PluginServices.getText(this,"Tabla") +": " + dbdef.getComposedTableName() + "\n";
|
|
774 | 774 |
} else if (rv instanceof VectorialAdapter){ |
775 | 775 |
info = info + "\n" + rv.getDriver().getName() + "\n"; |
776 | 776 |
} |
Also available in: Unified diff