Skip to content

Commit 04b4f5a

Browse files
bamaercvagner
authored andcommitted
upgrade to Apache Hop 2.13 and fix for Oracle input (STRUCT). #16
1 parent c2aed20 commit 04b4f5a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

hop-gis-plugins/src/main/java/com/atolcd/hop/core/row/value/ValueMetaGeometry.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import java.util.Date;
3939
import oracle.spatial.geometry.JGeometry;
4040
import oracle.spatial.util.WKT;
41-
import oracle.sql.STRUCT;
4241
import org.apache.hop.core.Const;
4342
import org.apache.hop.core.database.DatabaseMeta;
4443
import org.apache.hop.core.database.IDatabase;
@@ -624,7 +623,7 @@ public Object getValueFromResultSet(IDatabase databaseInterface, ResultSet resul
624623

625624
if (resultSet.getObject(index + 1) != null) {
626625

627-
STRUCT st = (oracle.sql.STRUCT) resultSet.getObject(index + 1);
626+
byte[] st = resultSet.getBytes(index + 1);
628627
JGeometry ociGeometry = JGeometry.load(st);
629628
srid = ociGeometry.getSRID();
630629

@@ -647,7 +646,18 @@ public Object getValueFromResultSet(IDatabase databaseInterface, ResultSet resul
647646
}
648647

649648
String wkt = new String(ociWktReaderWriter.fromJGeometry(ociGeometry));
650-
geometry = new WKTReader().read(wkt);
649+
try {
650+
geometry = new WKTReader().read(wkt);
651+
} catch (ParseException e) {
652+
throw new HopDatabaseException(
653+
toStringMeta()
654+
+ " : Unable to get Geometry item '"
655+
+ wkt
656+
+ "' from resultset at index "
657+
+ index
658+
+ " for "
659+
+ databaseInterface.getDriverClass().toString());
660+
}
651661
}
652662

653663
// MySQL
@@ -831,6 +841,7 @@ public void setPreparedStatementValue(
831841
if (geometry.getSRID() > 0) {
832842
ociGeometry.setSRID(geometry.getSRID());
833843
}
844+
834845
preparedStatement.setObject(
835846
index, JGeometry.store(ociGeometry, preparedStatement.getConnection()), Types.STRUCT);
836847

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<properties>
1616
<!-- Set this to the Hop version you want to debug against-->
17-
<hop.version>2.12.0</hop.version>
17+
<hop.version>2.13.0</hop.version>
1818

1919
<!-- Path You will be using to debug the application >
2020
<hop.debug.path>TODO ?</hop.debug.path-->

0 commit comments

Comments
 (0)