Commit 40c44166 authored by Barry Lind's avatar Barry Lind

Fouth (and final) phase of restructuring to add jdbc3 support.

 Modified Files:
 	jdbc/org/postgresql/Driver.java.in
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
 	jdbc/org/postgresql/jdbc1/Jdbc1Connection.java
 	jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java
 	jdbc/org/postgresql/jdbc2/Jdbc2Connection.java
 	jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java
 Added Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc1/Jdbc1DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc1/Jdbc1ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc2/Jdbc2DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc2/Jdbc2ResultSetMetaData.java
 Removed Files:
 	jdbc/org/postgresql/jdbc1/DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc1/ResultSetMetaData.java
 	jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
 	jdbc/org/postgresql/jdbc2/ResultSetMetaData.java
parent 68c6eff9
...@@ -442,6 +442,6 @@ public class Driver implements java.sql.Driver ...@@ -442,6 +442,6 @@ public class Driver implements java.sql.Driver
} }
//The build number should be incremented for every new build //The build number should be incremented for every new build
private static int m_buildNumber = 102; private static int m_buildNumber = 103;
} }
...@@ -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.2 2002/07/25 22:45:27 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.3 2002/07/26 05:29:34 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
...@@ -78,6 +78,10 @@ public abstract class AbstractJdbc1Connection implements org.postgresql.PGConnec ...@@ -78,6 +78,10 @@ public abstract class AbstractJdbc1Connection implements org.postgresql.PGConnec
*/ */
private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED; private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
public abstract java.sql.Statement createStatement() throws SQLException;
/* /*
* This method actually opens the connection. It is called by Driver. * This method actually opens the connection. It is called by Driver.
* *
...@@ -361,6 +365,8 @@ public abstract class AbstractJdbc1Connection implements org.postgresql.PGConnec ...@@ -361,6 +365,8 @@ public abstract class AbstractJdbc1Connection implements org.postgresql.PGConnec
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(Statement statement, org.postgresql.Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException;
public abstract java.sql.ResultSet getResultSet(Statement statement, org.postgresql.Field[] fields, Vector tuples, String status, int updateCount) throws SQLException;
/* /*
* This adds a warning to the warning chain. * This adds a warning to the warning chain.
* @param msg message to add * @param msg message to add
......
package org.postgresql.jdbc1; package org.postgresql.jdbc1;
// IMPORTANT NOTE: This file implements the JDBC 1 version of the driver.
// If you make any modifications to this file, you must make sure that the
// changes are also made (if relevent) to the related JDBC 2 class in the
// org.postgresql.jdbc2 package.
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import org.postgresql.Field; import org.postgresql.Field;
import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLException;
/* public abstract class AbstractJdbc1DatabaseMetaData
* This class provides information about the database as a whole.
*
* $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
* can use the normal ResultSet methods such as getString and getInt to
* retrieve the data from these ResultSets. If a given form of metadata is
* not available, these methods should throw a SQLException.
*
* <p>Some of these methods take arguments that are String patterns. These
* arguments all have names such as fooPattern. Within a pattern String,
* "%" means match any substring of 0 or more characters, and "_" means
* match any one character. Only metadata entries matching the search
* pattern are returned. if a search pattern argument is set to a null
* ref, it means that argument's criteria should be dropped from the
* search.
*
* <p>A SQLException will be throws if a driver does not support a meta
* data method. In the case of methods that return a ResultSet, either
* a ResultSet (which may be empty) is returned or a SQLException is
* thrown.
*
* @see java.sql.DatabaseMetaData
*/
public class DatabaseMetaData implements java.sql.DatabaseMetaData
{ {
Jdbc1Connection connection; // The connection association protected AbstractJdbc1Connection connection; // The connection association
// These define various OID's. Hopefully they will stay constant. // These define various OID's. Hopefully they will stay constant.
static final int iVarcharOid = 1043; // OID for varchar protected static final int iVarcharOid = 1043; // OID for varchar
static final int iBoolOid = 16; // OID for bool protected static final int iBoolOid = 16; // OID for bool
static final int iInt2Oid = 21; // OID for int2 protected static final int iInt2Oid = 21; // OID for int2
static final int iInt4Oid = 23; // OID for int4 protected static final int iInt4Oid = 23; // OID for int4
static final int VARHDRSZ = 4; // length for int4 protected static final int VARHDRSZ = 4; // length for int4
public DatabaseMetaData(Jdbc1Connection conn) public AbstractJdbc1DatabaseMetaData(AbstractJdbc1Connection conn)
{ {
this.connection = conn; this.connection = conn;
} }
...@@ -2340,13 +2311,13 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2340,13 +2311,13 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
if (col > -1) if (col > -1)
{ {
String rule = proname.substring(8, proname.length() - 4); String rule = proname.substring(8, proname.length() - 4);
int action = importedKeyNoAction; int action = java.sql.DatabaseMetaData.importedKeyNoAction;
if ("cascade".equals(rule)) if ("cascade".equals(rule))
action = importedKeyCascade; action = java.sql.DatabaseMetaData.importedKeyCascade;
else if ("setnull".equals(rule)) else if ("setnull".equals(rule))
action = importedKeySetNull; action = java.sql.DatabaseMetaData.importedKeySetNull;
else if ("setdefault".equals(rule)) else if ("setdefault".equals(rule))
action = importedKeySetDefault; action = java.sql.DatabaseMetaData.importedKeySetDefault;
tuple[col] = Integer.toString(action).getBytes(); tuple[col] = Integer.toString(action).getBytes();
if (!foundRule) if (!foundRule)
...@@ -2388,15 +2359,15 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2388,15 +2359,15 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
tuple[12] = rs.getBytes(4); //PK_NAME tuple[12] = rs.getBytes(4); //PK_NAME
// DEFERRABILITY // DEFERRABILITY
int deferrability = importedKeyNotDeferrable; int deferrability = java.sql.DatabaseMetaData.importedKeyNotDeferrable;
boolean deferrable = rs.getBoolean(5); boolean deferrable = rs.getBoolean(5);
boolean initiallyDeferred = rs.getBoolean(6); boolean initiallyDeferred = rs.getBoolean(6);
if (deferrable) if (deferrable)
{ {
if (initiallyDeferred) if (initiallyDeferred)
deferrability = importedKeyInitiallyDeferred; deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyDeferred;
else else
deferrability = importedKeyInitiallyImmediate; deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyImmediate;
} }
tuple[13] = Integer.toString(deferrability).getBytes(); tuple[13] = Integer.toString(deferrability).getBytes();
...@@ -2669,8 +2640,8 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2669,8 +2640,8 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
byte b9[] = "9".getBytes(); byte b9[] = "9".getBytes();
byte b10[] = "10".getBytes(); byte b10[] = "10".getBytes();
byte bf[] = "f".getBytes(); byte bf[] = "f".getBytes();
byte bnn[] = Integer.toString(typeNoNulls).getBytes(); byte bnn[] = Integer.toString(java.sql.DatabaseMetaData.typeNoNulls).getBytes();
byte bts[] = Integer.toString(typeSearchable).getBytes(); byte bts[] = Integer.toString(java.sql.DatabaseMetaData.typeSearchable).getBytes();
while (rs.next()) while (rs.next())
{ {
...@@ -2811,10 +2782,10 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData ...@@ -2811,10 +2782,10 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
tuple[4] = null; tuple[4] = null;
tuple[5] = r.getBytes(3); tuple[5] = r.getBytes(3);
tuple[6] = r.getBoolean(4) ? tuple[6] = r.getBoolean(4) ?
Integer.toString(tableIndexClustered).getBytes() : Integer.toString(java.sql.DatabaseMetaData.tableIndexClustered).getBytes() :
r.getString(5).equals("hash") ? r.getString(5).equals("hash") ?
Integer.toString(tableIndexHashed).getBytes() : Integer.toString(java.sql.DatabaseMetaData.tableIndexHashed).getBytes() :
Integer.toString(tableIndexOther).getBytes(); Integer.toString(java.sql.DatabaseMetaData.tableIndexOther).getBytes();
tuple[7] = Integer.toString(i + 1).getBytes(); tuple[7] = Integer.toString(i + 1).getBytes();
if (columnNameRS.next()) if (columnNameRS.next())
{ {
......
package org.postgresql.jdbc1; package org.postgresql.jdbc1;
// IMPORTANT NOTE: This file implements the JDBC 1 version of the driver.
// If you make any modifications to this file, you must make sure that the
// changes are also made (if relevent) to the related JDBC 2 class in the
// org.postgresql.jdbc2 package.
import java.lang.*; import java.lang.*;
import java.util.*; import java.util.*;
import org.postgresql.*; import org.postgresql.*;
import org.postgresql.util.*; import org.postgresql.util.*;
// We explicitly import classes here as the original line:
//import java.sql.*;
// causes javac to get confused.
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Types; import java.sql.Types;
/* public abstract class AbstractJdbc1ResultSetMetaData
* A ResultSetMetaData object can be used to find out about the types and
* properties of the columns in a ResultSet
*
* @see java.sql.ResultSetMetaData
*/
public class ResultSetMetaData implements java.sql.ResultSetMetaData
{ {
Vector rows; protected Vector rows;
Field[] fields; protected Field[] fields;
/* /*
* Initialise for a result with a tuple set and * Initialise for a result with a tuple set and
...@@ -34,7 +20,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData ...@@ -34,7 +20,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
* @param rows the Vector of rows returned by the ResultSet * @param rows the Vector of rows returned by the ResultSet
* @param fields the array of field descriptors * @param fields the array of field descriptors
*/ */
public ResultSetMetaData(Vector rows, Field[] fields) public AbstractJdbc1ResultSetMetaData(Vector rows, Field[] fields)
{ {
this.rows = rows; this.rows = rows;
this.fields = fields; this.fields = fields;
...@@ -149,7 +135,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData ...@@ -149,7 +135,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
* defined with NOT NULL or PRIMARY KEY, CHECK constraints, views, * defined with NOT NULL or PRIMARY KEY, CHECK constraints, views,
* functions etc. * functions etc.
*/ */
return columnNullableUnknown; return java.sql.ResultSetMetaData.columnNullableUnknown;
} }
/* /*
......
...@@ -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.3 2002/07/25 22:45:28 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Connection.java,v 1.4 2002/07/26 05:29:35 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
...@@ -32,7 +32,7 @@ public class Jdbc1Connection extends org.postgresql.jdbc1.AbstractJdbc1Connectio ...@@ -32,7 +32,7 @@ public class Jdbc1Connection extends org.postgresql.jdbc1.AbstractJdbc1Connectio
public java.sql.DatabaseMetaData getMetaData() throws SQLException public java.sql.DatabaseMetaData getMetaData() throws SQLException
{ {
if (metadata == null) if (metadata == null)
metadata = new org.postgresql.jdbc1.DatabaseMetaData(this); metadata = new org.postgresql.jdbc1.Jdbc1DatabaseMetaData(this);
return metadata; return metadata;
} }
......
package org.postgresql.jdbc1;
import java.sql.*;
import java.util.*;
import org.postgresql.Field;
import org.postgresql.util.PSQLException;
public class Jdbc1DatabaseMetaData extends AbstractJdbc1DatabaseMetaData implements java.sql.DatabaseMetaData
{
public Jdbc1DatabaseMetaData(Jdbc1Connection conn)
{
super(conn);
}
}
...@@ -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.2 2002/07/25 22:45:28 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1ResultSet.java,v 1.3 2002/07/26 05:29:35 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
...@@ -20,7 +20,7 @@ public class Jdbc1ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet ...@@ -20,7 +20,7 @@ public class Jdbc1ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet
public java.sql.ResultSetMetaData getMetaData() throws SQLException public java.sql.ResultSetMetaData getMetaData() throws SQLException
{ {
return new ResultSetMetaData(rows, fields); return new Jdbc1ResultSetMetaData(rows, fields);
} }
} }
......
package org.postgresql.jdbc1;
public class Jdbc1ResultSetMetaData extends AbstractJdbc1ResultSetMetaData implements java.sql.ResultSetMetaData
{
public Jdbc1ResultSetMetaData(java.util.Vector rows, org.postgresql.Field[] fields)
{
super(rows, fields);
}
}
package org.postgresql.jdbc2; package org.postgresql.jdbc2;
// IMPORTANT NOTE: This file implements the JDBC 2 version of the driver.
// If you make any modifications to this file, you must make sure that the
// changes are also made (if relevent) to the related JDBC 1 class in the
// org.postgresql.jdbc1 package.
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
...@@ -12,45 +7,12 @@ import org.postgresql.Driver; ...@@ -12,45 +7,12 @@ import org.postgresql.Driver;
import org.postgresql.Field; import org.postgresql.Field;
import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLException;
/* public abstract class AbstractJdbc2DatabaseMetaData extends org.postgresql.jdbc1.AbstractJdbc1DatabaseMetaData
* This class provides information about the database as a whole.
*
* $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
* can use the normal ResultSet methods such as getString and getInt to
* retrieve the data from these ResultSets. If a given form of metadata is
* not available, these methods should throw a SQLException.
*
* <p>Some of these methods take arguments that are String patterns. These
* arguments all have names such as fooPattern. Within a pattern String,
* "%" means match any substring of 0 or more characters, and "_" means
* match any one character. Only metadata entries matching the search
* pattern are returned. if a search pattern argument is set to a null
* ref, it means that argument's criteria should be dropped from the
* search.
*
* <p>A SQLException will be throws if a driver does not support a meta
* data method. In the case of methods that return a ResultSet, either
* a ResultSet (which may be empty) is returned or a SQLException is
* thrown.
*
* @see java.sql.DatabaseMetaData
*/
public class DatabaseMetaData implements java.sql.DatabaseMetaData
{ {
Jdbc2Connection connection; // The connection association
// These define various OID's. Hopefully they will stay constant.
static final int iVarcharOid = 1043; // OID for varchar
static final int iBoolOid = 16; // OID for bool
static final int iInt2Oid = 21; // OID for int2
static final int iInt4Oid = 23; // OID for int4
static final int VARHDRSZ = 4; // length for int4
public DatabaseMetaData(Jdbc2Connection conn) public AbstractJdbc2DatabaseMetaData(AbstractJdbc2Connection conn)
{ {
this.connection = conn; super(conn);
} }
/* /*
...@@ -2589,18 +2551,18 @@ WHERE ...@@ -2589,18 +2551,18 @@ WHERE
String rule = updateRule.substring(8, updateRule.length() - 4); String rule = updateRule.substring(8, updateRule.length() - 4);
int action = importedKeyNoAction; int action = java.sql.DatabaseMetaData.importedKeyNoAction;
if ( rule == null || "noaction".equals(rule) ) if ( rule == null || "noaction".equals(rule) )
action = importedKeyNoAction; action = java.sql.DatabaseMetaData.importedKeyNoAction;
if ("cascade".equals(rule)) if ("cascade".equals(rule))
action = importedKeyCascade; action = java.sql.DatabaseMetaData.importedKeyCascade;
else if ("setnull".equals(rule)) else if ("setnull".equals(rule))
action = importedKeySetNull; action = java.sql.DatabaseMetaData.importedKeySetNull;
else if ("setdefault".equals(rule)) else if ("setdefault".equals(rule))
action = importedKeySetDefault; action = java.sql.DatabaseMetaData.importedKeySetDefault;
else if ("restrict".equals(rule)) else if ("restrict".equals(rule))
action = importedKeyRestrict; action = java.sql.DatabaseMetaData.importedKeyRestrict;
tuple[9] = Integer.toString(action).getBytes(); tuple[9] = Integer.toString(action).getBytes();
...@@ -2613,13 +2575,13 @@ WHERE ...@@ -2613,13 +2575,13 @@ WHERE
String rule = updateRule.substring(8, updateRule.length() - 4); String rule = updateRule.substring(8, updateRule.length() - 4);
int action = importedKeyNoAction; int action = java.sql.DatabaseMetaData.importedKeyNoAction;
if ("cascade".equals(rule)) if ("cascade".equals(rule))
action = importedKeyCascade; action = java.sql.DatabaseMetaData.importedKeyCascade;
else if ("setnull".equals(rule)) else if ("setnull".equals(rule))
action = importedKeySetNull; action = java.sql.DatabaseMetaData.importedKeySetNull;
else if ("setdefault".equals(rule)) else if ("setdefault".equals(rule))
action = importedKeySetDefault; action = java.sql.DatabaseMetaData.importedKeySetDefault;
tuple[10] = Integer.toString(action).getBytes(); tuple[10] = Integer.toString(action).getBytes();
} }
...@@ -2665,15 +2627,15 @@ WHERE ...@@ -2665,15 +2627,15 @@ WHERE
tuple[12] = rs.getBytes(5); //PK_NAME tuple[12] = rs.getBytes(5); //PK_NAME
// DEFERRABILITY // DEFERRABILITY
int deferrability = importedKeyNotDeferrable; int deferrability = java.sql.DatabaseMetaData.importedKeyNotDeferrable;
boolean deferrable = rs.getBoolean(6); boolean deferrable = rs.getBoolean(6);
boolean initiallyDeferred = rs.getBoolean(7); boolean initiallyDeferred = rs.getBoolean(7);
if (deferrable) if (deferrable)
{ {
if (initiallyDeferred) if (initiallyDeferred)
deferrability = importedKeyInitiallyDeferred; deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyDeferred;
else else
deferrability = importedKeyInitiallyImmediate; deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyImmediate;
} }
tuple[13] = Integer.toString(deferrability).getBytes(); tuple[13] = Integer.toString(deferrability).getBytes();
...@@ -2936,8 +2898,8 @@ WHERE ...@@ -2936,8 +2898,8 @@ WHERE
byte b9[] = "9".getBytes(); byte b9[] = "9".getBytes();
byte b10[] = "10".getBytes(); byte b10[] = "10".getBytes();
byte bf[] = "f".getBytes(); byte bf[] = "f".getBytes();
byte bnn[] = Integer.toString(typeNoNulls).getBytes(); byte bnn[] = Integer.toString(java.sql.DatabaseMetaData.typeNoNulls).getBytes();
byte bts[] = Integer.toString(typeSearchable).getBytes(); byte bts[] = Integer.toString(java.sql.DatabaseMetaData.typeSearchable).getBytes();
while (rs.next()) while (rs.next())
{ {
...@@ -3079,10 +3041,10 @@ WHERE ...@@ -3079,10 +3041,10 @@ WHERE
tuple[4] = null; tuple[4] = null;
tuple[5] = r.getBytes(3); tuple[5] = r.getBytes(3);
tuple[6] = r.getBoolean(4) ? tuple[6] = r.getBoolean(4) ?
Integer.toString(tableIndexClustered).getBytes() : Integer.toString(java.sql.DatabaseMetaData.tableIndexClustered).getBytes() :
r.getString(5).equals("hash") ? r.getString(5).equals("hash") ?
Integer.toString(tableIndexHashed).getBytes() : Integer.toString(java.sql.DatabaseMetaData.tableIndexHashed).getBytes() :
Integer.toString(tableIndexOther).getBytes(); Integer.toString(java.sql.DatabaseMetaData.tableIndexOther).getBytes();
tuple[7] = Integer.toString(i + 1).getBytes(); tuple[7] = Integer.toString(i + 1).getBytes();
if (columnNameRS.next()) if (columnNameRS.next())
tuple[8] = columnNameRS.getBytes(1); tuple[8] = columnNameRS.getBytes(1);
......
package org.postgresql.jdbc2; package org.postgresql.jdbc2;
// IMPORTANT NOTE: This file implements the JDBC 2 version of the driver.
// If you make any modifications to this file, you must make sure that the
// changes are also made (if relevent) to the related JDBC 1 class in the
// org.postgresql.jdbc1 package.
import java.lang.*; import java.lang.*;
import java.sql.*; import java.sql.*;
...@@ -11,16 +7,8 @@ import java.util.*; ...@@ -11,16 +7,8 @@ import java.util.*;
import org.postgresql.*; import org.postgresql.*;
import org.postgresql.util.*; import org.postgresql.util.*;
/** public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc1.AbstractJdbc1ResultSetMetaData
* A ResultSetMetaData object can be used to find out about the types and
* properties of the columns in a ResultSet
*
* @see java.sql.ResultSetMetaData
*/
public class ResultSetMetaData implements java.sql.ResultSetMetaData
{ {
Vector rows;
Field[] fields;
/* /*
* Initialise for a result with a tuple set and * Initialise for a result with a tuple set and
...@@ -29,10 +17,9 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData ...@@ -29,10 +17,9 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
* @param rows the Vector of rows returned by the ResultSet * @param rows the Vector of rows returned by the ResultSet
* @param fields the array of field descriptors * @param fields the array of field descriptors
*/ */
public ResultSetMetaData(Vector rows, Field[] fields) public AbstractJdbc2ResultSetMetaData(Vector rows, Field[] fields)
{ {
this.rows = rows; super(rows, fields);
this.fields = fields;
} }
/* /*
...@@ -144,7 +131,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData ...@@ -144,7 +131,7 @@ public class ResultSetMetaData implements java.sql.ResultSetMetaData
* defined with NOT NULL or PRIMARY KEY, CHECK constraints, views, * defined with NOT NULL or PRIMARY KEY, CHECK constraints, views,
* functions etc. * functions etc.
*/ */
return columnNullableUnknown; return java.sql.ResultSetMetaData.columnNullableUnknown;
} }
/* /*
......
...@@ -6,7 +6,7 @@ import java.util.Vector; ...@@ -6,7 +6,7 @@ import java.util.Vector;
import java.util.Hashtable; 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.3 2002/07/25 22:45:28 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Connection.java,v 1.4 2002/07/26 05:29:35 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
...@@ -42,7 +42,7 @@ public class Jdbc2Connection extends org.postgresql.jdbc2.AbstractJdbc2Connectio ...@@ -42,7 +42,7 @@ public class Jdbc2Connection extends org.postgresql.jdbc2.AbstractJdbc2Connectio
public java.sql.DatabaseMetaData getMetaData() throws SQLException public java.sql.DatabaseMetaData getMetaData() throws SQLException
{ {
if (metadata == null) if (metadata == null)
metadata = new org.postgresql.jdbc2.DatabaseMetaData(this); metadata = new org.postgresql.jdbc2.Jdbc2DatabaseMetaData(this);
return metadata; return metadata;
} }
......
package org.postgresql.jdbc2;
public class Jdbc2DatabaseMetaData extends AbstractJdbc2DatabaseMetaData implements java.sql.DatabaseMetaData
{
public Jdbc2DatabaseMetaData(Jdbc2Connection conn)
{
super(conn);
}
}
...@@ -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.2 2002/07/25 22:45:28 barry Exp $ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.3 2002/07/26 05:29:35 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
...@@ -20,7 +20,7 @@ public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet ...@@ -20,7 +20,7 @@ public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet
public java.sql.ResultSetMetaData getMetaData() throws SQLException public java.sql.ResultSetMetaData getMetaData() throws SQLException
{ {
return new ResultSetMetaData(rows, fields); return new Jdbc2ResultSetMetaData(rows, fields);
} }
} }
......
package org.postgresql.jdbc2;
public class Jdbc2ResultSetMetaData extends AbstractJdbc2ResultSetMetaData implements java.sql.ResultSetMetaData
{
public Jdbc2ResultSetMetaData(java.util.Vector rows, org.postgresql.Field[] fields)
{
super(rows, fields);
}
}
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