Commit 6ee060f2 authored by Barry Lind's avatar Barry Lind

Cleanup and reorganization.

  - Added a private api layer (org.postgresql.core.Base*)
  - Cleaned up public api (org.postgresql.PG*)
  - Added consistent headers and copywrite info
  - Removed deprecated Serialize functionality
  - Cleaned up imports
  - Moved some files to more appropriate locations

 Modified Files:
 	jdbc/org/postgresql/Driver.java.in
 	jdbc/org/postgresql/PGConnection.java
 	jdbc/org/postgresql/PGNotification.java
 	jdbc/org/postgresql/PGStatement.java
 	jdbc/org/postgresql/core/Encoding.java
 	jdbc/org/postgresql/core/Notification.java
 	jdbc/org/postgresql/core/QueryExecutor.java
 	jdbc/org/postgresql/core/StartupPacket.java
 	jdbc/org/postgresql/fastpath/Fastpath.java
 	jdbc/org/postgresql/fastpath/FastpathArg.java
 	jdbc/org/postgresql/geometric/PGbox.java
 	jdbc/org/postgresql/geometric/PGcircle.java
 	jdbc/org/postgresql/geometric/PGline.java
 	jdbc/org/postgresql/geometric/PGlseg.java
 	jdbc/org/postgresql/geometric/PGpath.java
 	jdbc/org/postgresql/geometric/PGpoint.java
 	jdbc/org/postgresql/geometric/PGpolygon.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
 	jdbc/org/postgresql/jdbc1/Jdbc1CallableStatement.java
 	jdbc/org/postgresql/jdbc1/Jdbc1Connection.java
 	jdbc/org/postgresql/jdbc1/Jdbc1DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java
 	jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java
 	jdbc/org/postgresql/jdbc1/Jdbc1ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc1/Jdbc1Statement.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2Blob.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2Clob.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
 	jdbc/org/postgresql/jdbc2/Array.java
 	jdbc/org/postgresql/jdbc2/Jdbc2CallableStatement.java
 	jdbc/org/postgresql/jdbc2/Jdbc2Connection.java
 	jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java
 	jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java
 	jdbc/org/postgresql/jdbc2/Jdbc2ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc2/Jdbc2Statement.java
 	jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
 	jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java
 	jdbc/org/postgresql/jdbc3/Jdbc3Connection.java
 	jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java
 	jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java
 	jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc3/Jdbc3Statement.java
 	jdbc/org/postgresql/largeobject/BlobInputStream.java
 	jdbc/org/postgresql/largeobject/BlobOutputStream.java
 	jdbc/org/postgresql/largeobject/LargeObject.java
 	jdbc/org/postgresql/largeobject/LargeObjectManager.java
 	jdbc/org/postgresql/test/jdbc2/Jdbc2TestSuite.java
 	jdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java
 	jdbc/org/postgresql/util/MD5Digest.java
 	jdbc/org/postgresql/util/MessageTranslator.java
 	jdbc/org/postgresql/util/PGbytea.java
 	jdbc/org/postgresql/util/PGmoney.java
 	jdbc/org/postgresql/util/PGobject.java
 	jdbc/org/postgresql/util/PGtokenizer.java
 	jdbc/org/postgresql/util/PSQLException.java
 	jdbc/org/postgresql/util/UnixCrypt.java
 Added Files:
 	jdbc/org/postgresql/core/BaseConnection.java
 	jdbc/org/postgresql/core/BaseResultSet.java
 	jdbc/org/postgresql/core/BaseStatement.java
 	jdbc/org/postgresql/core/Field.java
 	jdbc/org/postgresql/core/PGStream.java
 Removed Files:
 	jdbc/org/postgresql/Field.java
 	jdbc/org/postgresql/PG_Stream.java
 	jdbc/org/postgresql/test/jdbc2/SerializeObject.java
 	jdbc/org/postgresql/test/jdbc2/SerializeTest.java
 	jdbc/org/postgresql/util/Serialize.java
