Serializable Interface

Red Hat Database is more extensible than most other databases and supports unique object-oriented features. One of the consequences of this is that you can have one table refer to a row in another table. For example:

test=> create table users (username name,fullname text);
CREATE
test=> create table server (servername name,adminuser users);
CREATE
test=> insert into users values ('peter','Peter Mount');
INSERT 2610132 1
test=> insert into server values ('maidast',2610132::users);
INSERT 2610133 1
test=> select * from users;
username|fullname      
--------+--------------
peter   |Peter Mount   
(1 row)

test=> select * from server;
servername|adminuser
----------+---------
maidast   |  2610132
(1 row)

The above shows that we can use a table name as a field, and the row's OID value is stored in that field.

With Java, you can convert an object to a Stream as long as its class implements the java.io.Serializable interface. This process, known as Object Serialization, can be used to store complex objects in the database. If JDBC was used, you could use a Large Object to store objects. You cannot, however, perform queries on those objects.

What the org.postgresql.util.Serialize class does is provide a means of storing an object as a table. It also provides methods to retrieve that object from a table. In most cases, you do not need to access this class directly; you would use the PreparedStatement.setObject() and ResultSet.getObject() methods. Those methods check the object's class name against the tables in the database. If a match is found, it assumes that the object is a Serialized object and retrieves it from that table. As it does so, if the object contains other serialized objects, then it retrieves them, continuing on recursively.

The only time you would access this class, is to use the create() methods. These are not used by the driver, but issue one or more "create table" statements to the database, based on a Java Object or Class that you want to serialize.

If your object contains a line such as:

public int oid;

then, when the object is retrieved from the table, it is set to the oid within the table. Then, if the object is modified and re-serialized, the existing entry is updated.

If the oid variable is not present, then when the object is serialized, it is always inserted into the table and any existing entry in the table is preserved. Setting oid to 0 before serialization will also cause the object to be inserted. This enables an object to be duplicated in the database.

Serializable Definition

package org.postgresql.util;
public class Serializable {
  // Constructors
  public Serialize(Connection con, String type) 
     throws SQLException;
   
  // Methods
  public Object fetch(int oid) throws SQLException;
  public int store(Object o) throws SQLException;
   
  // Class Methods
  public static void create(Connection con, Object o)
     throws SQLException;
  public static String toClassName(String name) 
     throws SQLException;
  public static String toPostgreSQL(String name) 
     throws SQLException;
}

Serializable Constructors

public Serialize(Connection con, String type) throws SQLException;

This method creates an instance of Serialize that can be used to serialize/deserialize a Java object to or from a Red Hat Database table.

Parameters.

con

The database connection to use.

type

The database connection to use.

Serializable Methods

public Object fetch(int oid) throws SQLException;

This method fetches the object with OID oid from the table set in the Serialize constructor call.

Parameters.

oid

The OID of the object to fetch.

Returns. The object that corresponds to the given OID.

public int store(Object o) throws SQLException;

Stores an object into the table set in the Serialize constructor call.

If the object has an public int field called oid, then the following rules apply:

  • If oid is set to a value larger than 0, then oid is taken as the OID of the row in the table where the object is stored; the table will be updated.

  • If the value of oid is 0 then a new row will be created and the value of oid will be set in the object the OID of the new row. This enables an object's value in the database to be updatable.

If the object has no int called OID then the object is just stored. However, if the object is later retrieved, modified and then stored again, its new state will be appended to the table; old entries will not be overwritten.

Parameters.

o

The object to serialize.

Returns. The OID of the row object is stored in.

Serializable Class Methods

public static void create(Connection con, Object o) throws SQLException;

This method creates a table, given a Serializable Java Object. It should be used before serializing any objects.

Parameters.

con

The connection to the database.

o

The object to base the table on.

public static String toClassName(String name) throws SQLException;

This converts a Java Class name to a Red Hat Database table, by replacing periods (.) with underscores (_). Thus, a Class name must not have any underscores in the name.

