Revision: 4816
http://sourceforge.net/p/jump-pilot/code/4816
Author: michaudm
Date: 2016-02-05 08:31:42 +0000 (Fri, 05 Feb 2016)
Log Message:
-----------
Capability to use views in updatable postgis layer
Modified Paths:
--------------
core/trunk/src/com/vividsolutions/jump/datastore/spatialdatabases/SpatialDatabasesDSMetadata.java
Modified:
core/trunk/src/com/vividsolutions/jump/datastore/spatialdatabases/SpatialDatabasesDSMetadata.java
===================================================================
---
core/trunk/src/com/vividsolutions/jump/datastore/spatialdatabases/SpatialDatabasesDSMetadata.java
2016-02-05 05:47:28 UTC (rev 4815)
+++
core/trunk/src/com/vividsolutions/jump/datastore/spatialdatabases/SpatialDatabasesDSMetadata.java
2016-02-05 08:31:42 UTC (rev 4816)
@@ -12,9 +12,8 @@
import com.vividsolutions.jump.datastore.jdbc.JDBCUtil;
import com.vividsolutions.jump.datastore.jdbc.ResultSetBlock;
import com.vividsolutions.jump.workbench.JUMPWorkbench;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
+
+import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -324,6 +323,21 @@
identifierColumns.add(new PrimaryKeyColumn(colName, colType));
rs2.close();
}
+ // For wiew, which have no PK but can reference a pk column,
+ // give the opportunity to use int, bigint or varchar attribute
+ rs = dbMd.getTables(null, getSchemaName(datasetName),
getTableName(datasetName), null);
+ while (rs.next()) {
+ String tableType = rs.getString(4);
+ if (tableType.equals("VIEW")) {
+ ResultSet rs2 = dbMd.getColumns(null, getSchemaName(datasetName),
getTableName(datasetName), null);
+ while (rs2.next()) {
+ PrimaryKeyColumn pk = new PrimaryKeyColumn(rs2.getString(4),
rs2.getString(6));
+ if (pk.getType()== Types.VARCHAR || pk.getType() == Types.INTEGER
|| pk.getType() == Types.BIGINT) {
+ identifierColumns.add(new PrimaryKeyColumn(rs2.getString(4),
rs2.getString(6)));
+ }
+ }
+ }
+ }
} catch (SQLException sqle) {
} finally {
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel