/** * @param s definition of the circle in PostgreSQL's syntax. * @throws SQLException on conversion failure */ public PGcircle(String s) throws SQLException { this(); setValue(s); }
/** * This constructor is used by the driver. */ public PGcircle() { setType("circle"); }
return new PGcircle(rawValue.asString()); } catch (final SQLException e) { LOGGER.error("Failed to parse circle {}, {}", rawValue.asString(), e);
@Override public Object nullSafeGet(ResultSet resultSet, String[] names, SharedSessionContractImplementor sessionImplementor, Object owner) throws HibernateException, SQLException { if (names.length != 1) throw new IllegalArgumentException("names.length != 1, names = " + names); PGcircle value = (PGcircle) resultSet.getObject(names[0]); if (value == null) { return null; } else { /* * Because of an oversite in the Postgres JDBC library, we have to parse a circle from its string * representation: <(5.23,9.71234),4.10293> */ String asString = value.getValue(); double cx = 0, cy = 0, r = 0; try { cx = Double.parseDouble(asString.substring(asString.indexOf("(") + 1, asString.indexOf(","))); cy = Double.parseDouble(asString.substring(asString.indexOf(",") + 1, asString.indexOf(")"))); r = Double.parseDouble(asString.substring(asString.lastIndexOf(",") + 1, asString.indexOf(">"))); } catch (RuntimeException e) { throw new HibernateException("error parsing circle: " + asString, e); } return new Circle(new Point(cx, cy), r); } }
@Override protected PGcircle newInstance() { return new PGcircle(); }
@Override protected Circle toObject(PGcircle value) { Circle obj=new Circle(); obj.setValue(value.getValue()); return obj; }
/** * @param s definition of the circle in PostgreSQL's syntax. * @exception SQLException on conversion failure */ public PGcircle(String s) throws SQLException { this(); setValue(s); }
/** * This constructor is used by the driver. */ public PGcircle() { setType("circle"); }
@Override protected Circle toObjectFromString(String value) { String val=(String)value; try { PGcircle pgObject=new PGcircle(val); return toObject(pgObject); } catch(SQLException e) { throw new RuntimeException(e); } }
/** * @param s definition of the circle in PostgreSQL's syntax. * @exception SQLException on conversion failure */ public PGcircle(String s) throws SQLException { this(); setValue(s); }
/** * This constructor is used by the driver. */ public PGcircle() { setType("circle"); }
@Override public void nullSafeSet(PreparedStatement preparedStatement, Object value, int i, SharedSessionContractImplementor sessionImplementor) throws HibernateException, SQLException { Circle c = (Circle) value; if (value == null) { preparedStatement.setNull(i, java.sql.Types.OTHER); } else { preparedStatement.setObject(i, new PGcircle(c.getCenter().getX(), c.getCenter().getY(), c.getRadius())); } }
/** * @param s definition of the circle in PostgreSQL's syntax. * @exception SQLException on conversion failure */ public PGcircle(String s) throws SQLException { this(); setValue(s); }
/** * This constructor is used by the driver. */ public PGcircle() { setType("circle"); }
@Override protected PGcircle toDbType(Circle obj) { return new PGcircle(obj.getX() , obj.getY(), obj.getR() ); }
@Override protected void setValue(PGcircle obj, String value) throws SQLException { obj.setValue(value); }
return new PGcircle(rawValue.asString()); } catch (final SQLException e) { LOGGER.error("Failed to parse circle {}, {}", rawValue.asString(), e);