Another limitation is that the entire class name (including packages) cannot be longer than 31 characters (a limit forced by PostgreSQL).

Parameters.

name

The class name.

Returns. A string that contains the Red Hat Database table name.

public static String toPostgreSQL(String name) throws SQLException;

This converts a PostgreSQL table to a Java Class name, by replacing underscores (_) with periods (.).

Parameters.

name

The Red Hat Database table name.

Returns. A string that contains the Java class name.

PGobject Class

The PGobject class is used to describe specialized data types that are not included in the JDBC standards. A call to the addDatatype method of an org.postgresql.Connection object permits a class that extends PGobject to be associated with a named type. This is how the org.postgresql.geometric package operates.

ResultSet.getObject() will return a PGobject instance for any type that is not recognized and does not have its own handler. Therefore, all PostgreSQL data types are supported.

PGobject Definition

package org.postgresql.util;
public class PGobject implements Serializable, Cloneable {
   // Constructors
   public PGobject();
   
   // Methods
   public Object clone();
   public boolean equals(Object obj);
   public final String getType();
   public String getValue();
   public final void setType(String type);
   public void setValue(String value) throws SQLException;
   public String toString();
}

PGobject Constructors

public PGobject()

Creates a new instance of PGobject.

public Object clone()

Creates a new PGobject object that is exactly the same as this one.

public boolean equals(Object obj)

Compares the current PGobject object with another PGobject object.

Parameters.

obj

object to compare with

public final String getType()

Returns the name of the type that this PGobject represents.

public String getValue()

Returns the value of the type that this PGobject represents. This method should be overridden by subclasses.

public final void setType(String type)

Sets the type of the object.

Parameters.

type

The name.

public void setValue(String value)

Sets the value of this PGobject. This method should be overridden by subclasses.

Parameters.

value

String representation of this object's value.

public String toString()

Returns the value of this object in string form.

PGmoney Class

The PGmoney class handles the Red Hat Database money data type.

PGmoney Definition

package org.postgresql.util;
public class PGmoney extends PGobject 
   implements Serializable, Cloneable {
   // Variables
   public double val;
   
   // Constructors
   public PGmoney();
   public PGmoney(double val);
   public PGmoney(String value) throws SQLException;
   
   // Methods
   public void setValue(String s) throws SQLException;
   public boolean equals(Object obj);
   public Object clone();
   public String getValue();
}

PGmoney Variables

public double val

The monetary amount that the a PGmoney object represents.

public PGmoney()

Creates a new PGmoney object. The value of val is undefined.

public PGmoney(double val);

Creates a new PGmoney object with val set to value.

Parameters.

val

The amount of money the new PGmoney object should represent.

public PGmoney(String value) throws SQLException

Creates a new PGmoney object using the Red Hat Database syntax for the money data type.

Parameters.

value

The definition in the Red Hat Database money syntax.

PGmoney Methods

public Object clone()

Creates a new PGmoney object that is exactly the same as this one.

public boolean equals(Object obj)

Compares the current PGmoney object with another PGmoney object.

Parameters.

obj

The object to compare with.

Returns. True if the two PGmoney objects are identical.

public String getValue()

Returns the definition of the PGmoney object in the Red Hat Database money syntax.

Returns. The PGmoney definition in the syntax expected by Red Hat Database.

public void setValue()

This method sets the value of this PGmoney object. The Red Hat Database money syntax must be used.

Throws: SQLException on conversion failure.

PGtokenizer Class

The PGtokenizer class is used to tokenize the text output of Red Hat Database. It is used by the geometric classes. Any custom handler classes that need to parse output from Red Hat Database will find PGtokenizer useful.

PGtokenizer Definition

package org.postgresql.util;
public class PGtokenizer {
   // Constructors
   public PGtokenizer(String string, char delim);
   
