}
//The build number should be incremented for every new build
- private static int m_buildNumber = 102;
+ private static int m_buildNumber = 103;
}
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
* extended by org.postgresql.jdbc2.AbstractJdbc2Connection which adds the jdbc2
* methods. The real Connection class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Connection
*/
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.
*
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.
* @param msg message to add
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.util.*;
import org.postgresql.Field;
import org.postgresql.util.PSQLException;
-/*
- * This class provides information about the database as a whole.
- *
- * $Id: DatabaseMetaData.java,v 1.49 2002/07/25 22:45:28 barry Exp $
- *
- *
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.
- *
- *
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.
- *
- *
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
+public abstract class AbstractJdbc1DatabaseMetaData
{
- Jdbc1Connection connection; // The connection association
+ protected AbstractJdbc1Connection 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
+ protected static final int iVarcharOid = 1043; // OID for varchar
+ protected static final int iBoolOid = 16; // OID for bool
+ protected static final int iInt2Oid = 21; // OID for int2
+ protected static final int iInt4Oid = 23; // OID for int4
+ protected static final int VARHDRSZ = 4; // length for int4
- public DatabaseMetaData(Jdbc1Connection conn)
+ public AbstractJdbc1DatabaseMetaData(AbstractJdbc1Connection conn)
{
this.connection = conn;
}
if (col > -1)
{
String rule = proname.substring(8, proname.length() - 4);
- int action = importedKeyNoAction;
+ int action = java.sql.DatabaseMetaData.importedKeyNoAction;
if ("cascade".equals(rule))
- action = importedKeyCascade;
+ action = java.sql.DatabaseMetaData.importedKeyCascade;
else if ("setnull".equals(rule))
- action = importedKeySetNull;
+ action = java.sql.DatabaseMetaData.importedKeySetNull;
else if ("setdefault".equals(rule))
- action = importedKeySetDefault;
+ action = java.sql.DatabaseMetaData.importedKeySetDefault;
tuple[col] = Integer.toString(action).getBytes();
if (!foundRule)
tuple[12] = rs.getBytes(4); //PK_NAME
// DEFERRABILITY
- int deferrability = importedKeyNotDeferrable;
+ int deferrability = java.sql.DatabaseMetaData.importedKeyNotDeferrable;
boolean deferrable = rs.getBoolean(5);
boolean initiallyDeferred = rs.getBoolean(6);
if (deferrable)
{
if (initiallyDeferred)
- deferrability = importedKeyInitiallyDeferred;
+ deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyDeferred;
else
- deferrability = importedKeyInitiallyImmediate;
+ deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyImmediate;
}
tuple[13] = Integer.toString(deferrability).getBytes();
byte b9[] = "9".getBytes();
byte b10[] = "10".getBytes();
byte bf[] = "f".getBytes();
- byte bnn[] = Integer.toString(typeNoNulls).getBytes();
- byte bts[] = Integer.toString(typeSearchable).getBytes();
+ byte bnn[] = Integer.toString(java.sql.DatabaseMetaData.typeNoNulls).getBytes();
+ byte bts[] = Integer.toString(java.sql.DatabaseMetaData.typeSearchable).getBytes();
while (rs.next())
{
tuple[4] = null;
tuple[5] = r.getBytes(3);
tuple[6] = r.getBoolean(4) ?
- Integer.toString(tableIndexClustered).getBytes() :
+ Integer.toString(java.sql.DatabaseMetaData.tableIndexClustered).getBytes() :
r.getString(5).equals("hash") ?
- Integer.toString(tableIndexHashed).getBytes() :
- Integer.toString(tableIndexOther).getBytes();
+ Integer.toString(java.sql.DatabaseMetaData.tableIndexHashed).getBytes() :
+ Integer.toString(java.sql.DatabaseMetaData.tableIndexOther).getBytes();
tuple[7] = Integer.toString(i + 1).getBytes();
if (columnNameRS.next())
{
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.util.*;
import org.postgresql.*;
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.Types;
-/*
- * 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
+public abstract class AbstractJdbc1ResultSetMetaData
{
- Vector rows;
- Field[] fields;
+ protected Vector rows;
+ protected Field[] fields;
/*
* Initialise for a result with a tuple set and
* @param rows the Vector of rows returned by the ResultSet
* @param fields the array of field descriptors
*/
- public ResultSetMetaData(Vector rows, Field[] fields)
+ public AbstractJdbc1ResultSetMetaData(Vector rows, Field[] fields)
{
this.rows = rows;
this.fields = fields;
* defined with NOT NULL or PRIMARY KEY, CHECK constraints, views,
* functions etc.
*/
- return columnNullableUnknown;
+ return java.sql.ResultSetMetaData.columnNullableUnknown;
}
/*
import org.postgresql.Field;
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.
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1Connection
public java.sql.DatabaseMetaData getMetaData() throws SQLException
{
if (metadata == null)
- metadata = new org.postgresql.jdbc1.DatabaseMetaData(this);
+ metadata = new org.postgresql.jdbc1.Jdbc1DatabaseMetaData(this);
return metadata;
}
--- /dev/null
+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);
+ }
+
+}
import java.util.Vector;
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.
* However most of the implementation is really done in
* org.postgresql.jdbc1.AbstractJdbc1ResultSet
public java.sql.ResultSetMetaData getMetaData() throws SQLException
{
- return new ResultSetMetaData(rows, fields);
+ return new Jdbc1ResultSetMetaData(rows, fields);
}
}
--- /dev/null
+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;
-// 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.util.*;
import org.postgresql.Field;
import org.postgresql.util.PSQLException;
-/*
- * This class provides information about the database as a whole.
- *
- * $Id: DatabaseMetaData.java,v 1.60 2002/07/25 22:45:28 barry Exp $
- *
- *
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.
- *
- *
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.
- *
- *
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
+public abstract class AbstractJdbc2DatabaseMetaData extends org.postgresql.jdbc1.AbstractJdbc1DatabaseMetaData
{
- 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);
}
/*
String rule = updateRule.substring(8, updateRule.length() - 4);
- int action = importedKeyNoAction;
+ int action = java.sql.DatabaseMetaData.importedKeyNoAction;
if ( rule == null || "noaction".equals(rule) )
- action = importedKeyNoAction;
+ action = java.sql.DatabaseMetaData.importedKeyNoAction;
if ("cascade".equals(rule))
- action = importedKeyCascade;
+ action = java.sql.DatabaseMetaData.importedKeyCascade;
else if ("setnull".equals(rule))
- action = importedKeySetNull;
+ action = java.sql.DatabaseMetaData.importedKeySetNull;
else if ("setdefault".equals(rule))
- action = importedKeySetDefault;
+ action = java.sql.DatabaseMetaData.importedKeySetDefault;
else if ("restrict".equals(rule))
- action = importedKeyRestrict;
+ action = java.sql.DatabaseMetaData.importedKeyRestrict;
tuple[9] = Integer.toString(action).getBytes();
String rule = updateRule.substring(8, updateRule.length() - 4);
- int action = importedKeyNoAction;
+ int action = java.sql.DatabaseMetaData.importedKeyNoAction;
if ("cascade".equals(rule))
- action = importedKeyCascade;
+ action = java.sql.DatabaseMetaData.importedKeyCascade;
else if ("setnull".equals(rule))
- action = importedKeySetNull;
+ action = java.sql.DatabaseMetaData.importedKeySetNull;
else if ("setdefault".equals(rule))
- action = importedKeySetDefault;
+ action = java.sql.DatabaseMetaData.importedKeySetDefault;
tuple[10] = Integer.toString(action).getBytes();
}
tuple[12] = rs.getBytes(5); //PK_NAME
// DEFERRABILITY
- int deferrability = importedKeyNotDeferrable;
+ int deferrability = java.sql.DatabaseMetaData.importedKeyNotDeferrable;
boolean deferrable = rs.getBoolean(6);
boolean initiallyDeferred = rs.getBoolean(7);
if (deferrable)
{
if (initiallyDeferred)
- deferrability = importedKeyInitiallyDeferred;
+ deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyDeferred;
else
- deferrability = importedKeyInitiallyImmediate;
+ deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyImmediate;
}
tuple[13] = Integer.toString(deferrability).getBytes();
byte b9[] = "9".getBytes();
byte b10[] = "10".getBytes();
byte bf[] = "f".getBytes();
- byte bnn[] = Integer.toString(typeNoNulls).getBytes();
- byte bts[] = Integer.toString(typeSearchable).getBytes();
+ byte bnn[] = Integer.toString(java.sql.DatabaseMetaData.typeNoNulls).getBytes();
+ byte bts[] = Integer.toString(java.sql.DatabaseMetaData.typeSearchable).getBytes();
while (rs.next())
{
tuple[4] = null;
tuple[5] = r.getBytes(3);
tuple[6] = r.getBoolean(4) ?
- Integer.toString(tableIndexClustered).getBytes() :
+ Integer.toString(java.sql.DatabaseMetaData.tableIndexClustered).getBytes() :
r.getString(5).equals("hash") ?
- Integer.toString(tableIndexHashed).getBytes() :
- Integer.toString(tableIndexOther).getBytes();
+ Integer.toString(java.sql.DatabaseMetaData.tableIndexHashed).getBytes() :
+ Integer.toString(java.sql.DatabaseMetaData.tableIndexOther).getBytes();
tuple[7] = Integer.toString(i + 1).getBytes();
if (columnNameRS.next())
tuple[8] = columnNameRS.getBytes(1);
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.sql.*;
import org.postgresql.*;
import org.postgresql.util.*;
-/**
- * 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
+public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc1.AbstractJdbc1ResultSetMetaData
{
- Vector rows;
- Field[] fields;
/*
* Initialise for a result with a tuple set and
* @param rows the Vector of rows returned by the ResultSet
* @param fields the array of field descriptors
*/
- public ResultSetMetaData(Vector rows, Field[] fields)
+ public AbstractJdbc2ResultSetMetaData(Vector rows, Field[] fields)
{
- this.rows = rows;
- this.fields = fields;
+ super(rows, fields);
}
/*
* defined with NOT NULL or PRIMARY KEY, CHECK constraints, views,
* functions etc.
*/
- return columnNullableUnknown;
+ return java.sql.ResultSetMetaData.columnNullableUnknown;
}
/*
import java.util.Hashtable;
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.
* However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2Connection or one of it's parents
public java.sql.DatabaseMetaData getMetaData() throws SQLException
{
if (metadata == null)
- metadata = new org.postgresql.jdbc2.DatabaseMetaData(this);
+ metadata = new org.postgresql.jdbc2.Jdbc2DatabaseMetaData(this);
return metadata;
}
--- /dev/null
+package org.postgresql.jdbc2;
+
+
+public class Jdbc2DatabaseMetaData extends AbstractJdbc2DatabaseMetaData implements java.sql.DatabaseMetaData
+{
+ public Jdbc2DatabaseMetaData(Jdbc2Connection conn)
+ {
+ super(conn);
+ }
+
+}
import java.util.Vector;
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.
* However most of the implementation is really done in
* org.postgresql.jdbc2.AbstractJdbc2ResultSet or one of it's parents
public java.sql.ResultSetMetaData getMetaData() throws SQLException
{
- return new ResultSetMetaData(rows, fields);
+ return new Jdbc2ResultSetMetaData(rows, fields);
}
}
--- /dev/null
+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);
+ }
+}
+