未验证 提交 b8cb569b 编写于 作者: S Serge Rider 提交者: GitHub

Merge pull request #13942 from dbeaver/redshift-geometry-read-fix#13939_21_2_1

#13939 Redshift geometry values read fix
......@@ -137,7 +137,7 @@ public class PostgreGeometryValueHandler extends JDBCAbstractValueHandler {
return super.getValueDisplayString(column, value, format);
}
private DBGeometry makeGeometryFromWKB(String hexString) throws DBCException {
protected DBGeometry makeGeometryFromWKB(String hexString) throws DBCException {
return makeGeometryFromWKB(WKBReader.hexToBytes(hexString));
}
......
......@@ -21,15 +21,23 @@ import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.ext.postgresql.model.data.PostgreGeometryValueHandler;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.gis.DBGeometry;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import org.locationtech.jts.geom.Geometry;
import java.sql.SQLException;
public class RedshiftGeometryValueHandler extends PostgreGeometryValueHandler {
public static final RedshiftGeometryValueHandler INSTANCE = new RedshiftGeometryValueHandler();
private RedshiftGeometryValueHandler() {}
@Override
protected Object fetchColumnValue(DBCSession session, JDBCResultSet resultSet, DBSTypedObject type, int index) throws DBCException, SQLException {
return getValueFromObject(session, type, resultSet.getString(index), false, false);
}
@Nullable
@Override
public Object getValueFromObject(@NotNull DBCSession session, @NotNull DBSTypedObject type, Object object, boolean copy, boolean validateValue) throws DBCException {
......@@ -45,6 +53,9 @@ public class RedshiftGeometryValueHandler extends PostgreGeometryValueHandler {
if (object instanceof byte[]) {
return makeGeometryFromWKB((byte[]) object);
}
if (object instanceof String) {
return makeGeometryFromWKB((String) object);
}
return null;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册