   // Methods
   public int getSize();
   public String getToken(int n);
   public void remove(String l, String t);
   public void removeAngle();
   public void removeBox();
   public void removePara();
   public int tokenize(String string, char delim);
   public PGtokenizer tokenizeToken(int n, char delim);
   
   // Class methods
   public static String remove(String s, String l, String t);
   public static String removeAngle(String s);
   public static String removeBox(String s);
   public static String removePara(String s);
}

PGtokenizer Constructors

public PGtokenizer(String string, char delim)

Creates a new tokenizer that will tokenize the supplied string using delim as token separator.

Parameters.

string

The string to tokenize.

delim

The character that separates tokens.

PGtokenizer Methods

public int getSize()

Returns the number of tokens that the string was parsed into.

public String getToken(int n)

getToken returns the n'th available token. n is between 0 and getSize() - 1.

Parameters.

n

Token to get.

Returns. The n'th token.

public void remove(String l, String t)

Removes the String l from the beginning of all tokens and the String t from the end of all tokens.

Parameters.

l

Leading string to remove.

t

Trailing string to remove.

public void removeAngle()

Removes '<' from the beginning of all tokens and '>' from the end of all tokens.

public void removeBox()

Removes '[' from the beginning of all tokens and ']' from the end of all tokens.

public void removePara()

Removes '(' from the beginning of all tokens and ')' from the end of all tokens.

public int tokenize(String string, char delim)

Resets the tokenizer with a new string and delimiter.

Parameters.

string

The string to tokenize.

delim

Character to recognize as the delimiter.

Returns. The number of tokens created.

public PGtokenizer tokenizeToken(int n, char delim)

Returns a new tokenizer based on the n'th token of the current tokenizer, where 0 <= n <= getSize() - 1. This method is useful for parsing nested tokens.

Parameters.

n

The index of the token to tokenize.

delim

Character to recognize as the delimiter.

Returns. A new PGtokenizer.

public static String remove(String s, String l, String t)

Removes the given leading and trailing strings from another string.

Parameters.

s

The String to be trimmed.

l

The leading String to remove.

t

The trailing String to remove.

Returns. A new String based on s but without leading and trailing strings.

public static String removeAngle(String s)

Removes '<' from the beginning of s and '>' from the end of s.

Parameters.

s

The String to trim angled brackets from.

Returns. A new String based on s but with leading '<' removed and trailing '>' removed.

public static String removeBox(String s)

Removes '[' from the beginning of s and ']' from the end of s.

Parameters.

s

The String to trim square brackets from.

Returns. A new String based on s but with leading '[' removed and trailing ']' removed.

public static String removePara(String s)

Removes '(' from the beginning of s and ')' from the end of s.

Parameters.

s

The String to trim parentheses from.

Returns. A new String based on s but with leading '(' removed and trailing ')' removed.

UnixCrypt Class

UnixCrypt provides the ability to encrypt passwords that are to be sent over the network stream for user authentication. It contains static methods to encrypt passwords and to compare passwords with Unix-encrypted ones.

UnixCrypt Definition

package org.postgresql.util;
public class UnixCrypt {
   // Class Methods
   public static final String crypt(String original);
   public static final String crypt(String salt, 
      String original);
   public static final boolean matches(String 
      encrypted, String entered);
}

UnixCrypt Class Methods

public static final String crypt(String original)

Returns an encrypted version of the original parameter. This method generates and uses a random salt using the java.util.Random class.

Parameters.

original

The text (password) to encrypt.

Returns. The encrypted version of the original parameter.

public static final String crypt(String salt, String original)

Returns an encrypted version of the original parameter. This method uses a user-supplied salt value.

Parameters.

salt

A two-character string representing the salt that is used to iterate the encryption engine in many different ways. If you are generating a new encryption, this should be set to a random value.

original

The text (password) to encrypt.

Returns. The encrypted version of the original parameter.

public static final boolean matches(String encryptedPassword, String enteredPassword)

Checks that enteredPassword encrypts to encryptedPassword.

Parameters.

encryptedPassword

