Search in sources :

Example 1 with HANAWKBParser

use of org.jkiss.dbeaver.ext.hana.model.data.wkb.HANAWKBParser in project dbeaver by serge-rider.

the class HANAGeometryValueHandler method fetchColumnValue.

@Override
protected Object fetchColumnValue(DBCSession session, JDBCResultSet resultSet, DBSTypedObject type, int index) throws DBCException, SQLException {
    byte[] wkb = resultSet.getBytes(index);
    if (wkb == null) {
        return null;
    }
    HANAWKBParser parser = new HANAWKBParser();
    try {
        Geometry g = parser.parse(wkb);
        return new DBGeometry(g);
    } catch (HANAWKBParserException e) {
        throw new DBCException(e, session.getExecutionContext());
    }
}
Also used : DBGeometry(org.jkiss.dbeaver.model.gis.DBGeometry) Geometry(org.locationtech.jts.geom.Geometry) HANAWKBParserException(org.jkiss.dbeaver.ext.hana.model.data.wkb.HANAWKBParserException) DBGeometry(org.jkiss.dbeaver.model.gis.DBGeometry) DBCException(org.jkiss.dbeaver.model.exec.DBCException) HANAWKBParser(org.jkiss.dbeaver.ext.hana.model.data.wkb.HANAWKBParser)

Example 2 with HANAWKBParser

use of org.jkiss.dbeaver.ext.hana.model.data.wkb.HANAWKBParser in project dbeaver by dbeaver.

the class HANAGeometryValueHandler method fetchColumnValue.

@Override
protected Object fetchColumnValue(DBCSession session, JDBCResultSet resultSet, DBSTypedObject type, int index) throws DBCException, SQLException {
    byte[] wkb = resultSet.getBytes(index);
    if (wkb == null) {
        return null;
    }
    HANAWKBParser parser = new HANAWKBParser();
    try {
        Geometry g = parser.parse(wkb);
        return new DBGeometry(g);
    } catch (HANAWKBParserException e) {
        throw new DBCException(e, session.getExecutionContext());
    }
}
Also used : DBGeometry(org.jkiss.dbeaver.model.gis.DBGeometry) Geometry(org.locationtech.jts.geom.Geometry) HANAWKBParserException(org.jkiss.dbeaver.ext.hana.model.data.wkb.HANAWKBParserException) DBGeometry(org.jkiss.dbeaver.model.gis.DBGeometry) DBCException(org.jkiss.dbeaver.model.exec.DBCException) HANAWKBParser(org.jkiss.dbeaver.ext.hana.model.data.wkb.HANAWKBParser)

Aggregations

HANAWKBParser (org.jkiss.dbeaver.ext.hana.model.data.wkb.HANAWKBParser)2 HANAWKBParserException (org.jkiss.dbeaver.ext.hana.model.data.wkb.HANAWKBParserException)2 DBCException (org.jkiss.dbeaver.model.exec.DBCException)2 DBGeometry (org.jkiss.dbeaver.model.gis.DBGeometry)2 Geometry (org.locationtech.jts.geom.Geometry)2