Revision: 4817
http://sourceforge.net/p/jump-pilot/code/4817
Author: michaudm
Date: 2016-02-05 12:40:08 +0000 (Fri, 05 Feb 2016)
Log Message:
-----------
Better primary key and exception handling
Modified Paths:
--------------
core/trunk/src/com/vividsolutions/jump/datastore/DataStoreMetadata.java
core/trunk/src/com/vividsolutions/jump/datastore/PrimaryKeyColumn.java
core/trunk/src/com/vividsolutions/jump/datastore/spatialdatabases/SpatialDatabasesDSMetadata.java
Modified:
core/trunk/src/com/vividsolutions/jump/datastore/DataStoreMetadata.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/datastore/DataStoreMetadata.java
2016-02-05 08:31:42 UTC (rev 4816)
+++ core/trunk/src/com/vividsolutions/jump/datastore/DataStoreMetadata.java
2016-02-05 12:40:08 UTC (rev 4817)
@@ -24,7 +24,8 @@
* @param datasetName
* the table name (optionally prefixed by a schema name)
*/
- List<PrimaryKeyColumn> getPrimaryKeyColumns(String datasetName);
+ List<PrimaryKeyColumn> getPrimaryKeyColumns(String datasetName)
+ throws SQLException;
/**
* @param datasetName
Modified: core/trunk/src/com/vividsolutions/jump/datastore/PrimaryKeyColumn.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/datastore/PrimaryKeyColumn.java
2016-02-05 08:31:42 UTC (rev 4816)
+++ core/trunk/src/com/vividsolutions/jump/datastore/PrimaryKeyColumn.java
2016-02-05 12:40:08 UTC (rev 4817)
@@ -27,17 +27,23 @@
else if (sqlTypeName.equals("bit")) this.sqlType = Types.BIT;
else if (sqlTypeName.equals("boolean")) this.sqlType = Types.BOOLEAN;
else if (sqlTypeName.equals("date")) this.sqlType = Types.DATE;
+ else if (sqlTypeName.equals("decimal")) this.sqlType = Types.NUMERIC;
else if (sqlTypeName.equals("double")) this.sqlType = Types.DOUBLE;
else if (sqlTypeName.equals("double precision")) this.sqlType =
Types.DOUBLE;
+ else if (sqlTypeName.equals("int4")) this.sqlType = Types.INTEGER;
+ else if (sqlTypeName.equals("int8")) this.sqlType = Types.BIGINT;
else if (sqlTypeName.equals("json")) this.sqlType = Types.VARCHAR;
else if (sqlTypeName.equals("numeric")) this.sqlType = Types.NUMERIC;
else if (sqlTypeName.equals("real")) this.sqlType = Types.REAL;
else if (sqlTypeName.equals("smallint")) this.sqlType = Types.SMALLINT;
else if (sqlTypeName.equals("serial")) this.sqlType = Types.BIGINT;
+ else if (sqlTypeName.equals("serial4")) this.sqlType = Types.INTEGER;
+ else if (sqlTypeName.equals("serial8")) this.sqlType = Types.BIGINT;
else if (sqlTypeName.equals("timestamp")) this.sqlType =
Types.TIMESTAMP;
else if (sqlTypeName.equals("timestamp with time zone")) this.sqlType
= Types.TIMESTAMP;
else if (sqlTypeName.equals("timestamp without time zone"))
this.sqlType = Types.TIMESTAMP;
else if (sqlTypeName.equals("time")) this.sqlType = Types.TIME;
+ else if (sqlTypeName.equals("varchar")) this.sqlType = Types.VARCHAR;
else this.sqlType = Types.JAVA_OBJECT;
}
Modified:
core/trunk/src/com/vividsolutions/jump/datastore/spatialdatabases/SpatialDatabasesDSMetadata.java
===================================================================
---
core/trunk/src/com/vividsolutions/jump/datastore/spatialdatabases/SpatialDatabasesDSMetadata.java
2016-02-05 08:31:42 UTC (rev 4816)
+++
core/trunk/src/com/vividsolutions/jump/datastore/spatialdatabases/SpatialDatabasesDSMetadata.java
2016-02-05 12:40:08 UTC (rev 4817)
@@ -305,7 +305,7 @@
* @return the list of columns involved in the Primary Key (generally, a
* single column)
*/
- public List<PrimaryKeyColumn> getPrimaryKeyColumns(String datasetName) {
+ public List<PrimaryKeyColumn> getPrimaryKeyColumns(String datasetName)
throws SQLException {
final List<PrimaryKeyColumn> identifierColumns = new
ArrayList<PrimaryKeyColumn>();
ResultSet rs = null;
@@ -333,13 +333,13 @@
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)));
+ identifierColumns.add(pk);
}
}
}
}
} catch (SQLException sqle) {
-
+ throw sqle;
} finally {
try {
rs.close();
------------------------------------------------------------------------------
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