The encrypted text. The first two characters are assumed to be the salt. This string would be the same one as found in a Unix /etc/passwd file.

enteredPassword

The text plain text that is being checked.

Returns. Returns true when enteredPassword encrypts to encryptedPassword; false otherwise

PGpoint Class

This implements a version of java.awt.Point, except it uses double variables to represent the coordinates. PGpoint maps to the point data type in Red Hat Database.

PGpoint Definition

package org.postgresql.geometric;
public class PGpoint extends PGobject 
   implements Serializable, Cloneable {
   // Variables
   public double x;
   public double y;
   
   // Constructors
   public PGpoint();
   public PGpoint(double x, double y);
   public PGpoint(String value) throws SQLException;
   
   // Methods
   public Object clone();
   public boolean equals(Object obj);
   public String getValue();
   public void move(int x, int y);
   public void move(double x, double y);
   public void setLocation(int x, int y);
   public void setLocation(Point p);
   public void setValue(String s) throws SQLException;
   public void translate(int x, int y);
   public void translate(double x, double y);
}

PGpoint Variables

public double x

The X coordinate of the point.

public double y

The Y coordinate of the point.

PGpoint Constructors

public PGpoint()

Creates a new PGpoint object. The x and y fields are undefined.

public PGpoint(double x, double y)

Parameters.

x

The X coordinate.

y

The Y coordinate.

public PGpoint(String value) throws SQLException

Parameters.

value

The definition of this point in Red Hat Database's syntax.

PGpoint Methods

public Object clone()

Creates a new PGpoint object that is exactly the same as this one.

public boolean equals(Object obj)

Compare the current PGpoint object with another PGpoint object.

Parameters.

obj

The object to compare with.

Returns. Returns true if the two points are identical; false otherwise.

public String getValue()

Returns the definition of the PGpoint in Red Hat Database point syntax.

Returns. The PGpoint in the syntax expected by Red Hat Database.

public void move(int x, int y)

Moves the point to the supplied coordinates.

Parameters.

x

The new X coordinate.

y

The new Y coordinate.

public void move(double x, double y)

Moves the point to the supplied coordinates.

Parameters.

x

The new X coordinate.

y

The new Y coordinate.

public void setLocation(int x, int y)

Moves the point to the supplied coordinates. This method is the same as move(int, int).

Parameters.

x

The new X coordinate.

y

The new Y coordinate.

public void setLocation(java.awt.Point p)

Moves the point to the coordinate defined by the supplied Point.

Parameters.

p

The point to move to.

public void setValue(String s) throws SQLException

This method sets the X and Y coordinates of this PGpoint. The Red Hat Database point syntax must be used.

Parameters.

s

The definition of this point in the Red Hat Database point syntax.

Throws: SQLException on conversion failure.

public void translate(int dx, int dy)

Translates the point by the given amount. The new position of the PGpoint p at (x, y) will be (x + dx, y + dy).

Parameters.

x

The integer amount to move on the X axis.

y

The integer amount to move on the Y axis.

public void translate(double x, double y)

Translates the point by the given amount. The new position of the PGpoint p at (x, y) will be (x + dx, y + dy).

Parameters.

x

The double amount to move on the X axis.

y

The double amount to move on the Y axis.

PGlseg Class

This implements the lseg data type. lseg represents a finite line or line segment; the line does not extend beyond its two endpoints.

PGlseg Definition

package org.postgresql.geometric;
public class PGlseg extends PGobject 
   implements Serializable, Cloneable {
   // Variables
   public PGpoint[] point;
   
   // Constructors
   public PGlseg();
   public PGlseg(double x1, double y1, double x2, double y2);
   public PGlseg(PGpoint p1, PGpoint p2);
   public PGlseg(String s) throws SQLException;
   
   // Methods
   public Object clone();
   public boolean equals(Object obj);
   public String getValue();
   public void setValue(String s) throws SQLException;
}

PGlseg Variables