parent 2e6887df
/*-------------------------------------------------------------------------
*
* Driver.java(.in)
* The Postgresql JDBC Driver implementation
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.27 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql;
import java.io.*;
......@@ -22,7 +34,7 @@ import org.postgresql.util.PSQLException;
* and register it with the DriverManager. This means that a user can load
* and register a driver by doing Class.forName("foo.bah.Driver")
*
* @see org.postgresql.Connection
* @see org.postgresql.PGConnection
* @see java.sql.Driver
*/
public class Driver implements java.sql.Driver
......@@ -460,7 +472,7 @@ public class Driver implements java.sql.Driver
}
public static void makeSSL(PG_Stream p_stream) throws IOException {
public static void makeSSL(org.postgresql.core.PGStream p_stream) throws IOException {
@SSL@ if (logDebug)
@SSL@ debug("converting regular socket connection to ssl");
@SSL@ javax.net.ssl.SSLSocketFactory factory = (javax.net.ssl.SSLSocketFactory) javax.net.ssl.SSLSocketFactory.getDefault();
......@@ -477,6 +489,6 @@ public class Driver implements java.sql.Driver
//The build number should be incremented for every new build
private static int m_buildNumber = 202;
private static int m_buildNumber = 203;
}
/*-------------------------------------------------------------------------
*
* PGConnection.java
* The public interface definition for a Postgresql Connection
* This interface defines PostgreSQL extentions to the java.sql.Connection
* interface. Any java.sql.Connection object returned by the driver will
* also implement this interface
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.4 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql;
import java.sql.*;
......@@ -7,75 +22,46 @@ import org.postgresql.core.Encoding;
import org.postgresql.fastpath.Fastpath;
import org.postgresql.largeobject.LargeObjectManager;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGConnection.java,v 1.3 2002/09/06 21:23:05 momjian Exp $
* This interface defines PostgreSQL extentions to the java.sql.Connection interface.
* Any java.sql.Connection object returned by the driver will also implement this
* interface
*/
public interface PGConnection
{
/*
* Get the character encoding to use for this connection.
*/
public Encoding getEncoding() throws SQLException;
/*
* This method returns the java.sql.Types type for a postgres datatype name
*/
public int getSQLType(String pgTypeName) throws SQLException;
/*
* This returns the java.sql.Types type for a postgres datatype OID
*/
public int getSQLType(int oid) throws SQLException;
/*
* This returns the postgres datatype name from the
* postgres datatype OID
*/
public String getPGType(int oid) throws SQLException;
/*
* This returns the postgres datatype OID from the
* postgres datatype name
/**
* This method returns any notifications that have been received
* since the last call to this method.
* Returns null if there have been no notifications.
* @since 7.3
*/
public int getPGType(String typeName) throws SQLException;
public PGNotification[] getNotifications();
/*
/**
* This returns the LargeObject API for the current connection.
* @since 7.3
*/
public LargeObjectManager getLargeObjectAPI() throws SQLException;
/*
/**
* This returns the Fastpath API for the current connection.
* @since 7.3
*/
public Fastpath getFastpathAPI() throws SQLException;
/*
* This method is used internally to return an object based around
* org.postgresql's more unique data types.
*
* <p>It uses an internal Hashtable to get the handling class. If the
* type is not supported, then an instance of org.postgresql.util.PGobject
* is returned.
*
* You can use the getValue() or setValue() methods to handle the returned
* object. Custom objects can have their own methods.
*
* @return PGobject for this type, and set to value
* @exception SQLException if value is not correct for this type
* @see org.postgresql.util.Serialize
*/
public Object getObject(String type, String value) throws SQLException;
/** @deprecated */
public Encoding getEncoding() throws SQLException;
/*
* This method returns any notifications that have been received
* since the last call to this method.
* Returns null if there have been no notifications.
*/
public PGNotification[] getNotifications();
/** @deprecated */
public int getSQLType(String pgTypeName) throws SQLException;
/** @deprecated */
public int getSQLType(int oid) throws SQLException;
/** @deprecated */
public String getPGType(int oid) throws SQLException;
/** @deprecated */
public int getPGType(String typeName) throws SQLException;
/** @deprecated */
public Object getObject(String type, String value) throws SQLException;
}
/*-------------------------------------------------------------------------
*
* PGNotification.java
* This interface defines public PostgreSQL extention for Notifications
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGNotification.java,v 1.3 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGNotification.java,v 1.2 2002/09/06 21:23:05 momjian Exp $
* This interface defines PostgreSQL extention for Notifications
*/
public interface PGNotification
{
/*
/**
* Returns name of this notification
* @since 7.3
*/
public String getName();
/*
/**
* Returns the process id of the backend process making this notification
* @since 7.3
*/
public int getPID();
......
/*-------------------------------------------------------------------------
*
* PGStatement.java
* This interface defines PostgreSQL extentions to the java.sql.Statement
* interface. Any java.sql.Statement object returned by the driver will
* also implement this interface
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGStatement.java,v 1.7 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql;
import java.sql.*;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/PGStatement.java,v 1.6 2002/09/08 00:15:28 barry Exp $
* This interface defines PostgreSQL extentions to the java.sql.Statement interface.
* Any java.sql.Statement object returned by the driver will also implement this
* interface
*/
public interface PGStatement
{
/*
/**
* Returns the Last inserted/updated oid.
* @return OID of last insert
* @since 7.3
*/
public long getLastOID() throws SQLException;
/**
* Turn on the use of prepared statements in the server (server side
* prepared statements are unrelated to jdbc PreparedStatements)
* @since 7.3
*/
public void setUseServerPrepare(boolean flag) throws SQLException;
/**
* Is this statement using server side prepared statements
* @since 7.3
*/
public boolean isUseServerPrepare();
}
/*-------------------------------------------------------------------------
*
* BaseConnection.java
* The internal interface definition for a jdbc connection
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseConnection.java,v 1.1 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.core;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.SQLException;
import org.postgresql.PGConnection;
import org.postgresql.PGNotification;
public interface BaseConnection extends PGConnection
{
public void addNotification(PGNotification p_notification);
public void addWarning(String msg);
public void cancelQuery() throws SQLException;
public Statement createStatement() throws SQLException;
public BaseResultSet execSQL(String s) throws SQLException;
public String getCursorName() throws SQLException;
public Encoding getEncoding() throws SQLException;
public DatabaseMetaData getMetaData() throws SQLException;
public Object getObject(String type, String value) throws SQLException;
public PGStream getPGStream();
public String getPGType(int oid) throws SQLException;
public int getPGType(String pgTypeName) throws SQLException;
public int getSQLType(int oid) throws SQLException;
public int getSQLType(String pgTypeName) throws SQLException;
public boolean haveMinimumCompatibleVersion(String ver) throws SQLException;
public boolean haveMinimumServerVersion(String ver) throws SQLException;
public void setCursorName(String cursor) throws SQLException;
}
/*-------------------------------------------------------------------------
*
* BaseResultSet.java
* The internal interface definition for a jdbc result set
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseResultSet.java,v 1.1 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.core;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Vector;
public interface BaseResultSet
{
public BaseStatement getPGStatement();
public void append(BaseResultSet r);
public void close() throws SQLException;
public int getColumnCount();
public String getCursorName() throws SQLException;
public String getFixedString(int col) throws SQLException;
public long getLastOID();
public ResultSetMetaData getMetaData() throws SQLException;
public ResultSet getNext();
public Object getObject(int columnIndex) throws SQLException;
public int getResultCount();
public String getStatusString();
public String getString(int columnIndex) throws SQLException;
public StringBuffer getStringBuffer();
public int getTupleCount();
public boolean next() throws SQLException;
public boolean reallyResultSet();
public void reInit (Field[] fields, Vector tuples, String status,
int updateCount, long insertOID, boolean binaryCursor);
public void setStatement(BaseStatement statement);
}
/*-------------------------------------------------------------------------
*
* BaseStatement.java
* The internal interface definition for a jdbc statement
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseStatement.java,v 1.1 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.core;
import java.sql.*;
import java.util.Vector;
public interface BaseStatement extends org.postgresql.PGStatement
{
public BaseResultSet createResultSet(Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException;
public BaseConnection getPGConnection();
/*
* The maxRows limit is set to limit the number of rows that
* any ResultSet can contain. If the limit is exceeded, the
* excess rows are silently dropped.
*/
public int getFetchSize() throws SQLException;
public int getMaxRows() throws SQLException;
public int getResultSetConcurrency() throws SQLException;
public String getStatementName();
}
package org.postgresql.core;
import java.io.*;
import java.util.*;
import java.sql.SQLException;
import org.postgresql.util.*;
/*
/*-------------------------------------------------------------------------
*
* Encoding.java
* Converts to and from the character encoding used by the backend.
*
* $Id: Encoding.java,v 1.9 2003/02/09 23:14:55 barry Exp $
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Encoding.java,v 1.10 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.core;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
import java.util.Hashtable;
import org.postgresql.util.PSQLException;
public class Encoding
{
......
package org.postgresql;
/*-------------------------------------------------------------------------
*
* Field.java
* Field is a class used to describe fields in a PostgreSQL ResultSet
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Field.java,v 1.1 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.core;
import java.lang.*;
import java.sql.*;
import java.util.*;
import org.postgresql.*;
import org.postgresql.util.*;
import org.postgresql.core.BaseConnection;
import org.postgresql.util.PSQLException;
/*
* org.postgresql.Field is a class used to describe fields in a PostgreSQL
* ResultSet
*/
public class Field
{
......@@ -17,7 +27,7 @@ public class Field
private int mod; // type modifier of this field
private String name; // Name of this field
private org.postgresql.PGConnection conn; // Connection Instantation
private BaseConnection conn; // Connection Instantation
/*
......@@ -28,7 +38,7 @@ public class Field
* @param oid the OID of the field
* @param len the length of the field
*/
public Field(org.postgresql.PGConnection conn, String name, int oid, int length, int mod)
public Field(BaseConnection conn, String name, int oid, int length, int mod)
{
this.conn = conn;
this.name = name;
......@@ -45,7 +55,7 @@ public class Field
* @param oid the OID of the field
* @param len the length of the field
*/
public Field(org.postgresql.PGConnection conn, String name, int oid, int length)
public Field(BaseConnection conn, String name, int oid, int length)
{
this(conn, name, oid, length, 0);
}
......
/*-------------------------------------------------------------------------
*
* Notification.java
* This is the implementation of the PGNotification interface
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Notification.java,v 1.3 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.core;
import org.postgresql.PGNotification;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Notification.java,v 1.2 2002/09/06 21:23:05 momjian Exp $
* This is the implementation of the PGNotification interface
*/
public class Notification implements org.postgresql.PGNotification
public class Notification implements PGNotification
{
public Notification(String p_name, int p_pid)
{
......
package org.postgresql;
import java.io.*;
import java.lang.*;
import java.net.*;
import java.util.*;
import java.sql.*;
import org.postgresql.*;
import org.postgresql.core.*;
import org.postgresql.util.*;
/*
* $Id: PG_Stream.java,v 1.18 2003/02/27 05:45:44 barry Exp $
/*-------------------------------------------------------------------------
*
* This class is used by Connection & PGlobj for communicating with the
* PGStream.java
* This class is used by Connection for communicating with the
* backend.
*
* @see java.sql.Connection
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/PGStream.java,v 1.1 2003/03/07 18:39:41 barry Exp $
*
*-------------------------------------------------------------------------
*/
// This class handles all the Streamed I/O for a org.postgresql connection
public class PG_Stream
package org.postgresql.core;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.Socket;
import java.sql.*;
import org.postgresql.util.PSQLException;
public class PGStream
{
public String host;
public int port;
......@@ -35,7 +39,7 @@ public class PG_Stream
* @param port the port number that the postmaster is sitting on
* @exception IOException if an IOException occurs below it.
*/
public PG_Stream(String p_host, int p_port) throws IOException
public PGStream(String p_host, int p_port) throws IOException
{
host = p_host;
port = p_port;
......
/*-------------------------------------------------------------------------
*
* QueryExecutor.java
* Executes a query on the backend.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.20 2003/03/07 18:39:42 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.core;
import java.util.Vector;
import java.io.IOException;
import java.sql.*;
import org.postgresql.*;
import org.postgresql.util.PSQLException;
import org.postgresql.jdbc1.AbstractJdbc1Connection;
import org.postgresql.jdbc1.AbstractJdbc1ResultSet;
import org.postgresql.jdbc1.AbstractJdbc1Statement;
/*
* Executes a query on the backend.
*
* <p>The lifetime of a QueryExecutor object is from sending the query
* until the response has been received from the backend.
*
* $Id: QueryExecutor.java,v 1.19 2003/02/04 11:01:52 davec Exp $
*/
public class QueryExecutor
{
//This version of execute does not take an existing result set, but
//creates a new one for the results of the query
public static ResultSet execute (String[] p_sqlFrags,
public static BaseResultSet execute(String[] p_sqlFrags,
Object[] p_binds,
java.sql.Statement statement)
BaseStatement statement)
throws SQLException
{
QueryExecutor qe = new QueryExecutor();
......@@ -37,8 +38,8 @@ public class QueryExecutor
else
qe.maxRows = 0;
qe.connection = (AbstractJdbc1Connection)((AbstractJdbc1Statement)statement).getPGConnection();
qe.pg_stream = qe.connection.getPGStream();
qe.connection = statement.getPGConnection();
qe.pgStream = qe.connection.getPGStream();
return qe.execute();
}
......@@ -46,23 +47,23 @@ public class QueryExecutor
//This version of execute reuses an existing result set for the query
//results, this is used when a result set is backed by a cursor and
//more results are fetched
public static void execute (String[] p_sqlFrags,
public static void execute(String[] p_sqlFrags,
Object[] p_binds,
java.sql.ResultSet rs)
BaseResultSet rs)
throws SQLException
{
QueryExecutor qe = new QueryExecutor();
qe.m_sqlFrags = p_sqlFrags;
qe.m_binds = p_binds;
qe.rs = rs;
qe.statement = (java.sql.Statement)((AbstractJdbc1ResultSet)qe.rs).getPGStatement();
qe.statement = qe.rs.getPGStatement();
if (qe.statement != null)
qe.maxRows = qe.statement.getMaxRows();
else
qe.maxRows = 0;
qe.connection = (AbstractJdbc1Connection)((AbstractJdbc1Statement)qe.statement).getPGConnection();
qe.pg_stream = qe.connection.getPGStream();
qe.connection = qe.statement.getPGConnection();
qe.pgStream = qe.connection.getPGStream();
qe.execute();
}
......@@ -74,11 +75,11 @@ public class QueryExecutor
private String[] m_sqlFrags;
private Object[] m_binds;
private java.sql.Statement statement;
private java.sql.ResultSet rs;
private BaseStatement statement;
private BaseResultSet rs;
private AbstractJdbc1Connection connection;
private PG_Stream pg_stream;
private BaseConnection connection;
private PGStream pgStream;
private Field[] fields = null;
private Vector tuples = new Vector();
......@@ -93,17 +94,17 @@ public class QueryExecutor
* Execute a query on the backend.
*
*/
private java.sql.ResultSet execute() throws SQLException
private BaseResultSet execute() throws SQLException
{
StringBuffer errorMessage = null;
if (pg_stream == null)
if (pgStream == null)
{
throw new PSQLException("postgresql.con.closed");
}
synchronized (pg_stream)
synchronized (pgStream)
{
sendQuery();
......@@ -112,13 +113,13 @@ public class QueryExecutor
boolean l_endQuery = false;
while (!l_endQuery)
{
c = pg_stream.ReceiveChar();
c = pgStream.ReceiveChar();
switch (c)
{
case 'A': // Asynchronous Notify
int pid = pg_stream.ReceiveInteger(4);
String msg = pg_stream.ReceiveString(connection.getEncoding());
int pid = pgStream.ReceiveInteger(4);
String msg = pgStream.ReceiveString(connection.getEncoding());
connection.addNotification(new org.postgresql.core.Notification(msg, pid));
break;
case 'B': // Binary Data Transfer
......@@ -140,17 +141,17 @@ public class QueryExecutor
if ( errorMessage == null )
errorMessage = new StringBuffer();
errorMessage.append(pg_stream.ReceiveString(connection.getEncoding()));
errorMessage.append(pgStream.ReceiveString(connection.getEncoding()));
// keep processing
break;
case 'I': // Empty Query
int t = pg_stream.ReceiveChar();
int t = pgStream.ReceiveChar();
break;
case 'N': // Error Notification
connection.addWarning(pg_stream.ReceiveString(connection.getEncoding()));
connection.addWarning(pgStream.ReceiveString(connection.getEncoding()));
break;
case 'P': // Portal Name
String pname = pg_stream.ReceiveString(connection.getEncoding());
String pname = pgStream.ReceiveString(connection.getEncoding());
break;
case 'T': // MetaData Field Description
receiveFields();
......@@ -174,11 +175,11 @@ public class QueryExecutor
//create a new one
if (rs != null)
{
((org.postgresql.jdbc1.AbstractJdbc1ResultSet)rs).reInit(fields, tuples, status, update_count, insert_oid, binaryCursor);
rs.reInit(fields, tuples, status, update_count, insert_oid, binaryCursor);
}
else
{
rs = ((AbstractJdbc1Statement)statement).createResultSet(fields, tuples, status, update_count, insert_oid, binaryCursor);
rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid, binaryCursor);
}
return rs;
}
......@@ -196,16 +197,16 @@ public class QueryExecutor
}
try
{
pg_stream.SendChar('Q');
pgStream.SendChar('Q');
for (int i = 0 ; i < m_binds.length ; ++i)
{
pg_stream.Send(connection.getEncoding().encode(m_sqlFrags[i]));
pg_stream.Send(connection.getEncoding().encode(m_binds[i].toString()));
pgStream.Send(connection.getEncoding().encode(m_sqlFrags[i]));
pgStream.Send(connection.getEncoding().encode(m_binds[i].toString()));
}
pg_stream.Send(connection.getEncoding().encode(m_sqlFrags[m_binds.length]));
pg_stream.SendChar(0);
pg_stream.flush();
pgStream.Send(connection.getEncoding().encode(m_sqlFrags[m_binds.length]));
pgStream.SendChar(0);
pgStream.flush();
}
catch (IOException e)
......@@ -223,7 +224,7 @@ public class QueryExecutor
{
if (fields == null)
throw new PSQLException("postgresql.con.tuple");
Object tuple = pg_stream.ReceiveTuple(fields.length, isBinary);
Object tuple = pgStream.ReceiveTuple(fields.length, isBinary);
if (isBinary)
binaryCursor = true;
if (maxRows == 0 || tuples.size() < maxRows)
......@@ -236,7 +237,7 @@ public class QueryExecutor
private void receiveCommandStatus() throws SQLException
{
status = pg_stream.ReceiveString(connection.getEncoding());
status = pgStream.ReceiveString(connection.getEncoding());
try
{
......@@ -265,15 +266,15 @@ public class QueryExecutor
if (fields != null)
throw new PSQLException("postgresql.con.multres");
int size = pg_stream.ReceiveIntegerR(2);
int size = pgStream.ReceiveIntegerR(2);
fields = new Field[size];
for (int i = 0; i < fields.length; i++)
{
String typeName = pg_stream.ReceiveString(connection.getEncoding());
int typeOid = pg_stream.ReceiveIntegerR(4);
int typeLength = pg_stream.ReceiveIntegerR(2);
int typeModifier = pg_stream.ReceiveIntegerR(4);
String typeName = pgStream.ReceiveString(connection.getEncoding());
int typeOid = pgStream.ReceiveIntegerR(4);
int typeLength = pgStream.ReceiveIntegerR(2);
int typeModifier = pgStream.ReceiveIntegerR(4);
fields[i] = new Field(connection, typeName, typeOid, typeLength, typeModifier);
}
}
......
package org.postgresql.core;
import org.postgresql.PG_Stream;
import java.io.IOException;
/**
* Sent to the backend to initialize a newly created connection.
*
* $Id: StartupPacket.java,v 1.2 2002/09/06 21:23:05 momjian Exp $
* $Id: StartupPacket.java,v 1.3 2003/03/07 18:39:42 barry Exp $
*/
public class StartupPacket
......@@ -30,7 +29,7 @@ public class StartupPacket
this.database = database;
}
public void writeTo(PG_Stream stream) throws IOException
public void writeTo(PGStream stream) throws IOException
{
stream.SendInteger(4 + 4 + SM_DATABASE + SM_USER + SM_OPTIONS + SM_UNUSED + SM_TTY, 4);
stream.SendInteger(protocolMajor, 2);
......
/*-------------------------------------------------------------------------
*
* Fastpath.java
* This class implements the Fastpath api.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/fastpath/Attic/Fastpath.java,v 1.12 2003/03/07 18:39:42 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.fastpath;
import java.io.IOException;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.util.Hashtable;
import org.postgresql.Driver;
import java.io.*;
import java.lang.*;
import java.net.*;
import java.util.*;
import java.sql.*;
import org.postgresql.util.*;
// Important: There are a lot of debug code commented out. Please do not
// delete these.
import org.postgresql.core.BaseConnection;
import org.postgresql.core.PGStream;
import org.postgresql.util.PSQLException;
/*
* This class implements the Fastpath api.
*
* <p>This is a means of executing functions imbeded in the org.postgresql backend
* from within a java application.
* <p>This is a means of executing functions imbeded in the org.postgresql
* backend from within a java application.
*
* <p>It is based around the file src/interfaces/libpq/fe-exec.c
*
* @see org.postgresql.FastpathFastpathArg
* @see org.postgresql.LargeObject
*/
public class Fastpath
{
......@@ -28,20 +36,16 @@ public class Fastpath
// to a connection).
protected Hashtable func = new Hashtable();
protected org.postgresql.PGConnection conn; // our connection
protected org.postgresql.PG_Stream stream; // the network stream
protected BaseConnection conn; // our connection
protected PGStream stream; // the network stream
/*
* Initialises the fastpath system
*
* <p><b>Important Notice</b>
* <br>This is called from org.postgresql.Connection, and should not be called
* from client code.
*
* @param conn org.postgresql.Connection to attach to
* @param conn BaseConnection to attach to
* @param stream The network stream to the backend
*/
public Fastpath(org.postgresql.PGConnection conn, org.postgresql.PG_Stream stream)
public Fastpath(BaseConnection conn, PGStream stream)
{
this.conn = conn;
this.stream = stream;
......@@ -113,7 +117,7 @@ public class Fastpath
//------------------------------
// Notice from backend
case 'N':
((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).addWarning(stream.ReceiveString(conn.getEncoding()));
conn.addWarning(stream.ReceiveString(conn.getEncoding()));
break;
case 'V':
......@@ -164,7 +168,7 @@ public class Fastpath
* This is the prefered method to call, as function id's can/may change
* between versions of the backend.
*
* For an example of how this works, refer to org.postgresql.LargeObject
* For an example of how this works, refer to org.postgresql.largeobject.LargeObject
*
* @param name Function name
* @param resulttype True if the result is an integer, false for other
......@@ -173,7 +177,7 @@ public class Fastpath
* @return null if no data, Integer if an integer result, or byte[] otherwise
* @exception SQLException if name is unknown or if a database-access error
* occurs.
* @see org.postgresql.LargeObject
* @see org.postgresql.largeobject.LargeObject
*/
public Object fastpath(String name, boolean resulttype, FastpathArg[] args) throws SQLException
{
......@@ -242,7 +246,7 @@ public class Fastpath
* the function's required are entered into this table, keeping connection
* times as fast as possible.
*
* <p>The org.postgresql.LargeObject class performs a query upon it's startup,
* <p>The org.postgresql.largeobject.LargeObject class performs a query upon it's startup,
* and passes the returned ResultSet to the addFunctions() method here.
*
* <p>Once this has been done, the LargeObject api refers to the functions by
......@@ -255,7 +259,7 @@ public class Fastpath
*
* @param rs ResultSet
* @exception SQLException if a database-access error occurs.
* @see org.postgresql.LargeObjectManager
* @see org.postgresql.largeobject.LargeObjectManager
*/
public void addFunctions(ResultSet rs) throws SQLException
{
......
package org.postgresql.fastpath;
import java.io.*;
import java.lang.*;
import java.net.*;
import java.util.*;
import java.sql.*;
import org.postgresql.util.*;
/*
/*-------------------------------------------------------------------------
*
* FastpathArg.java
* Each fastpath call requires an array of arguments, the number and type
* dependent on the function being called.
*
* <p>This class implements methods needed to provide this capability.
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* <p>For an example on how to use this, refer to the org.postgresql.largeobject
* package
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/fastpath/Attic/FastpathArg.java,v 1.4 2003/03/07 18:39:42 barry Exp $
*
* @see org.postgresql.fastpath.Fastpath
* @see org.postgresql.largeobject.LargeObjectManager
* @see org.postgresql.largeobject.LargeObject
*-------------------------------------------------------------------------
*/
package org.postgresql.fastpath;
import java.io.IOException;
public class FastpathArg
{
/*
......@@ -90,7 +85,7 @@ public class FastpathArg
* @param s output stream
* @exception IOException if something failed on the network stream
*/
protected void send(org.postgresql.PG_Stream s) throws IOException
protected void send(org.postgresql.core.PGStream s) throws IOException
{
if (type)
{
......
/*-------------------------------------------------------------------------
*
* PGbox.java
* This represents the box datatype within org.postgresql.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGbox.java,v 1.4 2003/03/07 18:39:42 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
import java.io.*;
import java.sql.*;
import org.postgresql.util.*;
import java.sql.SQLException;
import java.io.Serializable;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
/*
* This represents the box datatype within org.postgresql.
*/
public class PGbox extends PGobject implements Serializable, Cloneable
{
/*
......
/*-------------------------------------------------------------------------
*
* PGcircle.java
* This represents org.postgresql's circle datatype, consisting of a point
* and a radius
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGcircle.java,v 1.4 2003/03/07 18:39:42 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
import java.io.*;
import java.sql.*;
import org.postgresql.util.*;
import java.io.Serializable;
import java.sql.SQLException;
import java.util.Hashtable;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
/*
* This represents org.postgresql's circle datatype, consisting of a point and
* a radius
*/
public class PGcircle extends PGobject implements Serializable, Cloneable
{
/*
......
/*-------------------------------------------------------------------------
*
* PGline.java
* This implements a line consisting of two points.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGline.java,v 1.4 2003/03/07 18:39:42 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
import java.io.*;
import java.sql.*;
import org.postgresql.util.*;
import java.io.Serializable;
import java.sql.SQLException;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
/*
* This implements a line consisting of two points.
*
* Currently line is not yet implemented in the backend, but this class
* ensures that when it's done were ready for it.
*/
......
/*-------------------------------------------------------------------------
*
* PGlseg.java
* This implements a lseg (line segment) consisting of two points
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGlseg.java,v 1.4 2003/03/07 18:39:42 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
import java.io.*;
import java.sql.*;
import org.postgresql.util.*;
import java.io.Serializable;
import java.sql.SQLException;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
/*
* This implements a lseg (line segment) consisting of two points
*/
public class PGlseg extends PGobject implements Serializable, Cloneable
{
/*
......
/*-------------------------------------------------------------------------
*
* PGpath.java
* This implements a path (a multiple segmented line, which may be closed)
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpath.java,v 1.5 2003/03/07 18:39:42 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
import java.io.*;
import java.sql.*;
import org.postgresql.util.*;
import java.io.Serializable;
import java.sql.SQLException;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
/*
* This implements a path (a multiple segmented line, which may be closed)
*/
public class PGpath extends PGobject implements Serializable, Cloneable
{
/*
......
/*-------------------------------------------------------------------------
*
* PGline.java
* It maps to the point datatype in org.postgresql.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpoint.java,v 1.4 2003/03/07 18:39:43 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
import java.awt.Point;
import java.io.*;
import java.sql.*;
import java.io.Serializable;
import java.sql.SQLException;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
import org.postgresql.util.*;
/*
* This implements a version of java.awt.Point, except it uses double
* to represent the coordinates.
*
* <p>It maps to the point datatype in org.postgresql.
*/
public class PGpoint extends PGobject implements Serializable, Cloneable
{
......
/*-------------------------------------------------------------------------
*
* PGline.java
* This implements the polygon datatype within PostgreSQL.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpolygon.java,v 1.4 2003/03/07 18:39:43 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
import java.io.*;
import java.sql.*;
import org.postgresql.util.*;
import java.io.Serializable;
import java.sql.SQLException;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
/*
* This implements the polygon datatype within PostgreSQL.
*/
public class PGpolygon extends PGobject implements Serializable, Cloneable
{
/*
......
......@@ -3,7 +3,8 @@ package org.postgresql.jdbc1;
import java.sql.*;
import java.util.*;
import org.postgresql.Field;
import org.postgresql.core.BaseStatement;
import org.postgresql.core.Field;
import org.postgresql.util.PSQLException;
import org.postgresql.Driver;
......@@ -1915,7 +1916,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
}
rs.close();
return ((AbstractJdbc1Statement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
}
/*
......@@ -2207,7 +2208,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
v.addElement(tuple);
}
return ((AbstractJdbc1Statement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
}
/*
......@@ -2381,7 +2382,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
}
rs.close();
return ((AbstractJdbc1Statement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
}
/*
......@@ -2494,7 +2495,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
}
rs.close();
return ((AbstractJdbc1Statement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
}
/*
......@@ -2596,7 +2597,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
}
rs.close();
return ((AbstractJdbc1Statement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
}
private static void sortStringArray(String s[]) {
......@@ -2790,7 +2791,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
v.addElement(tuple);
}
return ((AbstractJdbc1Statement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
}
/*
......@@ -2860,7 +2861,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
/* Perhaps we should check that the given
* catalog.schema.table actually exists. -KJ
*/
return ((AbstractJdbc1Statement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
}
/*
......@@ -3183,7 +3184,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
tuples.addElement(tuple);
}
return ((AbstractJdbc1Statement)connection.createStatement()).createResultSet(f, tuples, "OK", 1, 0, false);
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, tuples, "OK", 1, 0, false);
}
/*
......@@ -3469,7 +3470,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
}
rs.close();
return ((AbstractJdbc1Statement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
}
/*
......
......@@ -3,7 +3,7 @@ package org.postgresql.jdbc1;
import java.lang.*;
import java.util.*;
import org.postgresql.*;
import org.postgresql.core.Field;
import org.postgresql.util.*;
import java.sql.SQLException;
import java.sql.Types;
......
......@@ -2,6 +2,9 @@ package org.postgresql.jdbc1;
import java.sql.*;
import java.util.Vector;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.Field;
public class Jdbc1CallableStatement extends AbstractJdbc1Statement implements java.sql.CallableStatement
{
......@@ -11,7 +14,7 @@ public class Jdbc1CallableStatement extends AbstractJdbc1Statement implements ja
super(connection, sql);
}
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
......@@ -3,10 +3,10 @@ package org.postgresql.jdbc1;
import java.util.Vector;
import java.sql.*;
import org.postgresql.Field;
import org.postgresql.core.Field;
import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Connection.java,v 1.6 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Connection.java,v 1.7 2003/03/07 18:39:44 barry Exp $
* This class implements the java.sql.Connection interface for JDBC1.
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1Connection
......
......@@ -3,7 +3,7 @@ package org.postgresql.jdbc1;
import java.sql.*;
import java.util.*;
import org.postgresql.Field;
import org.postgresql.core.Field;
import org.postgresql.util.PSQLException;
public class Jdbc1DatabaseMetaData extends AbstractJdbc1DatabaseMetaData implements java.sql.DatabaseMetaData
......
......@@ -2,6 +2,8 @@ package org.postgresql.jdbc1;
import java.sql.*;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.Field;
public class Jdbc1PreparedStatement extends AbstractJdbc1Statement implements PreparedStatement
{
......@@ -11,7 +13,7 @@ public class Jdbc1PreparedStatement extends AbstractJdbc1Statement implements Pr
super(connection, sql);
}
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
......@@ -3,9 +3,10 @@ package org.postgresql.jdbc1;
import java.sql.*;
import java.util.Vector;
import org.postgresql.Field;
import org.postgresql.core.BaseStatement;
import org.postgresql.core.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1ResultSet.java,v 1.5 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1ResultSet.java,v 1.6 2003/03/07 18:39:44 barry Exp $
* This class implements the java.sql.ResultSet interface for JDBC1.
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1ResultSet
......@@ -13,7 +14,7 @@ import org.postgresql.Field;
public class Jdbc1ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet implements java.sql.ResultSet
{
public Jdbc1ResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
public Jdbc1ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{
super(statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
package org.postgresql.jdbc1;
import java.util.Vector;
import org.postgresql.core.Field;
public class Jdbc1ResultSetMetaData extends AbstractJdbc1ResultSetMetaData implements java.sql.ResultSetMetaData
{
public Jdbc1ResultSetMetaData(java.util.Vector rows, org.postgresql.Field[] fields)
public Jdbc1ResultSetMetaData(Vector rows, Field[] fields)
{
super(rows, fields);
}
......
......@@ -2,8 +2,11 @@ package org.postgresql.jdbc1;
import java.sql.*;
import java.util.Vector;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Statement.java,v 1.4 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Statement.java,v 1.5 2003/03/07 18:39:44 barry Exp $
* This class implements the java.sql.Statement interface for JDBC1.
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1Statement
......@@ -16,7 +19,7 @@ public class Jdbc1Statement extends org.postgresql.jdbc1.AbstractJdbc1Statement
super(c);
}
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
......@@ -6,7 +6,6 @@ import java.math.*;
import java.text.*;
import java.util.*;
import java.sql.*;
import org.postgresql.Field;
import org.postgresql.PGConnection;
import org.postgresql.largeobject.*;
......
......@@ -7,7 +7,6 @@ import java.math.*;
import java.text.*;
import java.util.*;
import java.sql.*;
import org.postgresql.Field;
import org.postgresql.PGConnection;
import org.postgresql.largeobject.*;
......
......@@ -6,7 +6,7 @@ import java.net.ConnectException;
import java.sql.*;
import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Connection.java,v 1.3 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Connection.java,v 1.4 2003/03/07 18:39:44 barry Exp $
* This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1Connection which provides the jdbc1
* methods. The real Connection class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Connection
......@@ -52,51 +52,6 @@ public abstract class AbstractJdbc2Connection extends org.postgresql.jdbc1.Abstr
typemap = map;
}
public void cancelQuery() throws SQLException
{
org.postgresql.PG_Stream cancelStream = null;
try
{
cancelStream = new org.postgresql.PG_Stream(PG_HOST, PG_PORT);
}
catch (ConnectException cex)
{
// Added by Peter Mount <peter@retep.org.uk>
// ConnectException is thrown when the connection cannot be made.
// we trap this an return a more meaningful message for the end user
throw new PSQLException ("postgresql.con.refused");
}
catch (IOException e)
{
throw new PSQLException ("postgresql.con.failed", e);
}
// Now we need to construct and send a cancel packet
try
{
cancelStream.SendInteger(16, 4);
cancelStream.SendInteger(80877102, 4);
cancelStream.SendInteger(pid, 4);
cancelStream.SendInteger(ckey, 4);
cancelStream.flush();
}
catch (IOException e)
{
throw new PSQLException("postgresql.con.failed", e);
}
finally
{
try
{
if (cancelStream != null)
cancelStream.close();
}
catch (IOException e)
{} // Ignore
}
}
/*
* This overides the standard internal getObject method so that we can
* check the jdbc2 type map first
......
......@@ -5,7 +5,7 @@ import java.sql.*;
import java.util.*;
import org.postgresql.Driver;
import org.postgresql.Field;
import org.postgresql.core.Field;
import org.postgresql.util.PSQLException;
public abstract class AbstractJdbc2DatabaseMetaData extends org.postgresql.jdbc1.AbstractJdbc1DatabaseMetaData
......
......@@ -8,14 +8,15 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import org.postgresql.Driver;
import org.postgresql.Field;
import org.postgresql.core.BaseStatement;
import org.postgresql.core.Field;
import org.postgresql.core.Encoding;
import org.postgresql.largeobject.*;
import org.postgresql.util.PGbytea;
import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.14 2003/02/27 05:56:27 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.15 2003/03/07 18:39:45 barry Exp $
* This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1ResultSet which provides the jdbc1
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2ResultSet
......@@ -39,7 +40,7 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
private PreparedStatement selectStatement = null;
public AbstractJdbc2ResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
public AbstractJdbc2ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{
super (statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......@@ -236,7 +237,7 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
if (i < 1 || i > fields.length)
throw new PSQLException("postgresql.res.colrange");
return (java.sql.Array) new org.postgresql.jdbc2.Array( connection, i, fields[i - 1], (java.sql.ResultSet) this );
return (java.sql.Array) new org.postgresql.jdbc2.Array( connection, i, fields[i - 1], this );
}
......@@ -414,7 +415,7 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
// This one needs some thought, as not all ResultSets come from a statement
public Statement getStatement() throws SQLException
{
return statement;
return (Statement) statement;
}
......@@ -1444,7 +1445,7 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
}
public void setStatement(Statement statement)
public void setStatement(BaseStatement statement)
{
this.statement = statement;
}
......
......@@ -4,7 +4,7 @@ package org.postgresql.jdbc2;
import java.lang.*;
import java.sql.*;
import java.util.*;
import org.postgresql.*;
import org.postgresql.core.Field;
import org.postgresql.util.*;
public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc1.AbstractJdbc1ResultSetMetaData
......
......@@ -5,10 +5,11 @@ import java.io.*;
import java.math.*;
import java.sql.*;
import java.util.Vector;
import org.postgresql.Driver;
import org.postgresql.largeobject.*;
import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.11 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.12 2003/03/07 18:39:45 barry Exp $
* This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
......@@ -23,8 +24,8 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
public AbstractJdbc2Statement (AbstractJdbc2Connection c)
{
super(c);
resultsettype = java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE;
concurrency = java.sql.ResultSet.CONCUR_READ_ONLY;
resultsettype = ResultSet.TYPE_SCROLL_INSENSITIVE;
concurrency = ResultSet.CONCUR_READ_ONLY;
}
public AbstractJdbc2Statement(AbstractJdbc2Connection connection, String sql) throws SQLException
......@@ -48,7 +49,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
boolean l_return = super.execute();
//Now do the jdbc2 specific stuff
//required for ResultSet.getStatement() to work and updateable resultsets
((AbstractJdbc2ResultSet)result).setStatement((Statement)this);
result.setStatement(this);
return l_return;
}
......@@ -118,12 +119,12 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
public void cancel() throws SQLException
{
((AbstractJdbc2Connection)connection).cancelQuery();
connection.cancelQuery();
}
public java.sql.Connection getConnection() throws SQLException
public Connection getConnection() throws SQLException
{
return (java.sql.Connection)connection;
return (Connection) connection;
}
public int getFetchDirection() throws SQLException
......@@ -131,11 +132,6 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
throw new PSQLException("postgresql.psqlnotimp");
}
public int getFetchSize() throws SQLException
{
return super.fetchSize;
}
public int getResultSetConcurrency() throws SQLException
{
return concurrency;
......@@ -150,7 +146,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
{
// I don't think this should happen, since it's a hint it should just
// fail quietly.
// throw org.postgresql.Driver.notImplemented();
// throw Driver.notImplemented();
}
public void setFetchSize(int rows) throws SQLException
......@@ -187,9 +183,9 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
batch.addElement(l_statement);
}
public java.sql.ResultSetMetaData getMetaData() throws SQLException
public ResultSetMetaData getMetaData() throws SQLException
{
java.sql.ResultSet rs = getResultSet();
ResultSet rs = getResultSet();
if (rs != null)
return rs.getMetaData();
......@@ -336,7 +332,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
public void setRef(int i, Ref x) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
public void setDate(int i, java.sql.Date d, java.util.Calendar cal) throws SQLException
......@@ -376,7 +372,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
public java.sql.Array getArray(int i) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
public java.math.BigDecimal getBigDecimal(int parameterIndex) throws SQLException
......@@ -387,43 +383,43 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
public Blob getBlob(int i) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
public Clob getClob(int i) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
public Object getObject(int i, java.util.Map map) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
public Ref getRef(int i) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
public Time getTime(int i, java.util.Calendar cal) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
// no custom types allowed yet..
public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
throw Driver.notImplemented();
}
......
......@@ -4,7 +4,10 @@ import java.text.*;
import java.sql.*;
import java.util.*;
import java.math.BigDecimal;
import org.postgresql.Field;
import org.postgresql.core.BaseConnection;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.BaseStatement;
import org.postgresql.core.Field;
import org.postgresql.util.*;
/*
......@@ -25,9 +28,9 @@ import org.postgresql.util.*;
public class Array implements java.sql.Array
{
private org.postgresql.PGConnection conn = null;
private org.postgresql.Field field = null;
private ResultSet rs;
private BaseConnection conn = null;
private Field field = null;
private BaseResultSet rs;
private int idx = 0;
private String rawString = null;
......@@ -39,14 +42,14 @@ public class Array implements java.sql.Array
* @param field the Field descriptor for the field to load into this Array
* @param rs the ResultSet from which to get the data for this Array
*/
public Array( org.postgresql.PGConnection conn, int idx, Field field, ResultSet rs )
public Array(BaseConnection conn, int idx, Field field, BaseResultSet rs )
throws SQLException
{
this.conn = conn;
this.field = field;
this.rs = rs;
this.idx = idx;
this.rawString = ((AbstractJdbc2ResultSet)rs).getFixedString(idx);
this.rawString = rs.getFixedString(idx);
}
public Object getArray() throws SQLException
......@@ -343,8 +346,8 @@ public class Array implements java.sql.Array
default:
throw org.postgresql.Driver.notImplemented();
}
java.sql.Statement stat = ((AbstractJdbc2Connection)conn).createStatement();
return ((AbstractJdbc2Statement)stat).createResultSet(fields, rows, "OK", 1, 0, false);
BaseStatement stat = (BaseStatement) conn.createStatement();
return (ResultSet) stat.createResultSet(fields, rows, "OK", 1, 0, false);
}
public String toString()
......
......@@ -2,6 +2,9 @@ package org.postgresql.jdbc2;
import java.sql.*;
import java.util.Vector;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.Field;
public class Jdbc2CallableStatement extends org.postgresql.jdbc2.AbstractJdbc2Statement implements java.sql.CallableStatement
{
......@@ -11,7 +14,7 @@ public class Jdbc2CallableStatement extends org.postgresql.jdbc2.AbstractJdbc2St
super(connection, sql);
}
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
......@@ -4,9 +4,9 @@ package org.postgresql.jdbc2;
import java.sql.*;
import java.util.Vector;
import java.util.Hashtable;
import org.postgresql.Field;
import org.postgresql.core.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Connection.java,v 1.6 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Connection.java,v 1.7 2003/03/07 18:39:45 barry Exp $
* This class implements the java.sql.Connection interface for JDBC2.
* However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2Connection or one of it's parents
......
......@@ -2,6 +2,9 @@ package org.postgresql.jdbc2;
import java.sql.*;
import java.util.Vector;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.Field;
public class Jdbc2PreparedStatement extends org.postgresql.jdbc2.AbstractJdbc2Statement implements java.sql.PreparedStatement
{
......@@ -11,7 +14,7 @@ public class Jdbc2PreparedStatement extends org.postgresql.jdbc2.AbstractJdbc2St
super(connection, sql);
}
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
......@@ -3,9 +3,10 @@ package org.postgresql.jdbc2;
import java.sql.*;
import java.util.Vector;
import org.postgresql.Field;
import org.postgresql.core.BaseStatement;
import org.postgresql.core.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.7 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.8 2003/03/07 18:39:45 barry Exp $
* This class implements the java.sql.ResultSet interface for JDBC2.
* However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2ResultSet or one of it's parents
......@@ -13,12 +14,12 @@ import org.postgresql.Field;
public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet implements java.sql.ResultSet
{
public Jdbc2ResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
public Jdbc2ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{
super(statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
public java.sql.ResultSetMetaData getMetaData() throws SQLException
public ResultSetMetaData getMetaData() throws SQLException
{
return new Jdbc2ResultSetMetaData(rows, fields);
}
......
package org.postgresql.jdbc2;
import java.util.Vector;
import org.postgresql.core.Field;
public class Jdbc2ResultSetMetaData extends AbstractJdbc2ResultSetMetaData implements java.sql.ResultSetMetaData
{
public Jdbc2ResultSetMetaData(java.util.Vector rows, org.postgresql.Field[] fields)
public Jdbc2ResultSetMetaData(Vector rows, Field[] fields)
{
super(rows, fields);
}
......
......@@ -2,8 +2,11 @@ package org.postgresql.jdbc2;
import java.sql.*;
import java.util.Vector;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.4 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.5 2003/03/07 18:39:45 barry Exp $
* This class implements the java.sql.Statement interface for JDBC2.
* However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2Statement or one of it's parents
......@@ -16,7 +19,7 @@ public class Jdbc2Statement extends org.postgresql.jdbc2.AbstractJdbc2Statement
super(c);
}
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
......@@ -3,8 +3,11 @@ package org.postgresql.jdbc3;
import java.sql.*;
import java.util.Vector;
import org.postgresql.core.BaseStatement;
import org.postgresql.core.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3ResultSet.java,v 1.3 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3ResultSet.java,v 1.4 2003/03/07 18:39:45 barry Exp $
* This class defines methods of the jdbc3 specification. This class extends
* org.postgresql.jdbc2.AbstractJdbc2ResultSet which provides the jdbc2
* methods. The real Statement class (for jdbc3) is org.postgresql.jdbc3.Jdbc3ResultSet
......@@ -12,7 +15,7 @@ import java.util.Vector;
public abstract class AbstractJdbc3ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet
{
public AbstractJdbc3ResultSet(Statement statement, org.postgresql.Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
public AbstractJdbc3ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{
super (statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
......@@ -2,6 +2,9 @@ package org.postgresql.jdbc3;
import java.sql.*;
import java.util.Vector;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.Field;
public class Jdbc3CallableStatement extends org.postgresql.jdbc3.AbstractJdbc3Statement implements java.sql.CallableStatement
{
......@@ -11,7 +14,7 @@ public class Jdbc3CallableStatement extends org.postgresql.jdbc3.AbstractJdbc3St
super(connection, sql);
}
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{
return new Jdbc3ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
......@@ -4,9 +4,9 @@ package org.postgresql.jdbc3;
import java.sql.*;
import java.util.Vector;
import java.util.Hashtable;
import org.postgresql.Field;
import org.postgresql.core.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Connection.java,v 1.3 2003/02/04 09:20:10 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Connection.java,v 1.4 2003/03/07 18:39:45 barry Exp $
* This class implements the java.sql.Connection interface for JDBC3.
* However most of the implementation is really done in
* org.postgresql.jdbc3.AbstractJdbc3Connection or one of it's parents
......
......@@ -2,6 +2,8 @@ package org.postgresql.jdbc3;
import java.sql.*;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.Field;
public class Jdbc3PreparedStatement extends org.postgresql.jdbc3.AbstractJdbc3Statement implements java.sql.PreparedStatement
{
......@@ -11,7 +13,7 @@ public class Jdbc3PreparedStatement extends org.postgresql.jdbc3.AbstractJdbc3St
super(connection, sql);
}
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{
return new Jdbc3ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
......@@ -3,9 +3,10 @@ package org.postgresql.jdbc3;
import java.sql.*;
import java.util.Vector;
import org.postgresql.Field;
import org.postgresql.core.Field;
import org.postgresql.core.BaseStatement;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3ResultSet.java,v 1.4 2003/02/04 09:20:11 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3ResultSet.java,v 1.5 2003/03/07 18:39:45 barry Exp $
* This class implements the java.sql.ResultSet interface for JDBC3.
* However most of the implementation is really done in
* org.postgresql.jdbc3.AbstractJdbc3ResultSet or one of it's parents
......@@ -13,7 +14,7 @@ import org.postgresql.Field;
public class Jdbc3ResultSet extends org.postgresql.jdbc3.AbstractJdbc3ResultSet implements java.sql.ResultSet
{
public Jdbc3ResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
public Jdbc3ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{
super(statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
package org.postgresql.jdbc3;
import org.postgresql.core.Field;
public class Jdbc3ResultSetMetaData extends org.postgresql.jdbc2.AbstractJdbc2ResultSetMetaData implements java.sql.ResultSetMetaData
{
public Jdbc3ResultSetMetaData(java.util.Vector rows, org.postgresql.Field[] fields)
public Jdbc3ResultSetMetaData(java.util.Vector rows, Field[] fields)
{
super(rows, fields);
}
......
......@@ -2,8 +2,11 @@ package org.postgresql.jdbc3;
import java.sql.*;
import java.util.Vector;
import org.postgresql.core.BaseResultSet;
import org.postgresql.core.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Statement.java,v 1.3 2003/02/04 09:20:11 barry Exp $
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Statement.java,v 1.4 2003/03/07 18:39:45 barry Exp $
* This class implements the java.sql.Statement interface for JDBC3.
* However most of the implementation is really done in
* org.postgresql.jdbc3.AbstractJdbc3Statement or one of it's parents
......@@ -16,7 +19,7 @@ public class Jdbc3Statement extends org.postgresql.jdbc3.AbstractJdbc3Statement
super(c);
}
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{
return new Jdbc3ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
......
/*-------------------------------------------------------------------------
*
* BlobInputStream.java
* This is an implementation of an InputStream from a large object.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/largeobject/Attic/BlobInputStream.java,v 1.5 2003/03/07 18:39:45 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.largeobject;
import java.io.InputStream;
import java.io.IOException;
import java.sql.SQLException;
/*
* This is an initial implementation of an InputStream from a large object.
* For now, the bare minimum is implemented. Later (after 7.1) we will overide
* the other read methods to optimise them.
*/
public class BlobInputStream extends InputStream
{
/*
......
/*-------------------------------------------------------------------------
*
* BlobOutputStream.java
* This implements a basic output stream that writes to a LargeObject
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/largeobject/Attic/BlobOutputStream.java,v 1.6 2003/03/07 18:39:45 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.largeobject;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.SQLException;
/*
* This implements a basic output stream that writes to a LargeObject
*/
public class BlobOutputStream extends OutputStream
{
/*
......
/*-------------------------------------------------------------------------
*
* LargeObject.java
* This class implements the large object interface to org.postgresql.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/largeobject/Attic/LargeObject.java,v 1.10 2003/03/07 18:39:45 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.largeobject;
import java.io.*;
import java.lang.*;
import java.net.*;
import java.util.*;
import java.sql.*;
import org.postgresql.fastpath.*;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.SQLException;
import org.postgresql.fastpath.Fastpath;
import org.postgresql.fastpath.FastpathArg;
/*
* This class implements the large object interface to org.postgresql.
*
* <p>It provides the basic methods required to run the interface, plus
* This class provides the basic methods required to run the interface, plus
* a pair of methods that provide InputStream and OutputStream classes
* for this object.
*
......@@ -27,12 +36,6 @@ import org.postgresql.fastpath.*;
* to a Large Object, or how to create one.
*
* @see org.postgresql.largeobject.LargeObjectManager
* @see org.postgresql.ResultSet#getAsciiStream
* @see org.postgresql.ResultSet#getBinaryStream
* @see org.postgresql.ResultSet#getUnicodeStream
* @see org.postgresql.PreparedStatement#setAsciiStream
* @see org.postgresql.PreparedStatement#setBinaryStream
* @see org.postgresql.PreparedStatement#setUnicodeStream
* @see java.sql.ResultSet#getAsciiStream
* @see java.sql.ResultSet#getBinaryStream
* @see java.sql.ResultSet#getUnicodeStream
......
/*-------------------------------------------------------------------------
*
* LargeObjectManager.java
* This class implements the large object interface to org.postgresql.
*
* It provides methods that allow client code to create, open and delete
* large objects from the database. When opening an object, an instance of
* org.postgresql.largeobject.LargeObject is returned, and its methods
* then allow access to the object.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/largeobject/Attic/LargeObjectManager.java,v 1.10 2003/03/07 18:39:45 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.largeobject;
import org.postgresql.Driver;
import java.io.*;
import java.lang.*;
import java.net.*;
import java.util.*;
import java.sql.*;
import org.postgresql.fastpath.*;
import org.postgresql.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.postgresql.Driver;
import org.postgresql.core.BaseConnection;
import org.postgresql.fastpath.Fastpath;
import org.postgresql.fastpath.FastpathArg;
import org.postgresql.util.PSQLException;
/*
* This class implements the large object interface to org.postgresql.
......@@ -29,7 +45,7 @@ import org.postgresql.util.*;
*
* ... code that opens a connection ...
*
* lobj = ((org.postgresql.Connection)myconn).getLargeObjectAPI();
* lobj = ((org.postgresql.PGConnection)myconn).getLargeObjectAPI();
* </pre>
*
* <p>Normally, client code would use the getAsciiStream, getBinaryStream,
......@@ -43,13 +59,6 @@ import org.postgresql.util.*;
* <p>Refer to org.postgresql.largeobject.LargeObject on how to manipulate the
* contents of a Large Object.
*
* @see org.postgresql.largeobject.LargeObject
* @see org.postgresql.ResultSet#getAsciiStream
* @see org.postgresql.ResultSet#getBinaryStream
* @see org.postgresql.ResultSet#getUnicodeStream
* @see org.postgresql.PreparedStatement#setAsciiStream
* @see org.postgresql.PreparedStatement#setBinaryStream
* @see org.postgresql.PreparedStatement#setUnicodeStream
* @see java.sql.ResultSet#getAsciiStream
* @see java.sql.ResultSet#getBinaryStream
* @see java.sql.ResultSet#getUnicodeStream
......@@ -94,10 +103,10 @@ public class LargeObjectManager
* org.postgresql.Connection class keeps track of the various extension API's
* and it's advised you use those to gain access, and not going direct.
*/
public LargeObjectManager(Connection conn) throws SQLException
public LargeObjectManager(BaseConnection conn) throws SQLException
{
// We need Fastpath to do anything
this.fp = ((org.postgresql.PGConnection)conn).getFastpathAPI();
this.fp = conn.getFastpathAPI();
// Now get the function oid's for the api
//
......
......@@ -63,7 +63,6 @@ public class Jdbc2TestSuite extends TestSuite
// Fastpath/LargeObject
suite.addTestSuite(BlobTest.class);
suite.addTestSuite(SerializeTest.class);
suite.addTestSuite(UpdateableResultTest.class );
suite.addTestSuite(CallableStmtTest.class );
......
package org.postgresql.test.jdbc2;
import java.io.Serializable;
public class SerializeObject implements Serializable {
public int intcol;
public double doublecol;
public String stringcol;
}
package org.postgresql.test.jdbc2;
import org.postgresql.test.TestUtil;
import junit.framework.TestCase;
import java.sql.*;
import org.postgresql.util.Serialize;
public class SerializeTest extends TestCase {
private Connection conn;
private SerializeObject serobj;
private Serialize ser;
public SerializeTest(String name) {
super(name);
}
protected void setUp() throws Exception {
conn = TestUtil.openDB();
serobj = new SerializeObject();
serobj.intcol = 1;
serobj.doublecol = 3.4;
serobj.stringcol = "Hello";
TestUtil.dropTable(conn,Serialize.toPostgreSQL(conn,serobj.getClass().getName()));
Serialize.create(conn, serobj);
Serialize.create(conn, serobj);
ser = new Serialize(conn,serobj);
}
protected void tearDown() throws Exception {
TestUtil.dropTable(conn,Serialize.toPostgreSQL(conn,serobj.getClass().getName()));
}
public void testCreateSerialize() {
try {
long oid = ser.storeObject(serobj);
SerializeObject serobj2 = (SerializeObject)ser.fetch(oid);
assertNotNull(serobj2);
assertEquals(serobj.intcol,serobj2.intcol);
assertTrue(Math.abs(serobj.doublecol-serobj2.doublecol) < 0.0001);
assertTrue(serobj.stringcol.equals(serobj2.stringcol));
} catch (SQLException sqle) {
fail(sqle.getMessage());
}
}
}
......@@ -17,7 +17,7 @@ import javax.naming.*;
* tests.
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.5 $
* @version $Revision: 1.6 $
*/
public abstract class BaseDataSourceTest extends TestCase
{
......@@ -189,7 +189,7 @@ public abstract class BaseDataSourceTest extends TestCase
try
{
con = getDataSourceConnection();
((PGConnection)con).getEncoding().name();
((PGConnection)con).getNotifications();
con.close();
}
catch (Exception e)
......
/*-------------------------------------------------------------------------
*
* MD5Digest.java
* MD5-based utility function to obfuscate passwords before network
* transmission
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/MD5Digest.java,v 1.5 2003/03/07 18:39:46 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;
/*
* MD5-based utility function to obfuscate passwords before network transmission
*
* @author Jeremy Wohl
* $Id: MD5Digest.java,v 1.4 2002/08/16 19:35:46 davec Exp $
*/
import java.security.*;
......
/*-------------------------------------------------------------------------
*
* MessageTranslator.java
* A singleton class to translate JDBC driver messages in SQLException's.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/MessageTranslator.java,v 1.4 2003/03/07 18:39:46 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;
import java.util.*;
import java.text.*;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/*
* A singleton class to translate JDBC driver messages in SQLException's.
*/
public class MessageTranslator
{
......
package org.postgresql.util;
import java.sql.*;
/*
/*-------------------------------------------------------------------------
*
* PGbytea.java
* Converts to and from the postgresql bytea datatype used by the backend.
*
* $Id: PGbytea.java,v 1.6 2002/09/06 21:23:06 momjian Exp $
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PGbytea.java,v 1.7 2003/03/07 18:39:46 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;
import java.sql.*;
public class PGbytea
{
......
/*-------------------------------------------------------------------------
*
* PGmoney.java
* This implements a class that handles the PostgreSQL money and cash types
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PGmoney.java,v 1.5 2003/03/07 18:39:46 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;
import java.io.*;
import java.sql.*;
/*
* This implements a class that handles the PostgreSQL money and cash types
*/
import java.io.Serializable;
import java.sql.SQLException;
public class PGmoney extends PGobject implements Serializable, Cloneable
{
/*
......@@ -22,12 +32,6 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
val = value;
}
/*
* This is called mainly from the other geometric types, when a
* point is imbeded within their definition.
*
* @param value Definition of this point in PostgreSQL's syntax
*/
public PGmoney(String value) throws SQLException
{
this();
......@@ -42,10 +46,6 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
setType("money");
}
/*
* @param s Definition of this point in PostgreSQL's syntax
* @exception SQLException on conversion failure
*/
public void setValue(String s) throws SQLException
{
try
......@@ -76,10 +76,6 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
}
}
/*
* @param obj Object to compare with
* @return true if the two boxes are identical
*/
public boolean equals(Object obj)
{
if (obj instanceof PGmoney)
......@@ -98,9 +94,6 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
return new PGmoney(val);
}
/*
* @return the PGpoint in the syntax expected by org.postgresql
*/
public String getValue()
{
if (val < 0)
......
package org.postgresql.util;
import java.io.*;
import java.lang.*;
import java.sql.*;
import java.util.*;
/*
* org.postgresql.PG_Object is a class used to describe unknown types
/*-------------------------------------------------------------------------
*
* PGobject.java
* PGobject is a class used to describe unknown types
* An unknown type is any type that is unknown by JDBC Standards
*
* <p>As of PostgreSQL 6.3, this allows user code to add their own
* handlers via a call to org.postgresql.Connection. These handlers
* must extend this class.
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PGobject.java,v 1.4 2003/03/07 18:39:46 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;
import java.io.Serializable;
import java.sql.SQLException;
public class PGobject implements Serializable, Cloneable
{
protected String type;
......
/*-------------------------------------------------------------------------
*
* PGtokenizer.java
* This class is used to tokenize the text output of org.postgres.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PGtokenizer.java,v 1.6 2003/03/07 18:39:46 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;
import java.sql.*;
import java.util.*;
/*
* This class is used to tokenize the text output of org.postgres.
*
* <p>It's mainly used by the geometric classes, but is useful in parsing any
* It's mainly used by the geometric classes, but is useful in parsing any
* output from custom data types output from org.postgresql.
*
* @see org.postgresql.geometric.PGbox
......
/*-------------------------------------------------------------------------
*
* PSQLException.java
* This class extends SQLException, and provides our internationalisation
* handling
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PSQLException.java,v 1.9 2003/03/07 18:39:46 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;
import java.io.*;
import java.sql.*;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.sql.SQLException;
/*
* This class extends SQLException, and provides our internationalisation handling
*/
public class PSQLException extends SQLException
{
private String message;
......
This diff is collapsed.
/*-------------------------------------------------------------------------
*
* UnixCrypt.java
* Contains static methods to encrypt and compare
* passwords with Unix encrypted passwords.
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/UnixCrypt.java,v 1.4 2003/03/07 18:39:46 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.util;
/*
* This class provides us with the ability to encrypt passwords when sent
* over the network stream
*
* <P>Contains static methods to encrypt and compare
* passwords with Unix encrypted passwords.</P>
*
* <P>See <A HREF="http://www.zeh.com/local/jfd/crypt.html">
* John Dumas's Java Crypt page</A> for the original source.</P>
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment