/** * This is defined here, so user code need not overide it. * * @return the value of this object, in the syntax expected by org.postgresql */ public String toString() { return getValue(); }
private void setPGobject(int parameterIndex, PGobject x) throws SQLException { String typename = x.getType(); int oid = connection.getTypeInfo().getPGType(typename); if (oid == Oid.UNSPECIFIED) throw new PSQLException(GT.tr("Unknown type {0}.", typename), PSQLState.INVALID_PARAMETER_TYPE); setString(parameterIndex, x.getValue(), oid); }
@Override public Object clone() throws CloneNotSupportedException { // squid:S2157 "Cloneables" should implement "clone return super.clone(); } }
sql = "delete from foo where ctid = ?"; deleteStmt = conn.prepareStatement( sql ); org.postgresql.util.PGobject pgo = new org.postgresql.util.PGobject(); pgo.setType("tid"); pgo.setValue("(0,54)"); // value is a string as might be returned in select ctid from foo and then resultSet.getString(1); deleteStmt.setObject(1, pgo); int a = deleteStmt.executeUpdate(); System.out.println("delete returns " + a);
private static String getPgDataType(Object v) { if (v instanceof java.sql.Timestamp) { return "timestamp"; } if (v instanceof java.util.Date) { return "date"; } if (havePGobject && v instanceof PGobject) { return ((PGobject)v).getType(); } return null; }
@Override public Object clone() throws CloneNotSupportedException { // squid:S2157 "Cloneables" should implement "clone return super.clone(); } }
private PGobject toPGobject(X value, WrapperOptions options) throws SQLException { final WkbEncoder encoder = Wkb.newEncoder( Wkb.Dialect.POSTGIS_EWKB_1 ); final Geometry geometry = getJavaDescriptor().unwrap( value, Geometry.class, options ); final String hexString = encoder.encode( geometry, ByteOrder.NDR ).toString(); final PGobject obj = new PGobject(); obj.setType( "geometry" ); obj.setValue( hexString ); return obj; }
/** * This is defined here, so user code need not overide it. * @return the value of this object, in the syntax expected by org.postgresql */ public String toString() { return getValue(); } }
private void setPGobject(int parameterIndex, PGobject x) throws SQLException { String typename = x.getType(); int oid = connection.getTypeInfo().getPGType(typename); if (oid == Oid.UNSPECIFIED) { throw new PSQLException(GT.tr("Unknown type {0}.", typename), PSQLState.INVALID_PARAMETER_TYPE); } if ((x instanceof PGBinaryObject) && connection.binaryTransferSend(oid)) { PGBinaryObject binObj = (PGBinaryObject) x; byte[] data = new byte[binObj.lengthInBytes()]; binObj.toBytes(data, 0); bindBytes(parameterIndex, data, oid); } else { setString(parameterIndex, x.getValue(), oid); } }
@Override public Object clone() throws CloneNotSupportedException { // squid:S2157 "Cloneables" should implement "clone return super.clone(); } }
@Override public Object clone() throws CloneNotSupportedException { // squid:S2157 "Cloneables" should implement "clone return super.clone(); } }
if (obj instanceof PGobject) { PGobject pg = (PGobject) obj; if (pg.getType().equalsIgnoreCase("json")) { JsonNode pgNode; try { pgNode = DataFileTool.OBJECT_MAPPER.readTree(pg.getValue()); node.set(columnNameToUse, pgNode); } catch (IOException e) { LOGGER.error("An exception occurred while attempting to parse JSON PGObject to JsonNode: {}", obj, e); node.put(columnNameToUse, obj.toString()); } } else { node.put(columnNameToUse, obj.toString()); } }
public Object clone() throws CloneNotSupportedException { PGcircle newPGcircle = (PGcircle) super.clone(); if (newPGcircle.center != null) { newPGcircle.center = (PGpoint) newPGcircle.center.clone(); } return newPGcircle; }