public PGpoint[] point

The two end-points of the line segment.

PGlseg Constructors

public PGlseg()

Creates a new PGlseg object. The two points are undefined.

public PGlseg(double x1, double y1, double x2, double y2)

Creates a new PGlseg object with endpoints (x1, y1) and (x2, y2).

Parameters.

x1

The X coordinate for the first end-point.

y1

The Y coordinate for the first end-point.

x2

The X coordinate for the second end-point.

y2

The Y coordinate for the second end-point.

public PGlseg(PGpoint p1, PGpoint p2)

Creates a new PGlseg object with endpoints p1 and p2.

Parameters.

p1

The first end-point.

p2

The second end-point.

public PGlseg(String s) throws SQLException

Creates a new PGlseg object using the Red Hat Database syntax for the lseg data type.

Parameters.

s

The definition of the circle in Red Hat Database syntax.

Throws: SQLException on conversion failure.

PGlseg Methods

public Object clone()

Creates a new PGlseg object that is exactly the same as this one.

public boolean equals(Object obj)

Compares the current PGlseg with another PGlseg object.

Parameters.

obj

Object to compare with.

Returns. Returns true if the two PGlseg objects are identical; false otherwise.

public String getValue()

Returns the definition of the PGlseg in Red Hat Database lseg syntax.

Returns. The PGlseg in the syntax expected by Red Hat Database.

public void setValue(String s) throws SQLException

This method sets the two end-points. The Red Hat Database lseg definition syntax must be used.

Parameters.

s

The definition of the line segment in Red Hat Database syntax.

Throws: SQLException on conversion failure.

PGline Class

This implements an infinite line which is defined by two points. The line data type exists in the backend but is currently unimplemented. This class is included for completeness.

PGline Definition

package org.postgresql.geometric;
public class PGline extends PGobject 
   implements Serializable, Cloneable {
   // Variables
   public PGpoint[] point;
   
   // Constructors
   public PGline();
   public PGline(double x1, double y1, double x2, double y2);
   public PGline(PGpoint p1, PGpoint p2);
   public PGline(String s) throws SQLException;
   
   // Methods
   public Object clone();
   public boolean equals(Object obj);
   public String getValue();
   public void setValue(String s) throws SQLException;
}

PGline Variables

public PGpoint[] point

The two end-points that define the line.

PGline Constructors

public PGline()

Creates a new PGline object. The two points are undefined.

public PGline(double x1, double y1, double x2, double y2)

Creates a new PGlseg object with endpoints (x1, y1) and (x2, y2).

Parameters.

x1

The X coordinate for the first point.

y1

The Y coordinate for the first point.

x2

The X coordinate for the second point.

y2

The Y coordinate for the second point.

public PGline(PGpoint p1, PGpoint p2)

Creates a new PGlseg object with the points p1 and p2.

Parameters.

p1

The first point.

p2

The second point.

public PGlseg(String s) throws SQLException

Creates a new PGlseg object using the Red Hat Database syntax for the lseg data type.

Parameters.

s

The definition of the circle in Red Hat Database syntax.

Throws: SQLException on conversion failure.

PGline Methods

public Object clone()

Creates a new PGline object that is exactly the same as this one.

public boolean equals(Object obj)

Compares the current PGline with another PGline object.

Parameters.

obj

Object to compare with.

Returns. Returns true if the two PGline objects are identical; false otherwise.

public String getValue()

Returns the definition of the PGline in Red Hat Database line syntax.

Returns. The PGline in the syntax expected by Red Hat Database.

public void setValue(String s) throws SQLException

This method sets the two end-points of this PGline. The Red Hat Database line definition syntax must be used.

Parameters.

s

The definition of the line segment in Red Hat Database syntax.

Throws: SQLException on conversion failure.

PGbox Class

The PGbox class represents Red Hat Database's box data type. A box is represented by a pair of points, the opposite corners of the box.

PGbox Definition

