+++ /dev/null
-Modifications done since 6.3.2 was released and Sun Aug 30 11:33:06 BST 1998
-
- - Fixed PreparedStatement.setObject as it didn't handle shorts
- - ResultSet.getDate() now handles null dates (returns null ratrher
- than a NullPointerException)
- - ResultSetMetaData.getPrecision() new returns 0 for VARCHAR
- - Field now caches the typename->oid in a Hashtable to speed things
- up. It removes the need for some unnecessary queries to the backend.
- - PreparedStatement.toString() now returns the SQL statement that it
- will send to the backend. Before it did nothing.
- - DatabaseMetaData.getTypeInfo() now does something.
- - Connection now throws an exception if either of the user or password
- properties are missing, as they are required for JDBC to work.
- This occasionally occurs when the client uses the properties version
- of getConnection(), and is a common question on the email lists.
-
-Sun Aug 30 11:33:06 BST 1998
-
- - Created ChangeLog file, and entered stuff done since 6.3.2 and today
- - Change version number to 6.4 in Driver.java
- - Added fix to DatabaseMetaData.getTables() submitted by
- Stefan Andreasen <stefan@linux.kapow.dk>
- - Added fix to DatabaseMetaData.getColumns() to handle patterns
- submitted by Stefan Andreasen <stefan@linux.kapow.dk>
- - Set TcpNoDelay on the connection, as this gives us a 10x speed
- improvement on FreeBSD (caused by a bug in their TCP Stack). They
- should fix the bug before 6.4 is released, but will keep this
- in here unless it causes more problems.
- Submitted by Jason Venner <jason@idiom.com>
- - Removed a duplicate definition of fieldCache
- - Added a more meaningful message when the connection is refused. It
- now says:
- Connection refused. Check that the hostname and port is
- correct, and that the postmaster is running with the -i flag,
- which enables TCP/IP networking.
- - Removed kludge in PreparedStatement.setDate() that acted as a
- temporary fix to a bug in SimpleDateFormat, as it broke date
- handling in JDK 1.1.6.
- - Modified PG_Stream and Connection, so that outbound data is now
- buffered. This should give us a speed improvement, and reduce the
- ammount of network packets generated.
- - Removed duplicate code and optimised PG_Stream.
- - PG_Stream now returns a more meaningful message when the connection
- is broken by the backend. It now returns:
- The backend has broken the connection. Possibly the action you
- have attempted has caused it to close.
- - Removed obsolete code from Connection.
- - The error message returned when the authentication scheme is unknown
- has been extended. It now reads:
- Authentication type ### not supported. Check that you have
- configured the pg_hba.conf file to include the client's IP
- address or Subnet, and is using a supported authentication
- scheme.
- - Connection.getMetaData() now caches the instance returned, so
- multiple calls will return the same instance.
- - Created a test application that tests the DatabaseMetaData and
- ResultSetMetaData classes.
- - Replaced getString(#).getBytes() with getBytes(#) which should speed
- things up, and reduce memory useage.
- - Optimised DatabaseMetaData.getProcedures(), and implemented patterns
- - Fixed NullPointerExceptions thrown when a field is null (Internal
- to the driver, not caused by results from the backend.
- DatabaseMetaData.getProcedures() is an example of a method that
- causes this):
- - ResultSetMetaData.getColumnName() now returns field# where
- # is the column name.
- - ResultSet.getObject() fixed
- - Fixed bug in psql example that was affected by null fields
- - DatabaseMetaData.getTables()
- - DatabaseMetaData.getPrimaryKeys() ran a query with an ambiguous field
- fixed.
- - getTypeInfo() optimised to increase speed and reduce memory useage
- - ResultSetMetaData.isCurrency() optimised and is now smaller.
- - Removed unnecessary code fromResultSetMetaData.getCatalogName()
- and getSchemaName().
- - Created new class postgresql.util.PGmoney to map the money type
- - Created new class postgresql.geometric.PGline to map the line type
-
\ No newline at end of file
+++ /dev/null
-package postgresql;
-
-import java.lang.*;
-import java.sql.*;
-import java.util.*;
-import postgresql.*;
-
-/**
- * postgresql.PG_Object is a class used to describe unknown types
- * An unknown type is any type that is unknown by JDBC Standards
- *
- * @version 1.0 15-APR-1997
- * @author <A HREF="mailto:adrian@hottub.org">Adrian Hall</A>
- */
-public class PG_Object
-{
- public String type;
- public String value;
-
- /**
- * Constructor for the PostgreSQL generic object
- *
- * @param type a string describing the type of the object
- * @param value a string representation of the value of the object
- */
- public PG_Object(String type, String value) throws SQLException
- {
- this.type = type;
- this.value = value;
- }
-
- /**
- * This returns true if the object is a 'box'
- */
- public boolean isBox()
- {
- return type.equals("box");
- }
-
- /**
- * This returns a PGbox object, or null if it's not
- * @return PGbox
- */
- public PGbox getBox() throws SQLException
- {
- if(isBox())
- return new PGbox(value);
- return null;
- }
-
- /**
- * This returns true if the object is a 'point'
- */
- public boolean isCircle()
- {
- return type.equals("circle");
- }
-
- /**
- * This returns a PGcircle object, or null if it's not
- * @return PGcircle
- */
- public PGcircle getCircle() throws SQLException
- {
- if(isCircle())
- return new PGcircle(value);
- return null;
- }
-
- /**
- * This returns true if the object is a 'lseg' (line segment)
- */
- public boolean isLseg()
- {
- return type.equals("lseg");
- }
-
- /**
- * This returns a PGlsegobject, or null if it's not
- * @return PGlseg
- */
- public PGlseg getLseg() throws SQLException
- {
- if(isLseg())
- return new PGlseg(value);
- return null;
- }
-
- /**
- * This returns true if the object is a 'path'
- */
- public boolean isPath()
- {
- return type.equals("path");
- }
-
- /**
- * This returns a PGpath object, or null if it's not
- * @return PGpath
- */
- public PGpath getPath() throws SQLException
- {
- if(isPath())
- return new PGpath(value);
- return null;
- }
-
- /**
- * This returns true if the object is a 'point'
- */
- public boolean isPoint()
- {
- return type.equals("point");
- }
-
- /**
- * This returns a PGpoint object, or null if it's not
- * @return PGpoint object
- */
- public PGpoint getPoint() throws SQLException
- {
- if(isPoint())
- return new PGpoint(value);
- return null;
- }
-
- /**
- * This returns true if the object is a 'polygon'
- */
- public boolean isPolygon()
- {
- return type.equals("polygon");
- }
-
- /**
- * This returns a PGpolygon object, or null if it's not
- * @return PGpolygon
- */
- public PGpolygon getPolygon() throws SQLException
- {
- if(isPolygon())
- return new PGpolygon(value);
- return null;
- }
-}
+++ /dev/null
-/**
- * @version 6.2
- *
- * This implements a box consisting of two points
- *
- */
-
-package postgresql;
-
-import java.io.*;
-import java.sql.*;
-
-public class PGbox implements Serializable
-{
- /**
- * These are the two points.
- */
- public PGpoint point[] = new PGpoint[2];
-
- public PGbox(double x1,double y1,double x2,double y2)
- {
- this.point[0] = new PGpoint(x1,y1);
- this.point[1] = new PGpoint(x2,y2);
- }
-
- public PGbox(PGpoint p1,PGpoint p2)
- {
- this.point[0] = p1;
- this.point[1] = p2;
- }
-
- /**
- * This constructor is used by the driver.
- */
- public PGbox(String s) throws SQLException
- {
- PGtokenizer t = new PGtokenizer(s,',');
- if(t.getSize() != 2)
- throw new SQLException("conversion of box failed - "+s);
-
- point[0] = new PGpoint(t.getToken(0));
- point[1] = new PGpoint(t.getToken(1));
- }
-
- public boolean equals(Object obj)
- {
- PGbox p = (PGbox)obj;
- return (p.point[0].equals(point[0]) && p.point[1].equals(point[1])) ||
- (p.point[0].equals(point[1]) && p.point[1].equals(point[0]));
- }
-
- /**
- * This returns the lseg in the syntax expected by postgresql
- */
- public String toString()
- {
- return point[0].toString()+","+point[1].toString();
- }
-}
+++ /dev/null
-/**
- *
- * This implements a circle consisting of a point and a radius
- *
- */
-
-package postgresql;
-
-import java.io.*;
-import java.sql.*;
-
-public class PGcircle implements Serializable
-{
- /**
- * This is the centre point
- */
- public PGpoint center;
-
- /**
- * This is the radius
- */
- double radius;
-
- public PGcircle(double x,double y,double r)
- {
- this.center = new PGpoint(x,y);
- this.radius = r;
- }
-
- public PGcircle(PGpoint c,double r)
- {
- this.center = c;
- this.radius = r;
- }
-
- public PGcircle(PGcircle c)
- {
- this.center = new PGpoint(c.center);
- this.radius = c.radius;
- }
-
- /**
- * This constructor is used by the driver.
- */
- public PGcircle(String s) throws SQLException
- {
- PGtokenizer t = new PGtokenizer(PGtokenizer.removeAngle(s),',');
- if(t.getSize() != 2)
- throw new SQLException("conversion of circle failed - "+s);
-
- try {
- center = new PGpoint(t.getToken(0));
- radius = Double.valueOf(t.getToken(1)).doubleValue();
- } catch(NumberFormatException e) {
- throw new SQLException("conversion of circle failed - "+s+" - +"+e.toString());
- }
- }
-
- public boolean equals(Object obj)
- {
- PGcircle p = (PGcircle)obj;
- return p.center.equals(center) && p.radius==radius;
- }
-
- /**
- * This returns the circle in the syntax expected by postgresql
- */
- public String toString()
- {
- return "<"+center+","+radius+">";
- }
-}
+++ /dev/null
-/**
- *
- * This implements a lseg (line segment) consisting of two points
- *
- */
-
-package postgresql;
-
-import java.io.*;
-import java.sql.*;
-
-public class PGlseg implements Serializable
-{
- /**
- * These are the two points.
- */
- public PGpoint point[] = new PGpoint[2];
-
- public PGlseg(double x1,double y1,double x2,double y2)
- {
- this.point[0] = new PGpoint(x1,y1);
- this.point[1] = new PGpoint(x2,y2);
- }
-
- public PGlseg(PGpoint p1,PGpoint p2)
- {
- this.point[0] = p1;
- this.point[1] = p2;
- }
-
- /**
- * This constructor is used by the driver.
- */
- public PGlseg(String s) throws SQLException
- {
- PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s),',');
- if(t.getSize() != 2)
- throw new SQLException("conversion of lseg failed - "+s);
-
- point[0] = new PGpoint(t.getToken(0));
- point[1] = new PGpoint(t.getToken(1));
- }
-
- public boolean equals(Object obj)
- {
- PGlseg p = (PGlseg)obj;
- return (p.point[0].equals(point[0]) && p.point[1].equals(point[1])) ||
- (p.point[0].equals(point[1]) && p.point[1].equals(point[0]));
- }
-
- /**
- * This returns the lseg in the syntax expected by postgresql
- */
- public String toString()
- {
- return "["+point[0]+","+point[1]+"]";
- }
-}
+++ /dev/null
-/**
- *
- * This implements a path (a multiple segmented line, which may be closed)
- *
- */
-
-package postgresql;
-
-import java.io.*;
-import java.sql.*;
-
-public class PGpath implements Serializable
-{
- public int npoints;
- public boolean open;
- public PGpoint point[];
-
- public PGpath(int num,PGpoint[] points,boolean open)
- {
- npoints = num;
- this.point = points;
- this.open = open;
- }
-
- /**
- * This constructor is used by the driver.
- */
- public PGpath(String s) throws SQLException
- {
- // First test to see if were open
- if(s.startsWith("[") && s.endsWith("]")) {
- open = true;
- s = PGtokenizer.removeBox(s);
- } else if(s.startsWith("(") && s.endsWith(")")) {
- open = false;
- s = PGtokenizer.removePara(s);
- } else
- throw new SQLException("cannot tell if path is open or closed");
-
- PGtokenizer t = new PGtokenizer(s,',');
- npoints = t.getSize();
- point = new PGpoint[npoints];
- for(int p=0;p<npoints;p++)
- point[p] = new PGpoint(t.getToken(p));
- }
-
- public boolean equals(Object obj)
- {
- PGpath p = (PGpath)obj;
-
- if(p.npoints != npoints)
- return false;
-
- if(p.open != open)
- return false;
-
- for(int i=0;i<npoints;i++)
- if(!point[i].equals(p.point[i]))
- return false;
-
- return true;
- }
-
- /**
- * This returns the polygon in the syntax expected by postgresql
- */
- public String toString()
- {
- StringBuffer b = new StringBuffer(open?"[":"(");
-
- for(int p=0;p<npoints;p++)
- b.append(point[p].toString());
-
- b.append(open?"]":")");
-
- return b.toString();
- }
-
- public boolean isOpen()
- {
- return open;
- }
-
- public boolean isClosed()
- {
- return !open;
- }
-
- public void closePath()
- {
- open = false;
- }
-
- public void openPath()
- {
- open = true;
- }
-
-}
+++ /dev/null
-/**
- *
- * This implements a version of java.awt.Point, except it uses double
- * to represent the coordinates.
- *
- * It maps to the point datatype in postgresql.
- */
-
-package postgresql;
-
-import java.awt.Point;
-import java.io.*;
-import java.sql.*;
-
-public class PGpoint implements Serializable
-{
- /**
- * These are the coordinates.
- * These are public, because their equivalents in java.awt.Point are
- */
- public double x,y;
-
- public PGpoint(double x,double y)
- {
- this.x = x;
- this.y = y;
- }
-
- public PGpoint(PGpoint p)
- {
- this(p.x,p.y);
- }
-
- /**
- * This constructor is used by the driver.
- */
- public PGpoint(String s) throws SQLException
- {
- PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s),',');
- try {
- x = Double.valueOf(t.getToken(0)).doubleValue();
- y = Double.valueOf(t.getToken(1)).doubleValue();
- } catch(NumberFormatException e) {
- throw new SQLException("conversion of point failed - "+e.toString());
- }
- }
-
- public boolean equals(Object obj)
- {
- PGpoint p = (PGpoint)obj;
- return x == p.x && y == p.y;
- }
-
- /**
- * This returns the point in the syntax expected by postgresql
- */
- public String toString()
- {
- return "("+x+","+y+")";
- }
-
- public void translate(int x,int y)
- {
- translate((double)x,(double)y);
- }
-
- public void translate(double x,double y)
- {
- this.x += x;
- this.y += y;
- }
-
- public void move(int x,int y)
- {
- setLocation(x,y);
- }
-
- public void move(double x,double y)
- {
- this.x = x;
- this.y = y;
- }
-
- // refer to java.awt.Point for description of this
- public void setLocation(int x,int y)
- {
- move((double)x,(double)y);
- }
-
- // refer to java.awt.Point for description of this
- public void setLocation(Point p)
- {
- setLocation(p.x,p.y);
- }
-
-}
+++ /dev/null
-/**
- *
- * This implements a polygon (based on java.awt.Polygon)
- *
- */
-
-package postgresql;
-
-import java.io.*;
-import java.sql.*;
-
-public class PGpolygon implements Serializable
-{
- public int npoints;
-
- public PGpoint point[];
-
- public PGpolygon(int num,PGpoint[] points)
- {
- npoints = num;
- this.point = points;
- }
-
- /**
- * This constructor is used by the driver.
- */
- public PGpolygon(String s) throws SQLException
- {
- PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s),',');
- npoints = t.getSize();
- point = new PGpoint[npoints];
- for(int p=0;p<npoints;p++)
- point[p] = new PGpoint(t.getToken(p));
- }
-
- public boolean equals(Object obj)
- {
- PGpolygon p = (PGpolygon)obj;
-
- if(p.npoints != npoints)
- return false;
-
- for(int i=0;i<npoints;i++)
- if(!point[i].equals(p.point[i]))
- return false;
-
- return true;
- }
-
- /**
- * This returns the polygon in the syntax expected by postgresql
- */
- public String toString()
- {
- StringBuffer b = new StringBuffer();
- for(int p=0;p<npoints;p++)
- b.append(point[p].toString());
- return b.toString();
- }
-}
+++ /dev/null
-/**
- *
- * This class is used to tokenize the text output of postgres.
- *
- */
-
-package postgresql;
-
-import java.sql.*;
-import java.util.*;
-
-public class PGtokenizer
-{
- protected Vector tokens;
-
- public PGtokenizer(String string,char delim)
- {
- tokenize(string,delim);
- }
-
- /**
- * Tokenizes a new string
- */
- public int tokenize(String string,char delim)
- {
- tokens = new Vector();
-
- int nest=0,p,s;
- for(p=0,s=0;p<string.length();p++) {
- char c = string.charAt(p);
-
- // increase nesting if an open character is found
- if(c == '(' || c == '[')
- nest++;
-
- // decrease nesting if a close character is found
- if(c == ')' || c == ']')
- nest--;
-
- if(nest==0 && c==delim) {
- tokens.addElement(string.substring(s,p));
- s=p+1; // +1 to skip the delimiter
- }
-
- }
-
- // Don't forget the last token ;-)
- if(s<string.length())
- tokens.addElement(string.substring(s));
-
- return tokens.size();
- }
-
- public int getSize()
- {
- return tokens.size();
- }
-
- public String getToken(int n)
- {
- return (String)tokens.elementAt(n);
- }
-
- /**
- * This returns a new tokenizer based on one of our tokens
- */
- public PGtokenizer tokenizeToken(int n,char delim)
- {
- return new PGtokenizer(getToken(n),delim);
- }
-
- /**
- * This removes the lead/trailing strings from a string
- */
- public static String remove(String s,String l,String t)
- {
- if(s.startsWith(l)) s = s.substring(l.length());
- if(s.endsWith(t)) s = s.substring(0,s.length()-t.length());
- return s;
- }
-
- /**
- * This removes the lead/trailing strings from all tokens
- */
- public void remove(String l,String t)
- {
- for(int i=0;i<tokens.size();i++) {
- tokens.setElementAt(remove((String)tokens.elementAt(i),l,t),i);
- }
- }
-
- public static String removePara(String s) {return remove(s,"(",")");}
- public void removePara() {remove("(",")");}
-
- public static String removeBox(String s) {return remove(s,"[","]");}
- public void removeBox() {remove("[","]");}
-
- public static String removeAngle(String s) {return remove(s,"<",">");}
- public void removeAngle() {remove("<",">");}
-}