Commit 68c6eff9 authored by Barry Lind's avatar Barry Lind

Third phase of restructuring to add jdbc3 support.

 Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
 	jdbc/org/postgresql/jdbc1/DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc1/Jdbc1Connection.java
 	jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
 	jdbc/org/postgresql/jdbc2/Array.java
 	jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc2/Jdbc2Connection.java
 	jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java
 Added Files:
 	jdbc/org/postgresql/jdbc1/Jdbc1CallableStatement.java
 	jdbc/org/postgresql/jdbc2/Jdbc2CallableStatement.java
 Removed Files:
 	jdbc/org/postgresql/jdbc1/CallableStatement.java
 	jdbc/org/postgresql/jdbc2/CallableStatement.java
 	jdbc/org/postgresql/jdbc2/UpdateableResultSet.java
parent 73eb2dfe
...@@ -13,7 +13,7 @@ import org.postgresql.largeobject.LargeObjectManager; ...@@ -13,7 +13,7 @@ import org.postgresql.largeobject.LargeObjectManager;
import org.postgresql.util.*; import org.postgresql.util.*;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.1 2002/07/23 03:59:55 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.2 2002/07/25 22:45:27 barry Exp $
* This class defines methods of the jdbc1 specification. This class is * This class defines methods of the jdbc1 specification. This class is
* extended by org.postgresql.jdbc2.AbstractJdbc2Connection which adds the jdbc2 * extended by org.postgresql.jdbc2.AbstractJdbc2Connection which adds the jdbc2
* methods. The real Connection class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Connection * methods. The real Connection class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Connection
...@@ -359,8 +359,7 @@ public abstract class AbstractJdbc1Connection implements org.postgresql.PGConnec ...@@ -359,8 +359,7 @@ public abstract class AbstractJdbc1Connection implements org.postgresql.PGConnec
// are common to all implementations (JDBC1 or 2), they are placed here. // are common to all implementations (JDBC1 or 2), they are placed here.
// This should make it easy to maintain the two specifications. // This should make it easy to maintain the two specifications.
//BJL TODO this method shouldn't need to take a Connection since this can be used. public abstract java.sql.ResultSet getResultSet(Statement statement, org.postgresql.Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException;
public abstract java.sql.ResultSet getResultSet(java.sql.Statement stat, org.postgresql.Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException;
/* /*
* This adds a warning to the warning chain. * This adds a warning to the warning chain.
......
...@@ -13,15 +13,15 @@ import org.postgresql.largeobject.*; ...@@ -13,15 +13,15 @@ import org.postgresql.largeobject.*;
import org.postgresql.util.PGbytea; import org.postgresql.util.PGbytea;
import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.1 2002/07/23 03:59:55 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.2 2002/07/25 22:45:27 barry Exp $
* This class defines methods of the jdbc1 specification. This class is * This class defines methods of the jdbc1 specification. This class is
* extended by org.postgresql.jdbc2.AbstractJdbc2ResultSet which adds the jdbc2 * extended by org.postgresql.jdbc2.AbstractJdbc2ResultSet which adds the jdbc2
* methods. The real ResultSet class (for jdbc1) is org.postgresql.jdbc1.Jdbc1ResultSet * methods. The real ResultSet class (for jdbc1) is org.postgresql.jdbc1.Jdbc1ResultSet
*/ */
public abstract class AbstractJdbc1ResultSet public abstract class AbstractJdbc1ResultSet
{ {
protected Vector rows; // The results protected Vector rows; // The results
protected Statement statement;
protected Field fields[]; // The field descriptions protected Field fields[]; // The field descriptions
protected String status; // Status of the result protected String status; // Status of the result
protected boolean binaryCursor = false; // is the data binary or Strings protected boolean binaryCursor = false; // is the data binary or Strings
...@@ -41,9 +41,10 @@ public abstract class AbstractJdbc1ResultSet ...@@ -41,9 +41,10 @@ public abstract class AbstractJdbc1ResultSet
public byte[][] rowBuffer=null; public byte[][] rowBuffer=null;
public AbstractJdbc1ResultSet(org.postgresql.PGConnection conn, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) public AbstractJdbc1ResultSet(org.postgresql.PGConnection conn, Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{ {
this.connection = conn; this.connection = conn;
this.statement = statement;
this.fields = fields; this.fields = fields;
this.rows = tuples; this.rows = tuples;
this.status = status; this.status = status;
......
...@@ -13,7 +13,7 @@ import org.postgresql.util.PSQLException; ...@@ -13,7 +13,7 @@ import org.postgresql.util.PSQLException;
/* /*
* This class provides information about the database as a whole. * This class provides information about the database as a whole.
* *
* $Id: DatabaseMetaData.java,v 1.48 2002/07/23 03:59:55 barry Exp $ * $Id: DatabaseMetaData.java,v 1.49 2002/07/25 22:45:28 barry Exp $
* *
* <p>Many of the methods here return lists of information in ResultSets. You * <p>Many of the methods here return lists of information in ResultSets. You
* can use the normal ResultSet methods such as getString and getInt to * can use the normal ResultSet methods such as getString and getInt to
...@@ -1549,7 +1549,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1549,7 +1549,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
v.addElement(tuple); v.addElement(tuple);
} }
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -1627,7 +1627,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1627,7 +1627,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
// add query loop here // add query loop here
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -1762,7 +1762,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1762,7 +1762,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
v.addElement(tuple); v.addElement(tuple);
} }
r.close(); r.close();
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
// This array contains the valid values for the types argument // This array contains the valid values for the types argument
...@@ -1809,7 +1809,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1809,7 +1809,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
f[0] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32); f[0] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
tuple[0] = "".getBytes(); tuple[0] = "".getBytes();
v.addElement(tuple); v.addElement(tuple);
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -1854,7 +1854,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1854,7 +1854,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
tuple[0] = getTableTypes[i][0].getBytes(); tuple[0] = getTableTypes[i][0].getBytes();
v.addElement(tuple); v.addElement(tuple);
} }
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -2050,7 +2050,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2050,7 +2050,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
} }
r.close(); r.close();
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -2113,7 +2113,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2113,7 +2113,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
//v.addElement(tuple); //v.addElement(tuple);
} }
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -2203,7 +2203,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2203,7 +2203,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2); f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2);
f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2); f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2);
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -2413,7 +2413,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2413,7 +2413,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
while (hasMore); while (hasMore);
} }
return new Jdbc1ResultSet(connection, f, tuples, "OK", 1); return connection.getResultSet(null, f, tuples, "OK", 1);
} }
/* /*
...@@ -2692,7 +2692,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2692,7 +2692,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
v.addElement(tuple); v.addElement(tuple);
} }
rs.close(); rs.close();
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
throw new PSQLException("postgresql.metadata.unavailable"); throw new PSQLException("postgresql.metadata.unavailable");
...@@ -2832,7 +2832,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2832,7 +2832,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
} }
} }
return new Jdbc1ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
} }
package org.postgresql.jdbc1;
import java.sql.*;
public class Jdbc1CallableStatement extends AbstractJdbc1Statement implements java.sql.CallableStatement
{
public Jdbc1CallableStatement(Jdbc1Connection connection, String sql) throws SQLException
{
super(connection, sql);
}
}
...@@ -6,7 +6,7 @@ import java.sql.*; ...@@ -6,7 +6,7 @@ import java.sql.*;
import org.postgresql.Field; import org.postgresql.Field;
import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Connection.java,v 1.2 2002/07/24 22:08:40 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Connection.java,v 1.3 2002/07/25 22:45:28 barry Exp $
* This class implements the java.sql.Connection interface for JDBC1. * This class implements the java.sql.Connection interface for JDBC1.
* However most of the implementation is really done in * However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1Connection * org.postgresql.jdbc1.AbstractJdbc1Connection
...@@ -24,10 +24,9 @@ public class Jdbc1Connection extends org.postgresql.jdbc1.AbstractJdbc1Connectio ...@@ -24,10 +24,9 @@ public class Jdbc1Connection extends org.postgresql.jdbc1.AbstractJdbc1Connectio
return new org.postgresql.jdbc1.Jdbc1PreparedStatement(this, sql); return new org.postgresql.jdbc1.Jdbc1PreparedStatement(this, sql);
} }
//BJL TODO - merge callable statement logic from jdbc2 to jdbc1
public java.sql.CallableStatement prepareCall(String sql) throws SQLException public java.sql.CallableStatement prepareCall(String sql) throws SQLException
{ {
throw new PSQLException("postgresql.con.call"); return new org.postgresql.jdbc1.Jdbc1CallableStatement(this, sql);
} }
public java.sql.DatabaseMetaData getMetaData() throws SQLException public java.sql.DatabaseMetaData getMetaData() throws SQLException
...@@ -39,7 +38,12 @@ public class Jdbc1Connection extends org.postgresql.jdbc1.AbstractJdbc1Connectio ...@@ -39,7 +38,12 @@ public class Jdbc1Connection extends org.postgresql.jdbc1.AbstractJdbc1Connectio
public java.sql.ResultSet getResultSet(java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException public java.sql.ResultSet getResultSet(java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{ {
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor); return new Jdbc1ResultSet(this, stat, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
public java.sql.ResultSet getResultSet(java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException
{
return new Jdbc1ResultSet(this, stat, fields, tuples, status, updateCount, 0, false);
} }
} }
......
...@@ -5,7 +5,7 @@ import java.sql.*; ...@@ -5,7 +5,7 @@ import java.sql.*;
import java.util.Vector; import java.util.Vector;
import org.postgresql.Field; import org.postgresql.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1ResultSet.java,v 1.1 2002/07/23 03:59:55 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1ResultSet.java,v 1.2 2002/07/25 22:45:28 barry Exp $
* This class implements the java.sql.ResultSet interface for JDBC1. * This class implements the java.sql.ResultSet interface for JDBC1.
* However most of the implementation is really done in * However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1ResultSet * org.postgresql.jdbc1.AbstractJdbc1ResultSet
...@@ -13,14 +13,9 @@ import org.postgresql.Field; ...@@ -13,14 +13,9 @@ import org.postgresql.Field;
public class Jdbc1ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet implements java.sql.ResultSet public class Jdbc1ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet implements java.sql.ResultSet
{ {
public Jdbc1ResultSet(Jdbc1Connection conn, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) public Jdbc1ResultSet(Jdbc1Connection conn, Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{ {
super(conn, fields, tuples, status, updateCount, insertOID, binaryCursor); super(conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
public Jdbc1ResultSet(Jdbc1Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
{
super(conn, fields, tuples, status, updateCount, 0, false);
} }
public java.sql.ResultSetMetaData getMetaData() throws SQLException public java.sql.ResultSetMetaData getMetaData() throws SQLException
......
...@@ -2,12 +2,13 @@ package org.postgresql.jdbc2; ...@@ -2,12 +2,13 @@ package org.postgresql.jdbc2;
import java.io.*; import java.io.*;
import java.math.*;
import java.sql.*; import java.sql.*;
import java.util.Vector; import java.util.Vector;
import org.postgresql.largeobject.*; import org.postgresql.largeobject.*;
import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLException;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.2 2002/07/24 22:08:42 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.3 2002/07/25 22:45:28 barry Exp $
* This class defines methods of the jdbc2 specification. This class extends * This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1 * org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement * methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
...@@ -46,7 +47,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra ...@@ -46,7 +47,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
{ {
boolean l_return = super.execute(sql); boolean l_return = super.execute(sql);
//Now do the jdbc2 specific stuff //Now do the jdbc2 specific stuff
//required for ResultSet.getStatement() to work //required for ResultSet.getStatement() to work and updateable resultsets
((AbstractJdbc2ResultSet)result).setStatement((Statement)this); ((AbstractJdbc2ResultSet)result).setStatement((Statement)this);
// Added this so that the Updateable resultset knows the query that gave this // Added this so that the Updateable resultset knows the query that gave this
...@@ -331,4 +332,60 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra ...@@ -331,4 +332,60 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
setTimestamp(i, new java.sql.Timestamp(cal.getTime().getTime())); setTimestamp(i, new java.sql.Timestamp(cal.getTime().getTime()));
} }
} }
// ** JDBC 2 Extensions for CallableStatement**
public java.sql.Array getArray(int i) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public java.math.BigDecimal getBigDecimal(int parameterIndex) throws SQLException
{
checkIndex (parameterIndex, Types.NUMERIC, "BigDecimal");
return ((BigDecimal)callResult);
}
public Blob getBlob(int i) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public Clob getClob(int i) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public Object getObject(int i, java.util.Map map) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public Ref getRef(int i) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public Time getTime(int i, java.util.Calendar cal) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
// no custom types allowed yet..
public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException
{
throw org.postgresql.Driver.notImplemented();
}
} }
...@@ -340,7 +340,7 @@ public class Array implements java.sql.Array ...@@ -340,7 +340,7 @@ public class Array implements java.sql.Array
default: default:
throw org.postgresql.Driver.notImplemented(); throw org.postgresql.Driver.notImplemented();
} }
return new Jdbc2ResultSet((org.postgresql.jdbc2.Jdbc2Connection)conn, fields, rows, "OK", 1 ); return ((Jdbc2Connection)conn).getResultSet(null, fields, rows, "OK", 1 );
} }
public String toString() public String toString()
......
...@@ -15,7 +15,7 @@ import org.postgresql.util.PSQLException; ...@@ -15,7 +15,7 @@ import org.postgresql.util.PSQLException;
/* /*
* This class provides information about the database as a whole. * This class provides information about the database as a whole.
* *
* $Id: DatabaseMetaData.java,v 1.59 2002/07/23 03:59:55 barry Exp $ * $Id: DatabaseMetaData.java,v 1.60 2002/07/25 22:45:28 barry Exp $
* *
* <p>Many of the methods here return lists of information in ResultSets. You * <p>Many of the methods here return lists of information in ResultSets. You
* can use the normal ResultSet methods such as getString and getInt to * can use the normal ResultSet methods such as getString and getInt to
...@@ -1653,7 +1653,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1653,7 +1653,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
v.addElement(tuple); v.addElement(tuple);
} }
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -1731,7 +1731,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1731,7 +1731,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
// add query loop here // add query loop here
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -1866,7 +1866,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1866,7 +1866,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
v.addElement(tuple); v.addElement(tuple);
} }
r.close(); r.close();
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
// This array contains the valid values for the types argument // This array contains the valid values for the types argument
...@@ -1913,7 +1913,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1913,7 +1913,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
f[0] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32); f[0] = new Field(connection, "TABLE_SCHEM", iVarcharOid, 32);
tuple[0] = "".getBytes(); tuple[0] = "".getBytes();
v.addElement(tuple); v.addElement(tuple);
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -1958,7 +1958,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -1958,7 +1958,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
tuple[0] = getTableTypes[i][0].getBytes(); tuple[0] = getTableTypes[i][0].getBytes();
v.addElement(tuple); v.addElement(tuple);
} }
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -2154,7 +2154,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2154,7 +2154,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
} }
r.close(); r.close();
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -2218,7 +2218,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2218,7 +2218,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
//v.addElement(tuple); //v.addElement(tuple);
} }
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -2281,7 +2281,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2281,7 +2281,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
//v.addElement(tuple); //v.addElement(tuple);
} }
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -2337,7 +2337,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2337,7 +2337,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2); f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2);
f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2); f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2);
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
/* /*
...@@ -2680,7 +2680,7 @@ WHERE ...@@ -2680,7 +2680,7 @@ WHERE
tuples.addElement(tuple); tuples.addElement(tuple);
} }
return new Jdbc2ResultSet(connection, f, tuples, "OK", 1); return connection.getResultSet(null, f, tuples, "OK", 1);
} }
/* /*
...@@ -2959,7 +2959,7 @@ WHERE ...@@ -2959,7 +2959,7 @@ WHERE
v.addElement(tuple); v.addElement(tuple);
} }
rs.close(); rs.close();
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
throw new PSQLException("postgresql.metadata.unavailable"); throw new PSQLException("postgresql.metadata.unavailable");
...@@ -3097,7 +3097,7 @@ WHERE ...@@ -3097,7 +3097,7 @@ WHERE
} }
} }
return new Jdbc2ResultSet(connection, f, v, "OK", 1); return connection.getResultSet(null, f, v, "OK", 1);
} }
......
package org.postgresql.jdbc2;
import java.sql.*;
public class Jdbc2CallableStatement extends AbstractJdbc2Statement implements java.sql.CallableStatement
{
public Jdbc2CallableStatement(Jdbc2Connection connection, String sql) throws SQLException
{
super(connection, sql);
}
}
...@@ -3,9 +3,10 @@ package org.postgresql.jdbc2; ...@@ -3,9 +3,10 @@ package org.postgresql.jdbc2;
import java.sql.*; import java.sql.*;
import java.util.Vector; import java.util.Vector;
import java.util.Hashtable;
import org.postgresql.Field; import org.postgresql.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Connection.java,v 1.2 2002/07/24 22:08:42 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Connection.java,v 1.3 2002/07/25 22:45:28 barry Exp $
* This class implements the java.sql.Connection interface for JDBC2. * This class implements the java.sql.Connection interface for JDBC2.
* However most of the implementation is really done in * However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2Connection or one of it's parents * org.postgresql.jdbc2.AbstractJdbc2Connection or one of it's parents
...@@ -32,7 +33,7 @@ public class Jdbc2Connection extends org.postgresql.jdbc2.AbstractJdbc2Connectio ...@@ -32,7 +33,7 @@ public class Jdbc2Connection extends org.postgresql.jdbc2.AbstractJdbc2Connectio
public java.sql.CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException public java.sql.CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{ {
org.postgresql.jdbc2.CallableStatement s = new org.postgresql.jdbc2.CallableStatement(this,sql); Jdbc2CallableStatement s = new org.postgresql.jdbc2.Jdbc2CallableStatement(this,sql);
s.setResultSetType(resultSetType); s.setResultSetType(resultSetType);
s.setResultSetConcurrency(resultSetConcurrency); s.setResultSetConcurrency(resultSetConcurrency);
return s; return s;
...@@ -45,15 +46,14 @@ public class Jdbc2Connection extends org.postgresql.jdbc2.AbstractJdbc2Connectio ...@@ -45,15 +46,14 @@ public class Jdbc2Connection extends org.postgresql.jdbc2.AbstractJdbc2Connectio
return metadata; return metadata;
} }
public java.sql.ResultSet getResultSet(java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
{ {
if (stat != null) return new Jdbc2ResultSet(this, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
{
if (stat.getResultSetConcurrency() == java.sql.ResultSet.CONCUR_UPDATABLE)
return new org.postgresql.jdbc2.UpdateableResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
} }
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor); public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException
{
return new Jdbc2ResultSet(this, statement, fields, tuples, status, updateCount, 0, false);
} }
......
...@@ -5,7 +5,7 @@ import java.sql.*; ...@@ -5,7 +5,7 @@ import java.sql.*;
import java.util.Vector; import java.util.Vector;
import org.postgresql.Field; import org.postgresql.Field;
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.1 2002/07/23 03:59:55 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.2 2002/07/25 22:45:28 barry Exp $
* This class implements the java.sql.ResultSet interface for JDBC2. * This class implements the java.sql.ResultSet interface for JDBC2.
* However most of the implementation is really done in * However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2ResultSet or one of it's parents * org.postgresql.jdbc2.AbstractJdbc2ResultSet or one of it's parents
...@@ -13,14 +13,9 @@ import org.postgresql.Field; ...@@ -13,14 +13,9 @@ import org.postgresql.Field;
public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet implements java.sql.ResultSet public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet implements java.sql.ResultSet
{ {
public Jdbc2ResultSet(Jdbc2Connection conn, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) public Jdbc2ResultSet(Jdbc2Connection conn, Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{ {
super(conn, fields, tuples, status, updateCount, insertOID, binaryCursor); super(conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
}
public Jdbc2ResultSet(Jdbc2Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
{
super(conn, fields, tuples, status, updateCount, 0, false);
} }
public java.sql.ResultSetMetaData getMetaData() throws SQLException public java.sql.ResultSetMetaData getMetaData() throws SQLException
......
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