package org.postgresql.geometric;
public class PGbox extends PGobject 
   implements Serializable, Cloneable {
   // Variables
   public PGpoint[] point;
   
   // Constructors
   public PGbox(double x1, double y1, double x2, double y2);
   
   // Methods
   public Object clone();
   public boolean equals(Object obj);
   public String getValue();
         	public void setValue(String value) throws SQLException;
}

PGbox Variables

public PGpoint[] point

The two corner points of the box.

PGbox Constructors

public PGbox()

Creates a new PGbox object. The values of the two corner points are undefined.

public PGbox(double x1, double y1, double x2, double y2)

Creates a new PGbox object whose corner points are (x1, y1) and (x2, y2).

Parameters.

x1

The X coordinate for the first point.

y1

The Y coordinate for the first point.

x2

The X coordinate for the second point.

y2

The Y coordinate for the second point.

public PGbox(PGpoint p1, PGpoint p2)

Creates a new PGbox object whose corner points are p1 and p2.

Parameters.

p1

The first point.

p2

The second point.

public PGbox(String s) throws SQLException

Creates a new PGbox object whose definition is given in the Red Hat Database syntax.

Parameters.

s

The definition of the box in Red Hat Database syntax.

Throws: SQLException if the definition is invalid.

PGbox Methods

public Object clone()

Creates a new PGbox object that is exactly the same as this one.

public boolean equals(Object obj)

Compares the current PGbox with another PGbox object.

Parameters.

obj

Object to compare with.

Returns. Returns true if the two PGbox objects are identical; false otherwise.

public String getValue()

Returns the definition of the PGbox in Red Hat Database syntax.

Returns. The PGbox in the syntax expected by Red Hat Database.

public void setValue(String s) throws SQLException

This method sets the position of the two corner points of this PGbox object. The Red Hat Database line definition syntax must be used.

Parameters.

value

The PGbox definition in Red Hat Database syntax.

Throws: SQLException thrown if value is invalid.

PGpolygon Class

The PGbox class represents Red Hat Database's polygon data type.

PGpolygon Definition

package org.postgresql.geometric;
public class PGpolygon extends PGobject 
   implements Serializable, Cloneable {
   // Variables
   public PGpoint[] points;
   
   // Constructors
   public PGpolygon();
   public PGpolygon(PGpoint points[]);
   public PGpolygon(String s) throws SQLException;
   
   // Methods
   public Object clone();
   public boolean equals(Object obj);
   public String getValue();
   public void setValue(String s) throws SQLException;
}

PGpolygon Variables

public PGpoint[] points

The points defining the polygon.

PGpolygon Constructors

public PGpolygon()

Creates a new PGpolygon. The points making up the polygon are undefined.

public PGpolygon(PGpoint[] points)

Creates a PGpolygon using an array of PGpooints.

Parameters.

points

The points defining the polygon.

public PGpolygon(String s) throws SQLException

Creates a new PGpolygon using the Red Hat Database syntax for the polygon data type.

Parameters.

s

Definition of the polygon in Red Hat Database polygon syntax.

Throws: SQLException on conversion failure.

PGpolygon Methods

public Object clone()

Creates a new PGpolygon object that is exactly the same as this one.

public boolean equals(Object obj)

Compares the current PGpolygon object with another PGpolygon object

Parameters.

obj

The object to compare with.

Returns. True if the two polygons are identical.

public String getValue()

Returns the definition of the PGpolygon in Red Hat Database syntax.

Returns. The PGpolygon definition in the syntax expected by Red Hat Database.

public void setValue(String s) throws SQLException

Sets the points that make up this PGpolygon. The Red Hat Database polygon syntax must be used.

Parameters.

s

Definition of the polygon in Red Hat Database polygon syntax.

Throws: SQLException on conversion failure.

PGcircle Class

PGcircle represents Red Hat Database's circle data type. A circle consists of a center point and a radius.

PGcircle Definition

package org.postgresql.geometric;
public class PGcircle extends PGobject implements 
   Serializable, Cloneable {
   // Variables
   public PGpoint center;
   public double radius;
   
   // Constructors
   public PGcircle();
   public PGcircle(double x, double y, double r);
   public PGcircle(PGpoint c, double r);
   public PGcircle(String s) throws SQLException;
   
   // Methods
   public Object clone();
   public boolean equals(Object obj);
   public String getValue();
   public void setValue(String s) throws SQLException;
}

PGcircle Variables

public PGpoint center

The center point of the circle.

public double radius

The radius of the circle.

PGcircle Constructors

public PGcircle()

Creates a new PGcircle object. The center and radius are undefined.

public PGcircle(double x, double y, double r)

Creates a new PGcircle object with center (x, y) and radius r.

Parameters.

x

The X coordinate of the center.

y

The Y coordinate of the center.

r

The radius.

public PGcircle(PGpoint c, double r)

Creates a new PGcircle object with center c and radius r.

Parameters.

c

PGpoint describing the circle's center.

r

The radius.

public PGcircle(String s) throws SQLException

Creates a new PGcircle using the Red Hat Database syntax for the circle data type.

Parameters.

s

Definition of the circle in Red Hat Database circle syntax.

PGcircle Methods

public Object clone()

Creates a new PGcircle object that is exactly the same as this one.

public boolean equals(Object obj)

Compares the current PGcircle object with another PGcircle object.

Parameters.

obj

Object to compare with.

Returns. True if the two PGcircle objects are identical.

public String getValue()

Returns the definition of the PGcircle in Red Hat Database syntax.

Returns. The PGcircle definition in the syntax expected by Red Hat Database.

public void setValue(String s) throws SQLException

Sets the center and radius of this PGcircle. The Red Hat Database circle syntax must be used.

Parameters.

s

The definition of the circle in Red Hat Database circle syntax.

Throws: SQLException on conversion failure.

PGpath Class

PGpath implements a path, a line with multiple segments. The path may or may not be closed.

PGpath Definition

package org.postgresql.geometric;
public class PGpath extends PGobject implements 
   Serializable, Cloneable {
   // Variables
   public boolean open;
   public PGpoint[] points;
   
   // Constructors
   public PGpath();
   public PGpath(PGpoint points[], boolean open);
   public PGpath(String s) throws SQLException;
   
   // Methods
   public Object clone();
   public void closePath();
   public boolean equals(Object obj);
   public String getValue();
   public boolean isClosed();
   public boolean isOpen();
   public void openPath();
   public void setValue(String s) throws SQLException;
}

PGpath Variables

public boolean open

True if the path is open, false if closed.

public PGpoint[] points

The points that define a path.

PGpath Constructors

public PGpath()

Creates a new PGpath object. The number of points and their values are undefined.

public PGpath(PGpoint points[], boolean open)

Creates a new PGpath object based on the given points.

Parameters.

points

The PGpoints that define the path.

open

True if the path is open, false if closed.

public PGpath(String s) throws SQLException

Creates a new PGpath object using the Red Hat Database syntax for the path data type.

Parameters.

s

Definition of the path in PostgreSQL's syntax.

Throws:

s

SQLException on conversion failure.

PGpath Methods

public Object clone()

Creates a new PGpath object that is exactly the same as this one.

public void closePath()

Marks the path as closed.

public boolean equals(Object obj)

Compares the current PGpath with another PGpath object.

Parameters.

obj

Object to compare with.

Returns. True if the two paths are identical.

public String getValue()

Returns the definition of the PGpath in Red Hat Database path syntax.

public boolean isClosed()

Returns true if the path is closed.

public boolean isOpen()

Returns true if the path is open.

public void openPath()

Marks the path as open.

public void setValue(String s) throws SQLException

Sets the points of this PGpath. The Red Hat Database path syntax must be used.

Parameters.

s

Definition of the path in Red Hat Database syntax.

Throws:

obj

SQLException on conversion failure.