OSDN Git Service

JDBC is now on GBorg
authorPostgreSQL Daemon <webmaster@postgresql.org>
Mon, 19 Jan 2004 20:07:14 +0000 (20:07 +0000)
committerPostgreSQL Daemon <webmaster@postgresql.org>
Mon, 19 Jan 2004 20:07:14 +0000 (20:07 +0000)
147 files changed:
src/interfaces/jdbc/Makefile [deleted file]
src/interfaces/jdbc/README [deleted file]
src/interfaces/jdbc/build.xml [deleted file]
src/interfaces/jdbc/example/ImageViewer.java [deleted file]
src/interfaces/jdbc/example/Unicode.java [deleted file]
src/interfaces/jdbc/example/basic.java [deleted file]
src/interfaces/jdbc/example/blobtest.java [deleted file]
src/interfaces/jdbc/example/corba/StockClient.java [deleted file]
src/interfaces/jdbc/example/corba/StockDB.java [deleted file]
src/interfaces/jdbc/example/corba/StockDispenserImpl.java [deleted file]
src/interfaces/jdbc/example/corba/StockItemImpl.java [deleted file]
src/interfaces/jdbc/example/corba/StockServer.java [deleted file]
src/interfaces/jdbc/example/corba/readme [deleted file]
src/interfaces/jdbc/example/corba/stock.idl [deleted file]
src/interfaces/jdbc/example/corba/stock.sql [deleted file]
src/interfaces/jdbc/example/datestyle.java [deleted file]
src/interfaces/jdbc/example/metadata.java [deleted file]
src/interfaces/jdbc/example/psql.java [deleted file]
src/interfaces/jdbc/example/threadsafe.java [deleted file]
src/interfaces/jdbc/org/postgresql/Driver.java.in [deleted file]
src/interfaces/jdbc/org/postgresql/PGConnection.java [deleted file]
src/interfaces/jdbc/org/postgresql/PGNotification.java [deleted file]
src/interfaces/jdbc/org/postgresql/PGRefCursorResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/PGStatement.java [deleted file]
src/interfaces/jdbc/org/postgresql/core/BaseConnection.java [deleted file]
src/interfaces/jdbc/org/postgresql/core/BaseResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/core/BaseStatement.java [deleted file]
src/interfaces/jdbc/org/postgresql/core/Encoding.java [deleted file]
src/interfaces/jdbc/org/postgresql/core/Field.java [deleted file]
src/interfaces/jdbc/org/postgresql/core/Notification.java [deleted file]
src/interfaces/jdbc/org/postgresql/core/PGStream.java [deleted file]
src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java [deleted file]
src/interfaces/jdbc/org/postgresql/core/StartupPacket.java [deleted file]
src/interfaces/jdbc/org/postgresql/errors.properties [deleted file]
src/interfaces/jdbc/org/postgresql/errors_de.properties [deleted file]
src/interfaces/jdbc/org/postgresql/errors_fr.properties [deleted file]
src/interfaces/jdbc/org/postgresql/errors_it.properties [deleted file]
src/interfaces/jdbc/org/postgresql/errors_nl.properties [deleted file]
src/interfaces/jdbc/org/postgresql/errors_pl.properties [deleted file]
src/interfaces/jdbc/org/postgresql/errors_pt_BR.properties [deleted file]
src/interfaces/jdbc/org/postgresql/errors_ru.properties [deleted file]
src/interfaces/jdbc/org/postgresql/errors_zh_TW.properties [deleted file]
src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java [deleted file]
src/interfaces/jdbc/org/postgresql/fastpath/FastpathArg.java [deleted file]
src/interfaces/jdbc/org/postgresql/geometric/PGbox.java [deleted file]
src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java [deleted file]
src/interfaces/jdbc/org/postgresql/geometric/PGline.java [deleted file]
src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java [deleted file]
src/interfaces/jdbc/org/postgresql/geometric/PGpath.java [deleted file]
src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java [deleted file]
src/interfaces/jdbc/org/postgresql/geometric/PGpolygon.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1CallableStatement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1DatabaseMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1RefCursorResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1ResultSetMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Statement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Blob.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Clob.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Array.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Blob.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2CallableStatement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Clob.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2DatabaseMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2RefCursorResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSetMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Statement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc2/PBatchUpdateException.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Blob.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Clob.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Blob.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Clob.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3DatabaseMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ObjectFactory.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PooledConnection.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PoolingDataSource.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3RefCursorResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3SimpleDataSource.java [deleted file]
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Statement.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/README [deleted file]
src/interfaces/jdbc/org/postgresql/test/TestUtil.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/ANTTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/BlobTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/CallableStmtTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/CursorFetchTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataPropertiesTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/DateTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/DriverTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/EncodingTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/Jdbc2TestSuite.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/OID74Test.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/RefCursorTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/ResultSetTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/TimeTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/TimestampTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/OptionalTestSuite.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3ConnectionPoolTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3PoolingDataSourceTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3SimpleDataSourceTest.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/util/MiniJndiContext.java [deleted file]
src/interfaces/jdbc/org/postgresql/test/util/MiniJndiContextFactory.java [deleted file]
src/interfaces/jdbc/org/postgresql/util/MD5Digest.java [deleted file]
src/interfaces/jdbc/org/postgresql/util/MessageTranslator.java [deleted file]
src/interfaces/jdbc/org/postgresql/util/PGbytea.java [deleted file]
src/interfaces/jdbc/org/postgresql/util/PGmoney.java [deleted file]
src/interfaces/jdbc/org/postgresql/util/PGobject.java [deleted file]
src/interfaces/jdbc/org/postgresql/util/PGtokenizer.java [deleted file]
src/interfaces/jdbc/org/postgresql/util/PSQLException.java [deleted file]
src/interfaces/jdbc/org/postgresql/util/PSQLState.java [deleted file]
src/interfaces/jdbc/org/postgresql/util/UnixCrypt.java [deleted file]

diff --git a/src/interfaces/jdbc/Makefile b/src/interfaces/jdbc/Makefile
deleted file mode 100644 (file)
index 1a8ebc6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# Makefile for JDBC driver
-#
-# Copyright (c) 2001, PostgreSQL Global Development Group
-#
-# $PostgreSQL: pgsql/src/interfaces/jdbc/Makefile,v 1.39 2003/11/29 19:52:09 pgsql Exp $
-#
-#-------------------------------------------------------------------------
-
-subdir = src/interfaces/jdbc
-top_builddir = ../../..
-include $(top_builddir)/src/Makefile.global
-
-majorversion:= $(shell echo $(VERSION) | sed 's/^\([0-9][0-9]*\)\..*$$/\1/')
-minorversion:= $(shell echo $(VERSION) | sed 's/^[0-9][0-9]*\.\([0-9][0-9]*\).*$$/\1/')
-
-build.properties: $(top_builddir)/src/Makefile.global
-       @echo "# This file was created by 'make build.properties'." > build.properties
-       @echo major=$(majorversion) >> build.properties
-       @echo minor=$(minorversion) >> build.properties
-       @echo fullversion=$(VERSION) >> build.properties
-       @echo def_pgport=$(DEF_PGPORT) >> build.properties
-       @echo enable_debug=$(enable_debug) >> build.properties
-
-all: build.properties
-       $(ANT) -buildfile $(srcdir)/build.xml all
-
-install: installdirs build.properties
-       $(ANT) -buildfile $(srcdir)/build.xml install \
-         -Dinstall.directory=$(javadir)
-
-installdirs:
-       $(mkinstalldirs) $(javadir) 
-
-uninstall:
-       $(ANT) -buildfile $(srcdir)/build.xml uninstall \
-         -Dinstall.directory=$(javadir)
-
-clean distclean maintainer-clean:
-       $(ANT) -buildfile $(srcdir)/build.xml clean_all
-
-check: build.properties
-       $(ANT) -buildfile $(srcdir)/build.xml test
diff --git a/src/interfaces/jdbc/README b/src/interfaces/jdbc/README
deleted file mode 100644 (file)
index 0c85551..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-This is a simple readme describing how to compile and use the jdbc driver.
-
----------------------------------------------------------------------------
-
-This isn't a guide on how to use JDBC - for that refer to sun's web site:
-
-       http://java.sun.com/
-
-For problems with this driver, then refer to the postgres-jdbc email
-list:
-
-       http://www.postgresql.org/
-
-The Driver's home page is:
-
-       http://jdbc.postgresql.org/
-
----------------------------------------------------------------------------
-
-COMPILING
-
-To compile you will need to have ANT installed. To obtain ant go to
-http://jakarta.apache.org/ant/index.html and download the binary. Being pure
-java it will run on virtually all java platforms. If you have any problems
-please email the jdbc list.
-
-Once you have ANT, run the configure script in the top-level directory with
-the --with-java option.  Then proceed with 'make' and 'make install' as
-usual.  This will compile the correct driver for your JVM, and build a .jar
-file (Java ARchive) called postgresql.jar.  The file will be installed in
-the directory PREFIX/share/java.
-
-That jar file will contain the driver for _your_ version of the JDK.
-
-If you would like to use ANT directly, first invoke 'make build.properties'
-after running the configure script with the java option. This will create a
-needed Java properties file from the configured information.
-
-REMEMBER: Once you have compiled the driver, it will work on ALL platforms
-that support that version of the API. You don't need to build it for each
-platform.
-
-Possible problems
-
-You may see a message similar to:
-
-postgresql/Driver.java:87: interface java.sql.Connection is an interface. It can't be instantiated.
-    return new Connection (host(), port(), props, database(), url, this);
-
-This is caused by not having the current directory in your CLASSPATH. Under
-Linux/Solaris, unset the CLASSPATH environment variable, and rerun ant.
-
-If you are still having problems, prebuilt versions of the driver 
-are available at http://jdbc.postgresql.org/
-
----------------------------------------------------------------------------
-
-INSTALLING THE DRIVER
-
-To install the driver, the .class files have to be in the classpath.
-
-ie: under LINUX/SOLARIS (the example here is my linux box):
-
-       export CLASSPATH=.:/usr/local/pgsql/share/java/postgresql.jar
-
----------------------------------------------------------------------------
-
-USING THE DRIVER
-
-To use the driver, you must introduce it to JDBC. Again, there's two ways
-of doing this:
-
-1: Hardcoded.
-
-   This method hardcodes your driver into your application/applet. You
-   introduce the driver using the following snippet of code:
-
-       try {
-         Class.forName("org.postgresql.Driver");
-       } catch(Exception e) {
-         // your error handling code goes here
-       }
-
-   Remember, this method restricts your code to just the postgresql database.
-   However, this is how most people load the driver.
-
-2: Parameters
-
-   This method specifies the driver from the command line. When running the
-   application, you specify the driver using the option:
-
-       -Djdbc.drivers=org.postgresql.Driver
-
-   eg: This is an example of running one of my other projects with the driver:
-
-       java -Djdbc.drivers=org.postgresql.Driver uk.org.retep.finder.Main
-
-   note: This method only works with Applications (not for Applets).
-        However, the application is not tied to one driver, so if you needed
-        to switch databases (why I don't know ;-) ), you don't need to
-        recompile the application (as long as you havent hardcoded the url's).
-
----------------------------------------------------------------------------
-
-JDBC URL syntax
-
-The driver recognises JDBC URL's of the form:
-
-       jdbc:postgresql:database
-
-       jdbc:postgresql://host/database
-
-       jdbc:postgresql://host:port/database
-
-Also, you can supply both username and passwords as arguments, by appending
-them to the URL. eg:
-
-       jdbc:postgresql:database?user=me
-       jdbc:postgresql:database?user=me&password=mypass
-
-Notes:
-
-1) If you are connecting to localhost or 127.0.0.1 you can leave it out of the
-   URL. ie: jdbc:postgresql://localhost/mydb can be replaced with
-   jdbc:postgresql:mydb
-
-2) The port defaults to 5432 if it's left out.
-
----------------------------------------------------------------------------
-
-That's the basics related to this driver. You'll need to read the JDBC Docs
-on how to use it. However, there are some examples included in the example
-directory. To build, type: make examples
-
-To run them, they follow the same syntax. For example, the basic example shows
-how to insert data, and perform queries:
-
-       java example.basic jdbc:postgresql:test user password
-
----------------------------------------------------------------------------
-
-POSTGRESQL SPECIFICS
---------------------
-
-Large Objects:
-
-A "feature" of PostgreSQL is that access to LargeObjects is only permitted
-within a Transaction. Because of this, any use of LargeObjects (also known
-as Blobs) requires that the Connection.setAutoCommit() method be called
-disabling the autocommit feature.
-
-For example:
-
-       Connection db;                  // open the connection here
-       db.setAutoCommit(false);        // Turn off AutoCommit
-
-                       ------------------
-
-Large Object API
-
-The first thing you need to do is to open the LargeObjectManager. This class
-handles the opening of existing objects, and creating new ones. To do this,
-you use the following line of code:
-
-       LargeObjectManager lobj;
-       lobj = ((org.postgresql.Connection)db).getLargeObjectAPI();
-
-where db is a reference to an open Connection object.
-
-Once that is done, you can use the API for the lifetime of that Connection.
-
-To create an object, you call the create() method. This takes an argument
-with the file modes you intend to use. The following line is normally
-sufficient:
-
-       int oid = lobj.create(LargeObjectManager.READ|LargeObjectManager.WRITE);
-
-Here, lobj is the LargeObjectManager we have opened earlier, and oid is the
-Large Object's oid in the database.
-
-To open an existing object, you use the open() method. This takes an oid, and
-the file permissions. It then returns a LargeObject object.
-
-       LargeObject obj = lobj.open(oid,LargeObjectManager.WRITE);
-
-Once the LargeObject is open, you can call methods to read, write, seek etc.
-Here's the supported methods:
-
-       int oid = obj.getOID();                 Return the objects oid
-       obj.close();                            Close the object
-       byte data[] = obj.read(int len);        Read len bytes
-       onj.read(byte data[],int off,int len);  Read into data[off] len bytes
-       obj.write(byte data[]);                 Write the array data
-       obj.write(byte data[],int off,int len); Write len bytes from data[off]
-       obj.seek(int pos,int ref);              As fseek in C.
-       obj.seek(int pos);                      Move to pos (from the begining)
-       int pos = obj.tell();                   Returns the current position
-       int size = obj.size();                  Returns the objects size
-
-Caveat: If you commit(), rollback() a transaction, or turn on autocommit whilst
-an object is open PostgreSQL will close it. You will need to reopen the object
-before using it again. Using the existing LargeObject will cause an
-SQLException to be thrown.
-
-                       ------------------
-
-JDBC supports database specific data types using the getObject() call. The
-following types have their own Java equivalents supplied by the driver:
-
-       box, circle, line, lseg, path, point, polygon
-
-When using the getObject() method on a resultset, it returns a PG_Object,
-which holds the postgres type, and its value. This object also supports
-methods to retrive these types.
-
-       Eg: column 3 contains a point, and rs is the ResultSet:
-
-       PG_Object o = (PG_Object)rs.getObject(3);
-       PGpoint p = o.getPoint();
-       System.out.println("point returned x="+p.x+", y="+p.y);
-
-Also, when using these classes, their toString() methods return the correct
-syntax for writing these to the database.
-
----------------------------------------------------------------------------
-
diff --git a/src/interfaces/jdbc/build.xml b/src/interfaces/jdbc/build.xml
deleted file mode 100644 (file)
index df29d63..0000000
+++ /dev/null
@@ -1,363 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
-  Build file to allow ant (http://jakarta.apache.org/ant/) to be used
-  to build the PostgreSQL JDBC Driver.
-
-  This file now requires Ant 1.4.1.  2002-04-18
-
-  $PostgreSQL: pgsql/src/interfaces/jdbc/build.xml,v 1.38 2003/11/29 19:52:09 pgsql Exp $
-
--->
-
-<!DOCTYPE project [
-  <!ENTITY jarfiles "postgresql.jar,postgresql-examples.jar">
-]>
-
-<project name="postgresqlJDBC" default="all" basedir=".">
-
-  <!-- set global properties for this build -->
-  <property name="srcdir"  value="." />
-  <property name="jardir"  value="jars" />
-  <property name="builddir" value="build" />
-  <property name="package" value="org/postgresql" />
-  <property name="debug" value="on" />
-
-  <property file="build.properties"/>
-
-  <!--
-    This is a simpler method than utils.CheckVersion
-    It defaults to jdbc1, but builds jdbc2 if the java.lang.Byte class is
-    in the CLASSPATH (ie JDK1.2 or later), and then enterprise if the
-    javax.sql.DataSource class is present.
-
-    Important: This must have the following order: jdbc1, jdbc2, jdbc3
-  -->
-  <target name="check_versions">
-    <condition property="jdbc1">
-      <equals arg1="${ant.java.version}" arg2="1.1"/>
-    </condition>
-    <condition property="jdbc2">
-      <or>
-        <equals arg1="${ant.java.version}" arg2="1.2"/>
-        <equals arg1="${ant.java.version}" arg2="1.3"/>
-      </or>
-    </condition>
-    <condition property="jdbc3">
-        <equals arg1="${ant.java.version}" arg2="1.4"/>
-    </condition>
-    <available property="datasource" classname="javax.sql.DataSource"/>
-    <available property="ssl" classname="javax.net.ssl.SSLSocketFactory"/>
-    <available property="junit" classname="junit.framework.Test"/>
-    <available property="junit.task" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
-    <condition property="jdbc2tests">
-      <and>
-        <or>
-          <isset property="jdbc2"/>
-          <isset property="jdbc3"/>
-        </or>
-        <isset property="junit"/>
-      </and>
-    </condition>
-    <condition property="jdbc2optionaltests">
-      <and>
-        <or>
-          <isset property="jdbc2"/>
-          <isset property="jdbc3"/>
-        </or>
-        <isset property="datasource"/>
-        <isset property="junit"/>
-      </and>
-    </condition>
-    <condition property="jdbc3tests">
-      <and>
-        <isset property="jdbc3"/>
-        <isset property="junit"/>
-      </and>
-    </condition>
-  </target>
-
-
-  <!-- default target -->
-  <target name="all">
-    <antcall target="jar" />
-  </target>
-
-
-  <!-- create the jar file -->
-  <target name="jar" depends="compile,examples">
-    <jar jarfile="${jardir}/postgresql.jar">
-      <fileset dir="${builddir}">
-        <include name="${package}/**/*.class" />
-      </fileset>
-
-      <fileset dir="${srcdir}">
-        <include name="${package}/*.properties" />
-      </fileset>
-    </jar>
-
-    <jar jarfile="${jardir}/postgresql-examples.jar">
-      <fileset dir="${builddir}">
-        <include name="example/**/*.class" />
-      </fileset>
-
-      <fileset dir="${srcdir}">
-        <include name="example/*.properties" />
-      </fileset>
-    </jar>
-  </target>
-
-
-  <target name="compile" depends="prepare,check_versions,driver">
-
-    <available classname="org.postgresql.Driver" property="old.driver.present" />
-    <fail message="Old driver was detected on classpath or in jre/lib/ext, please remove and try again." if="old.driver.present" />
-
-    <javac classpath="{$srcdir}" srcdir="${srcdir}" destdir="${builddir}" debug="${debug}">
-      <!-- This is the core of the driver.  It is common for all three versions. -->
-       <include name="${package}/*.java" />
-       <include name="${package}/core/**" />
-       <include name="${package}/fastpath/**" />
-       <include name="${package}/geometric/**" />
-       <include name="${package}/largeobject/**" />
-       <include name="${package}/util/**" />
-
-       <!--      
-       Each jdbcN subpackage is used only if the driver supports *at least* that
-       revision of JDBC. That is, a JDBC1 build uses only jdbc1, a JDBC2 build
-       uses both jdbc1 and jdbc2, etc.
-  
-       Within those subpackages, classes beginning with "JdbcN" are assumed to be
-       the concrete implementations for JDBC version N and are built only if the
-       driver supports *exactly* that version. For example, jdbc1/Jdbc1Statement.java
-       is built only if the driver build is a JDBC1 build.
-       -->
-       <!-- jdbc1 subpackage -->
-       <include name="${package}/jdbc1/**"/>
-       <exclude name="${package}/jdbc1/Jdbc1*.java" unless="jdbc1"/>
-       <!-- jdbc2 subpackage -->
-       <include name="${package}/jdbc2/**" if="jdbc2"/>
-       <include name="${package}/jdbc2/**" if="jdbc3"/>
-       <exclude name="${package}/jdbc2/Jdbc2*.java" unless="jdbc2"/>
-       <exclude name="${package}/jdbc2/optional/**" unless="datasource"/>
-       <!-- jdbc3 subpackage -->
-       <include name="${package}/jdbc3/*.java" if="jdbc3"/>
-       <exclude name="${package}/jdbc3/Jdbc3*.java" unless="jdbc3"/>
-
-    </javac>
-  </target>
-
-  <target name="check_driver">
-    <uptodate targetfile="${package}/Driver.java" property="driver.uptodate">
-      <srcfiles dir=".">
-      <include name="${package}/Driver.java.in"/>
-      <include name="build.properties"/>
-      </srcfiles>
-    </uptodate>
-  </target>
-
-  <!--
-    This generates Driver.java from Driver.java.in
-    It's required for importing the driver version properties
-  -->
-  <target name="driver" depends="prepare,check_versions,check_driver"
-          unless="driver.uptodate">
-    <!-- determine the edition text -->
-    <condition property="edition" value="JDBC1">
-        <equals arg1="${jdbc1}" arg2="true"/>
-    </condition>
-    <condition property="edition" value="JDBC2">
-        <equals arg1="${jdbc2}" arg2="true"/>
-    </condition>
-    <condition property="edition" value="JDBC3">
-        <equals arg1="${jdbc3}" arg2="true"/>
-    </condition>
-    <condition property="edition" value="JDBC2 Enterprise">
-      <and>
-        <available classname="javax.sql.DataSource" />
-        <equals arg1="${jdbc2}" arg2="true"/>
-      </and>
-    </condition>
-
-    <!-- determine the connection class -->
-    <condition property="connectclass" value="org.postgresql.jdbc1.Jdbc1Connection">
-        <equals arg1="${jdbc1}" arg2="true"/>
-    </condition>
-    <condition property="connectclass" value="org.postgresql.jdbc2.Jdbc2Connection">
-        <equals arg1="${jdbc2}" arg2="true"/>
-    </condition>
-    <condition property="connectclass" value="org.postgresql.jdbc3.Jdbc3Connection">
-        <equals arg1="${jdbc3}" arg2="true"/>
-    </condition>
-
-    <!-- determine the ssl status -->
-    <condition property="ssl_config" value="">
-        <equals arg1="${ssl}" arg2="true"/>
-    </condition>
-    <condition property="ssl_config" value="//">
-        <not>
-            <equals arg1="${ssl}" arg2="true"/>
-        </not>
-    </condition>
-    <condition property="ssl_edition" value="SSL">
-        <equals arg1="${ssl}" arg2="true"/>
-    </condition>
-    <condition property="ssl_edition" value="NO SSL">
-        <not>
-            <equals arg1="${ssl}" arg2="true"/>
-        </not>
-    </condition>
-
-    <!-- Some defaults -->
-    <filter token="MAJORVERSION" value="${major}" />
-    <filter token="MINORVERSION" value="${minor}" />
-    <filter token="VERSION" value="PostgreSQL ${fullversion} ${edition} with ${ssl_edition}" />
-    <filter token="JDBCCONNECTCLASS" value="${connectclass}" />
-    <filter token="DEF_PGPORT" value="${def_pgport}" />
-    <filter token="SSL" value="${ssl_config}" />
-
-     <fail unless="major" message="'major' undefined. Please follow the directions in README."/>
-     <fail unless="minor" message="'minor' undefined. Please follow the directions in README."/>
-     <fail unless="fullversion" message="'fullversion' undefined. Please follow the directions in README."/>
-     <fail unless="def_pgport" message="'def_pgport' undefined. Please follow the directions in README."/>
-     <fail unless="enable_debug" message="'enable_debug' undefined. Please follow the directions in README."/>
-    <!-- Put a check for the current version here -->
-
-    <!-- now copy and filter the file -->
-    <copy file="${package}/Driver.java.in"
-          overwrite="true"
-          tofile="${package}/Driver.java"
-          filtering="yes" />
-
-    <echo message="Configured build for the ${edition} edition driver with ${ssl_edition}" />
-  </target>
-
-
-  <!-- Prepares the build directory -->
-  <target name="prepare">
-    <!-- use the enable_debug option from configure -->
-    <condition property="debug" value="on">
-      <and>
-        <equals arg1="${enable_debug}" arg2="yes" />
-      </and>
-    </condition>
-    <mkdir dir="${builddir}" />
-    <mkdir dir="${jardir}" />
-  </target>
-
-
-  <!-- This builds the examples -->
-  <target name="examples" depends="compile">
-    <javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}">
-      <include name="example/**" />
-      <exclude name="example/corba/**"/>
-      <exclude name="example/blobtest.java" if="jdbc1"/>
-    </javac>
-  </target>
-
-
-  <!-- Builds the corba example -->
-  <target name="corba" if="jdbc2">
-    <exec dir="${srcdir}/example/corba" executable="idl2java">
-      <arg value="stock.idl" />
-    </exec>
-
-    <javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}">
-      <include name="example/corba/**" />
-    </javac>
-  </target>
-
-
-
-  <!-- Install the jar files -->
-  <target name="install" depends="all" if="install.directory">
-    <copy todir="${install.directory}" overwrite="true">
-      <fileset dir="${jardir}" includes="&jarfiles;" />
-    </copy>
-  </target>
-
-
-  <!-- Uninstall the jar file -->
-  <target name="uninstall" if="install.directory">
-    <delete>
-      <fileset dir="${install.directory}" includes="&jarfiles;" />
-    </delete>
-  </target>
-
-
-
-  <!-- This target removes any class files from the build directory -->
-  <target name="clean">
-    <delete quiet="true" dir="${builddir}" />
-    <delete quiet="true" dir="${jardir}" />
-    <delete quiet="true" file="${package}/Driver.java" />
-  </target>
-
-  <target name="clean_all" depends="clean">
-    <delete quiet="true" file="build.properties" />
-  </target>
-
-
-  <!-- This compiles and executes the JUnit tests -->
-
-  <!-- defaults for the tests - override these if required -->
-  <property name="server" value="localhost" />
-  <property name="port" value="${def_pgport}" />
-  <property name="database" value="test" />
-  <property name="username" value="test" />
-  <!-- Password must be something.  Doesn't matter if trust is used! -->
-  <property name="password" value="password" />
-
-  <!-- The tests now build to a separate directory and jarfile from the
-       driver build, to ensure we're really testing against the jar we just
-       built, and not whatever happens to be in builddir. -->
-
-  <!-- This compiles and builds the test jarfile. -->  
-  <target name="testjar" depends="jar" if="junit">
-    <mkdir dir="${builddir}/tests"/>
-    <javac srcdir="${srcdir}" destdir="${builddir}/tests" debug="${debug}">
-      <include name="${package}/test/**" />
-
-      <exclude name="${package}/test/jdbc2/**" unless="jdbc2tests"/>
-      <exclude name="${package}/test/jdbc2/optional/**" unless="jdbc2optionaltests" />
-      <exclude name="${package}/test/jdbc3/**" unless="jdbc3tests" />
-      <exclude name="${package}/test/util/**" unless="jdbc2optionaltests"/>
-
-      <classpath>
-        <pathelement location="${jardir}/postgresql.jar"/>
-      </classpath>
-    </javac>
-    <jar jarfile="${jardir}/postgresql-tests.jar" basedir="${builddir}/tests"/>
-  </target>
-    
-  <!-- This actually runs the tests -->
-  <target name="runtest" depends="testjar" if="junit.task">
-    <junit>
-      <formatter type="brief" usefile="false"/>
-
-      <sysproperty key="server" value="${server}" />
-      <sysproperty key="port" value="${port}" />
-      <sysproperty key="database" value="${database}" />
-      <sysproperty key="username" value="${username}" />
-      <sysproperty key="password" value="${password}" />
-
-      <classpath>
-        <pathelement location="${jardir}/postgresql.jar" />
-        <pathelement location="${jardir}/postgresql-tests.jar" />
-        <pathelement path="${java.class.path}" />
-      </classpath>
-
-      <test name="org.postgresql.test.jdbc2.Jdbc2TestSuite" if="jdbc2tests"/>
-      <test name="org.postgresql.test.jdbc2.optional.OptionalTestSuite" if="jdbc2optionaltests"/>
-      <test name="org.postgresql.test.jdbc3.Jdbc3TestSuite" if="jdbc3tests"/>
-    </junit>
-  </target>
-  
-  <!-- This is the target invoked by the Makefile -->
-  <target name="test" depends="testjar,runtest"/>
-
-</project>
diff --git a/src/interfaces/jdbc/example/ImageViewer.java b/src/interfaces/jdbc/example/ImageViewer.java
deleted file mode 100644 (file)
index 0401780..0000000
+++ /dev/null
@@ -1,517 +0,0 @@
-package example;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.io.*;
-import java.sql.*;
-import org.postgresql.largeobject.*;
-
-/*
- * This example is a small application that stores and displays images
- * held on a postgresql database.
- *
- * Before running this application, you need to create a database, and
- * on the first time you run it, select "Initialise" in the "PostgreSQL"
- * menu.
- *
- * Important note: You will notice we import the org.postgresql.largeobject
- * package, but don't import the org.postgresql package. The reason for this is
- * that importing postgresql can confuse javac (we have conflicting class names
- * in org.postgresql.* and java.sql.*). This doesn't cause any problems, as
- * long as no code imports org.postgresql.
- *
- * Under normal circumstances, code using any jdbc driver only needs to import
- * java.sql, so this isn't a problem.
- *
- * It's only if you use the non jdbc facilities, do you have to take this into
- * account.
- *
- * Note: For PostgreSQL 6.4, the driver is now Thread safe, so this example
- * application has been updated to use multiple threads, especially in the
- * image storing and retrieving methods.
- */
-
-public class ImageViewer implements ItemListener
-{
-       Connection db;
-       Statement stat;
-       LargeObjectManager lom;
-       Frame frame;
-       Label label;            // Label used to display the current name
-       List list;              // The list of available images
-       imageCanvas canvas; // Canvas used to display the image
-       String currentImage;    // The current images name
-
-       // This is a simple component to display our image
-       public class imageCanvas extends Canvas
-       {
-               // holds the image
-               private Image image;
-
-               // holds the background buffer
-               private Image bkg;
-
-               // the size of the buffer
-               private Dimension size;
-
-               public imageCanvas()
-               {
-                       image = null;
-               }
-
-               public void setImage(Image img)
-               {
-                       image = img;
-                       repaint();
-               }
-
-               // This defines our minimum size
-               public Dimension getMinimumSize()
-               {
-                       return new Dimension(400, 400);
-               }
-
-               public Dimension getPreferedSize()
-               {
-                       return getMinimumSize();
-               }
-
-               public void update(Graphics g)
-               {
-                       paint(g);
-               }
-
-               /*
-                * Paints the image, using double buffering to prevent screen flicker
-                */
-               public void paint(Graphics gr)
-               {
-                       Dimension s = getSize();
-
-                       if (size == null || bkg == null || !s.equals(size))
-                       {
-                               size = s;
-                               bkg = createImage(size.width, size.height);
-                       }
-
-                       // now set the background
-                       Graphics g = bkg.getGraphics();
-                       g.setColor(Color.gray);
-                       g.fillRect(0, 0, s.width, s.height);
-
-                       // now paint the image over the background
-                       if (image != null)
-                               g.drawImage(image, 0, 0, this);
-
-                       // dispose the graphics instance
-                       g.dispose();
-
-                       // paint the image onto the component
-                       gr.drawImage(bkg, 0, 0, this);
-
-               }
-
-       }
-
-       public ImageViewer(Frame f, String url, String user, String password) throws ClassNotFoundException, FileNotFoundException, IOException, SQLException
-       {
-               frame = f;
-
-               MenuBar mb = new MenuBar();
-               Menu m;
-               MenuItem i;
-
-               f.setMenuBar(mb);
-               mb.add(m = new Menu("PostgreSQL"));
-               m.add(i = new MenuItem("Initialise"));
-               i.addActionListener(new ActionListener()
-                                                       {
-                                                               public void actionPerformed(ActionEvent e)
-                                                               {
-                                                                       ImageViewer.this.init();
-                                                               }
-                                                       }
-                                                  );
-
-               m.add(i = new MenuItem("Exit"));
-               ActionListener exitListener = new ActionListener()
-                                                                         {
-                                                                                 public void actionPerformed(ActionEvent e)
-                                                                                 {
-                                                                                         ImageViewer.this.close();
-                                                                                 }
-                                                                         };
-               m.addActionListener(exitListener);
-
-               mb.add(m = new Menu("Image"));
-               m.add(i = new MenuItem("Import"));
-               ActionListener importListener = new ActionListener()
-                                                                               {
-                                                                                       public void actionPerformed(ActionEvent e)
-                                                                                       {
-                                                                                               ImageViewer.this.importImage();
-                                                                                       }
-                                                                               };
-               i.addActionListener(importListener);
-
-               m.add(i = new MenuItem("Remove"));
-               ActionListener removeListener = new ActionListener()
-                                                                               {
-                                                                                       public void actionPerformed(ActionEvent e)
-                                                                                       {
-                                                                                               ImageViewer.this.removeImage();
-                                                                                       }
-                                                                               };
-               i.addActionListener(removeListener);
-
-               // To the north is a label used to display the current images name
-               f.add("North", label = new Label());
-
-               // We have a panel to the south of the frame containing the controls
-               Panel p = new Panel();
-               p.setLayout(new FlowLayout());
-               Button b;
-               p.add(b = new Button("Refresh List"));
-               b.addActionListener(new ActionListener()
-                                                       {
-                                                               public void actionPerformed(ActionEvent e)
-                                                               {
-                                                                       ImageViewer.this.refreshList();
-                                                               }
-                                                       }
-                                                  );
-               p.add(b = new Button("Import new image"));
-               b.addActionListener(importListener);
-               p.add(b = new Button("Remove image"));
-               b.addActionListener(removeListener);
-               p.add(b = new Button("Quit"));
-               b.addActionListener(exitListener);
-               f.add("South", p);
-
-               // And a panel to the west containing the list of available images
-               f.add("West", list = new List());
-               list.addItemListener(this);
-
-               // Finally the centre contains our image
-               f.add("Center", canvas = new imageCanvas());
-
-               // Load the driver
-               Class.forName("org.postgresql.Driver");
-
-               // Connect to database
-               db = DriverManager.getConnection(url, user, password);
-
-               // Create a statement
-               stat = db.createStatement();
-
-               // Also, get the LargeObjectManager for this connection
-               lom = ((org.postgresql.PGConnection)db).getLargeObjectAPI();
-
-               // Now refresh the image selection list
-               refreshList();
-       }
-
-
-       /*
-        * This method initialises the database by creating a table that contains
-        * the image names, and Large Object OID's
-        */
-       public void init()
-       {
-               try
-               {
-                       //db.setAutoCommit(true);
-                       stat.executeUpdate("create table images (imgname name,imgoid oid)");
-                       label.setText("Initialised database");
-                       db.commit();
-               }
-               catch (SQLException ex)
-               {
-                       label.setText(ex.toString());
-               }
-
-               // This must run outside the previous try{} catch{} segment
-               //try {
-               //db.setAutoCommit(true);
-               //} catch(SQLException ex) {
-               //label.setText(ex.toString());
-               //}
-       }
-
-       /*
-        * This closes the connection, and ends the application
-        */
-       public void close()
-       {
-               try
-               {
-                       db.close();
-               }
-               catch (SQLException ex)
-               {
-                       System.err.println(ex.toString());
-               }
-               System.exit(0);
-       }
-
-       /*
-        * This imports an image into the database, using a Thread to do this in the
-        * background.
-        */
-       public void importImage()
-       {
-               FileDialog d = new FileDialog(frame, "Import Image", FileDialog.LOAD);
-               d.setVisible(true);
-               String name = d.getFile();
-               String dir = d.getDirectory();
-               d.dispose();
-
-               // now start the true importer
-               Thread t = new importer(db, name, dir);
-               //t.setPriority(Thread.MAX_PRIORITY);
-               t.start();
-       }
-
-       /*
-        * This is an example of using a thread to import a file into a Large Object.
-        * It uses the Large Object extension, to write blocks of the file to the
-        * database.
-        */
-       class importer extends Thread
-       {
-               String name, dir;
-               Connection db;
-
-               public importer(Connection db, String name, String dir)
-               {
-                       this.db = db;
-                       this.name = name;
-                       this.dir = dir;
-               }
-
-               public void run()
-               {
-                       // Now the real import stuff
-                       if (name != null && dir != null)
-                       {
-                               Statement stat = null;
-
-                               try
-                               {
-                                       // fetch the large object manager
-                                       LargeObjectManager lom = ((org.postgresql.PGConnection)db).getLargeObjectAPI();
-
-                                       db.setAutoCommit(false);
-
-                                       // A temporary buffer - this can be as large as you like
-                                       byte buf[] = new byte[2048];
-
-                                       // Open the file
-                                       FileInputStream fis = new FileInputStream(new File(dir, name));
-
-                                       // Now create the large object
-                                       int oid = lom.create();
-                                       LargeObject blob = lom.open(oid);
-
-                                       // Now copy the file into the object.
-                                       //
-                                       // Note: we dont use write(buf), as the last block is rarely the same
-                                       // size as our buffer, so we have to use the amount read.
-                                       int s, t = 0;
-                                       while ((s = fis.read(buf, 0, buf.length)) > 0)
-                                       {
-                                               t += s;
-                                               blob.write(buf, 0, s);
-                                       }
-
-                                       // Close the object
-                                       blob.close();
-
-                                       // Now store the entry into the table
-
-                                       // As we are a different thread to the other window, we must use
-                                       // our own thread
-                                       stat = db.createStatement();
-                                       stat.executeUpdate("insert into images values ('" + name + "'," + oid + ")");
-                                       db.commit();
-                                       db.setAutoCommit(false);
-
-                                       // Finally refresh the names list, and display the current image
-                                       ImageViewer.this.refreshList();
-                                       ImageViewer.this.displayImage(name);
-                               }
-                               catch (Exception ex)
-                               {
-                                       label.setText(ex.toString());
-                               }
-                               finally
-                               {
-                                       // ensure the statement is closed after us
-                                       try
-                                       {
-                                               if (stat != null)
-                                                       stat.close();
-                                       }
-                                       catch (SQLException se)
-                                       {
-                                               System.err.println("closing of Statement failed");
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /*
-        * This refreshes the list of available images
-        */
-       public void refreshList()
-       {
-               try
-               {
-                       // First, we'll run a query, retrieving all of the image names
-                       ResultSet rs = stat.executeQuery("select imgname from images order by imgname");
-                       if (rs != null)
-                       {
-                               list.removeAll();
-                               while (rs.next())
-                                       list.addItem(rs.getString(1));
-                               rs.close();
-                       }
-               }
-               catch (SQLException ex)
-               {
-                       label.setText(ex.toString() + " Have you initialised the database?");
-               }
-       }
-
-       /*
-        * This removes an image from the database
-        *
-        * Note: With postgresql, this is the only way of deleting a large object
-        * using Java.
-        */
-       public void removeImage()
-       {
-               try
-               {
-                       //
-                       // Delete any large objects for the current name
-                       //
-                       // Note: We don't need to worry about being in a transaction
-                       // here, because we are not opening any blobs, only deleting
-                       // them
-                       //
-                       ResultSet rs = stat.executeQuery("select imgoid from images where imgname='" + currentImage + "'");
-                       if (rs != null)
-                       {
-                               // Even though there should only be one image, we still have to
-                               // cycle through the ResultSet
-                               while (rs.next())
-                               {
-                                       lom.delete(rs.getInt(1));
-                               }
-                       }
-                       rs.close();
-
-                       // Finally delete any entries for that name
-                       stat.executeUpdate("delete from images where imgname='" + currentImage + "'");
-
-                       label.setText(currentImage + " deleted");
-                       currentImage = null;
-                       refreshList();
-               }
-               catch (SQLException ex)
-               {
-                       label.setText(ex.toString());
-               }
-       }
-
-       /*
-        * This displays an image from the database.
-        *
-        * For images, this is the easiest method.
-        */
-       public void displayImage(String name)
-       {
-               try
-               {
-                       //
-                       // Now as we are opening and reading a large object we must
-                       // turn on Transactions. This includes the ResultSet.getBytes()
-                       // method when it's used on a field of type oid!
-                       //
-                       db.setAutoCommit(false);
-
-                       ResultSet rs = stat.executeQuery("select imgoid from images where imgname='" + name + "'");
-                       if (rs != null)
-                       {
-                               // Even though there should only be one image, we still have to
-                               // cycle through the ResultSet
-                               while (rs.next())
-                               {
-                                       canvas.setImage(canvas.getToolkit().createImage(rs.getBytes(1)));
-                                       label.setText(currentImage = name);
-                               }
-                       }
-                       rs.close();
-               }
-               catch (SQLException ex)
-               {
-                       label.setText(ex.toString());
-               }
-               finally
-               {
-                       try
-                       {
-                               db.setAutoCommit(true);
-                       }
-                       catch (SQLException ex2)
-                       {}
-               }
-       }
-
-       public void itemStateChanged(ItemEvent e)
-       {
-               displayImage(list.getItem(((Integer)e.getItem()).intValue()));
-       }
-
-       /*
-        * This is the command line instructions
-        */
-       public static void instructions()
-       {
-               System.err.println("java example.ImageViewer jdbc-url user password");
-               System.err.println("\nExamples:\n");
-               System.err.println("java -Djdbc.driver=org.postgresql.Driver example.ImageViewer jdbc:postgresql:test postgres password\n");
-
-               System.err.println("This example tests the binary large object api of the driver.\nBasically, it will allow you to store and view images held in the database.");
-               System.err.println("Note: If you are running this for the first time on a particular database,\nyou have to select \"Initialise\" in the \"PostgreSQL\" menu.\nThis will create a table used to store image names.");
-       }
-
-       /*
-        * This is the application entry point
-        */
-       public static void main(String args[])
-       {
-               if (args.length != 3)
-               {
-                       instructions();
-                       System.exit(1);
-               }
-
-               try
-               {
-                       Frame frame = new Frame("PostgreSQL ImageViewer v7.0 rev 1");
-                       frame.setLayout(new BorderLayout());
-                       ImageViewer viewer = new ImageViewer(frame, args[0], args[1], args[2]);
-                       frame.pack();
-                       frame.setLocation(0, 50);
-                       frame.setVisible(true);
-               }
-               catch (Exception ex)
-               {
-                       System.err.println("Exception caught.\n" + ex);
-                       ex.printStackTrace();
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/example/Unicode.java b/src/interfaces/jdbc/example/Unicode.java
deleted file mode 100644 (file)
index b1d1db2..0000000
+++ /dev/null
@@ -1,276 +0,0 @@
-package example;
-
-import java.sql.*;
-import java.util.*;
-
-/*
- *     Test inserting and extracting Unicode-encoded strings.
- *
- *     Synopsis:
- *        example.Unicode <url> <user> <password>
- *     where <url> must specify an existing database to which <user> and
- *     <password> give access and which has UNICODE as its encoding.
- *     (To create a database with UNICODE encoding, you need to run createdb
- *     with the flag "-E UNICODE".)
- *
- *     This test only produces output on error.
- *
- *     @author William Webber <william@live.com.au>
- */
-public class Unicode
-{
-
-       /*
-        *      The url for the database to connect to.
-        */
-       private String url;
-
-       /*
-        *      The user to connect as.
-        */
-       private String user;
-
-       /*
-        *      The password to connect with.
-        */
-       private String password;
-
-       private static void usage()
-       {
-               log("usage: example.Unicode <url> <user> <password>");
-       }
-
-       private static void log(String message)
-       {
-               System.err.println(message);
-       }
-
-       private static void log(String message, Exception e)
-       {
-               System.err.println(message);
-               e.printStackTrace();
-       }
-
-
-       public Unicode(String url, String user, String password)
-       {
-               this.url = url;
-               this.user = user;
-               this.password = password;
-       }
-
-       /*
-        *      Establish and return a connection to the database.
-        */
-       private Connection getConnection() throws SQLException,
-                               ClassNotFoundException
-       {
-               Class.forName("org.postgresql.Driver");
-               Properties info = new Properties();
-               info.put("user", user);
-               info.put("password", password);
-               info.put("charSet", "utf-8");
-               return DriverManager.getConnection(url, info);
-       }
-
-       /*
-        *      Get string representing a block of 256 consecutive unicode characters.
-        *      We exclude the null character, "'",  and "\".
-        */
-       private String getSqlSafeUnicodeBlock(int blockNum)
-       {
-               if (blockNum < 0 || blockNum > 255)
-                       throw new IllegalArgumentException("blockNum must be from 0 to "
-                                                                                          + "255: " + blockNum);
-               StringBuffer sb = new StringBuffer(256);
-               int blockFirst = blockNum * 256;
-               int blockLast = blockFirst + 256;
-               for (int i = blockFirst; i < blockLast; i++)
-               {
-                       char c = (char) i;
-                       if (c == '\0' || c == '\'' || c == '\\')
-                               continue;
-                       sb.append(c);
-               }
-               return sb.toString();
-       }
-
-       /*
-        *      Is the block a block of valid unicode values.
-        *      d800 to db7f is the "unassigned high surrogate" range.
-        *      db80 to dbff is the "private use" range.
-        *      These should not be used in actual Unicode strings;
-        *      at least, jdk1.2 will not convert them to utf-8.
-        */
-       private boolean isValidUnicodeBlock(int blockNum)
-       {
-               if (blockNum >= 0xd8 && blockNum <= 0xdb)
-                       return false;
-               else
-                       return true;
-       }
-
-       /*
-        *      Report incorrect block retrieval.
-        */
-       private void reportRetrievalError(int blockNum, String block,
-                                                                         String retrieved)
-       {
-               String message = "Block " + blockNum + " returned incorrectly: ";
-               int i = 0;
-               for (i = 0; i < block.length(); i++)
-               {
-                       if (i >= retrieved.length())
-                       {
-                               message += "too short";
-                               break;
-                       }
-                       else if (retrieved.charAt(i) != block.charAt(i))
-                       {
-                               message +=
-                                       "first changed character at position " + i + ", sent as 0x"
-                                       + Integer.toHexString((int) block.charAt(i))
-                                       + ", retrieved as 0x"
-                                       + Integer.toHexString ((int) retrieved.charAt(i));
-                               break;
-                       }
-               }
-               if (i >= block.length())
-                       message += "too long";
-               log(message);
-       }
-
-       /*
-        *      Do the testing.
-        */
-       public void runTest()
-       {
-               Connection connection = null;
-               Statement statement = null;
-               int blockNum = 0;
-               final int CREATE = 0;
-               final int INSERT = 1;
-               final int SELECT = 2;
-               final int LIKE = 3;
-               int mode = CREATE;
-               try
-               {
-                       connection = getConnection();
-                       statement = connection.createStatement();
-                       statement.executeUpdate("CREATE TABLE test_unicode "
-                                                                       + "( blockNum INT PRIMARY KEY, "
-                                                                       + "block TEXT );");
-                       mode = INSERT;
-                       for (blockNum = 0; blockNum < 256; blockNum++)
-                       {
-                               if (isValidUnicodeBlock(blockNum))
-                               {
-                                       String block = getSqlSafeUnicodeBlock(blockNum);
-                                       statement.executeUpdate
-                                       ("INSERT INTO test_unicode VALUES ( " + blockNum
-                                        + ", '" + block + "');");
-                               }
-                       }
-                       mode = SELECT;
-                       for (blockNum = 0; blockNum < 256; blockNum++)
-                       {
-                               if (isValidUnicodeBlock(blockNum))
-                               {
-                                       String block = getSqlSafeUnicodeBlock(blockNum);
-                                       ResultSet rs = statement.executeQuery
-                                                                  ("SELECT block FROM test_unicode WHERE blockNum = "
-                                                                       + blockNum + ";");
-                                       if (!rs.next())
-                                               log("Could not retrieve block " + blockNum);
-                                       else
-                                       {
-                                               String retrieved = rs.getString(1);
-                                               if (!retrieved.equals(block))
-                                               {
-                                                       reportRetrievalError(blockNum, block, retrieved);
-                                               }
-                                       }
-                               }
-                       }
-                       mode = LIKE;
-                       for (blockNum = 0; blockNum < 256; blockNum++)
-                       {
-                               if (isValidUnicodeBlock(blockNum))
-                               {
-                                       String block = getSqlSafeUnicodeBlock(blockNum);
-                                       String likeString = "%" +
-                                                                               block.substring(2, block.length() - 3) + "%" ;
-                                       ResultSet rs = statement.executeQuery
-                                                                  ("SELECT blockNum FROM test_unicode WHERE block LIKE '"
-                                                                       + likeString + "';");
-                                       if (!rs.next())
-                                               log("Could get block " + blockNum + " using LIKE");
-                               }
-                       }
-               }
-               catch (SQLException sqle)
-               {
-                       switch (mode)
-                       {
-                               case CREATE:
-                                       log("Exception creating database", sqle);
-                                       break;
-                               case INSERT:
-                                       log("Exception inserting block " + blockNum, sqle);
-                                       break;
-                               case SELECT:
-                                       log("Exception selecting block " + blockNum, sqle);
-                                       break;
-                               case LIKE:
-                                       log("Exception doing LIKE on block " + blockNum, sqle);
-                                       break;
-                               default:
-                                       log("Exception", sqle);
-                                       break;
-                       }
-               }
-               catch (ClassNotFoundException cnfe)
-               {
-                       log("Unable to load driver", cnfe);
-                       return ;
-               }
-               try
-               {
-                       if (statement != null)
-                               statement.close();
-                       if (connection != null)
-                               connection.close();
-               }
-               catch (SQLException sqle)
-               {
-                       log("Exception closing connections", sqle);
-               }
-               if (mode > CREATE)
-               {
-                       // If the backend gets what it regards as garbage on a connection,
-                       // that connection may become unusable.  To be safe, we create
-                       // a fresh connection to delete the table.
-                       try
-                       {
-                               connection = getConnection();
-                               statement = connection.createStatement();
-                               statement.executeUpdate("DROP TABLE test_unicode;");
-                       }
-                       catch (Exception sqle)
-                       {
-                               log("*** ERROR: unable to delete test table "
-                                       + "test_unicode; must be deleted manually", sqle);
-                       }
-               }
-       }
-
-       public static void main(String [] args)
-       {
-               if (args.length != 3)
-               {
-                       usage();
-                       System.exit(1);
-               }
-               new Unicode(args[0], args[1], args[2]).runTest();
-       }
-}
diff --git a/src/interfaces/jdbc/example/basic.java b/src/interfaces/jdbc/example/basic.java
deleted file mode 100644 (file)
index d1a7e60..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-package example;
-
-import java.io.*;
-import java.sql.*;
-
-/*
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/example/basic.java,v 1.15 2003/11/29 22:41:19 pgsql Exp $
- *
- * This example tests the basic components of the JDBC driver, and shows
- * how even the simplest of queries can be implemented.
- *
- * To use this example, you need a database to be in existence. This example
- * will create a table called basic.
- *
- * Note: This will only work with post 7.0 drivers.
- *
- */
-
-public class basic
-{
-       Connection db;  // The connection to the database
-       Statement st;   // Our statement to run queries with
-
-       public basic(String args[]) throws ClassNotFoundException, FileNotFoundException, IOException, SQLException
-       {
-               String url = args[0];
-               String usr = args[1];
-               String pwd = args[2];
-
-               // Load the driver
-               Class.forName("org.postgresql.Driver");
-
-               // Connect to database
-               System.out.println("Connecting to Database URL = " + url);
-               db = DriverManager.getConnection(url, usr, pwd);
-
-               System.out.println("Connected...Now creating a statement");
-               st = db.createStatement();
-
-               // Clean up the database (in case we failed earlier) then initialise
-               cleanup();
-
-               // Now run tests using JDBC methods
-               doexample();
-
-               // Clean up the database
-               cleanup();
-
-               // Finally close the database
-               System.out.println("Now closing the connection");
-               st.close();
-               db.close();
-
-               //throw postgresql.Driver.notImplemented();
-       }
-
-       /*
-        * This drops the table (if it existed). No errors are reported.
-        */
-       public void cleanup()
-       {
-               try
-               {
-                       st.executeUpdate("drop table basic");
-               }
-               catch (Exception ex)
-               {
-                       // We ignore any errors here
-               }
-       }
-
-       /*
-        * This performs the example
-        */
-       public void doexample() throws SQLException
-       {
-               System.out.println("\nRunning tests:");
-
-               // First we need a table to store data in
-               st.executeUpdate("create table basic (a int2, b int2)");
-
-               // Now insert some data, using the Statement
-               st.executeUpdate("insert into basic values (1,1)");
-               st.executeUpdate("insert into basic values (2,1)");
-               st.executeUpdate("insert into basic values (3,1)");
-
-               // This shows how to get the oid of a just inserted row
-               st.executeUpdate("insert into basic values (4,1)");
-               long insertedOID = ((org.postgresql.PGStatement)st).getLastOID();
-               System.out.println("Inserted row with oid " + insertedOID);
-
-               // Now change the value of b from 1 to 8
-               st.executeUpdate("update basic set b=8");
-               System.out.println("Updated " + st.getUpdateCount() + " rows");
-
-               // Now delete 2 rows
-               st.executeUpdate("delete from basic where a<3");
-               System.out.println("deleted " + st.getUpdateCount() + " rows");
-
-               // For large inserts, a PreparedStatement is more efficient, because it
-               // supports the idea of precompiling the SQL statement, and to store
-               // directly, a Java object into any column. PostgreSQL doesnt support
-               // precompiling, but does support setting a column to the value of a
-               // Java object (like Date, String, etc).
-               //
-               // Also, this is the only way of writing dates in a datestyle independent
-               // manner. (DateStyles are PostgreSQL's way of handling different methods
-               // of representing dates in the Date data type.)
-               PreparedStatement ps = db.prepareStatement("insert into basic values (?,?)");
-               for (int i = 2;i < 5;i++)
-               {
-                       ps.setInt(1, 4);                // "column a" = 5
-                       ps.setInt(2, i);                // "column b" = i
-                       ps.executeUpdate(); // executeUpdate because insert returns no data
-               }
-               ps.close();                     // Always close when we are done with it
-
-               // Finally perform a query on the table
-               System.out.println("performing a query");
-               ResultSet rs = st.executeQuery("select a, b from basic");
-               if (rs != null)
-               {
-                       // Now we run through the result set, printing out the result.
-                       // Note, we must call .next() before attempting to read any results
-                       while (rs.next())
-                       {
-                               int a = rs.getInt("a"); // This shows how to get the value by name
-                               int b = rs.getInt(2);   // This shows how to get the value by column
-                               System.out.println("  a=" + a + " b=" + b);
-                       }
-                       rs.close(); // again, you must close the result when done
-               }
-
-               // Now run the query again, showing a more efficient way of getting the
-               // result if you don't know what column number a value is in
-
-
-
-               System.out.println("performing another query");
-               rs = st.executeQuery("select * from basic where b>1");
-               if (rs != null)
-               {
-                       // First find out the column numbers.
-                       //
-                       // It's best to do this here, as calling the methods with the column
-                       // numbers actually performs this call each time they are called. This
-                       // really speeds things up on large queries.
-                       //
-                       int col_a = rs.findColumn("a");
-                       int col_b = rs.findColumn("b");
-
-                       // Now we run through the result set, printing out the result.
-                       // Again, we must call .next() before attempting to read any results
-                       while (rs.next())
-                       {
-                               int a = rs.getInt(col_a); // This shows how to get the value by name
-                               int b = rs.getInt(col_b); // This shows how to get the value by column
-                               System.out.println("  a=" + a + " b=" + b);
-                       }
-                       rs.close(); // again, you must close the result when done
-               }
-
-               // Now test maxrows by setting it to 3 rows
-
-
-
-               st.setMaxRows(3);
-               System.out.println("performing a query limited to " + st.getMaxRows());
-               rs = st.executeQuery("select a, b from basic");
-               while (rs.next())
-               {
-                       int a = rs.getInt("a"); // This shows how to get the value by name
-                       int b = rs.getInt(2);   // This shows how to get the value by column
-                       System.out.println("  a=" + a + " b=" + b);
-               }
-               rs.close(); // again, you must close the result when done
-
-               // The last thing to do is to drop the table. This is done in the
-               // cleanup() method.
-       }
-
-       /*
-        * Display some instructions on how to run the example
-        */
-       public static void instructions()
-       {
-               System.out.println("\nThis example tests the basic components of the JDBC driver, demonstrating\nhow to build simple queries in java.\n");
-               System.out.println("Useage:\n java example.basic jdbc:postgresql:database user password [debug]\n\nThe debug field can be anything. It's presence will enable DriverManager's\ndebug trace. Unless you want to see screens of items, don't put anything in\nhere.");
-               System.exit(1);
-       }
-
-       /*
-        * This little lot starts the test
-        */
-       public static void main(String args[])
-       {
-               System.out.println("PostgreSQL basic test v6.3 rev 1\n");
-
-               if (args.length < 3)
-                       instructions();
-
-               // This line outputs debug information to stderr. To enable this, simply
-               // add an extra parameter to the command line
-               if (args.length > 3)
-                       DriverManager.setLogStream(System.err);
-
-               // Now run the tests
-               try
-               {
-                       basic test = new basic(args);
-               }
-               catch (Exception ex)
-               {
-                       System.err.println("Exception caught.\n" + ex);
-                       ex.printStackTrace();
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/example/blobtest.java b/src/interfaces/jdbc/example/blobtest.java
deleted file mode 100644 (file)
index d517d26..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-package example;
-
-import java.io.*;
-import java.sql.*;
-import org.postgresql.largeobject.*;
-
-/*
- * This test attempts to create a blob in the database, then to read
- * it back.
- *
- * Important note: You will notice we import the org.postgresql.largeobject
- * package, but don't import the org.postgresql package. The reason for this is
- * that importing postgresql can confuse javac (we have conflicting class names
- * in org.postgresql.* and java.sql.*). This doesn't cause any problems, as
- * long as no code imports org.postgresql.
- *
- * Under normal circumstances, code using any jdbc driver only needs to import
- * java.sql, so this isn't a problem.
- *
- * It's only if you use the non jdbc facilities, do you have to take this into
- * account.
- *
- */
-
-public class blobtest
-{
-       Connection db;
-       Statement s;
-       LargeObjectManager lobj;
-
-       public blobtest(String args[]) throws ClassNotFoundException, FileNotFoundException, IOException, SQLException
-       {
-               String url = args[0];
-               String usr = args[1];
-               String pwd = args[2];
-
-               // Load the driver
-               Class.forName("org.postgresql.Driver");
-
-               // Connect to database
-               System.out.println("Connecting to Database URL = " + url);
-               db = DriverManager.getConnection(url, usr, pwd);
-
-               // This is required for all LargeObject calls
-               System.out.println("Connected... First turn off autoCommit()");
-               db.setAutoCommit(false);
-
-               System.out.println("Now creating a statement");
-               s = db.createStatement();
-
-               // Now run tests using postgresql's own Large object api
-               // NOTE: The methods shown in this example are _NOT_ JDBC, but are
-               // an implementation of the calls found in libpq. Unless you need to
-               // use this functionality, look at the jdbc tests on how to access blobs.
-               ownapi();
-
-               // Now run tests using JDBC methods
-               //jdbcapi(db,s);
-
-               // Finally close the database
-               System.out.println("Now closing the connection");
-               s.close();
-               db.close();
-       }
-
-       /*
-        * Now this is an extension to JDBC, unique to postgresql. Here we fetch
-        * an PGlobj object, which provides us with access to postgresql's
-        * large object api.
-        */
-       public void ownapi() throws FileNotFoundException, IOException, SQLException
-       {
-               System.out.println("\n----------------------------------------------------------------------\nTesting postgresql large object api\n----------------------------------------------------------------------\n");
-
-               // Internally, the driver provides JDBC compliant methods to access large
-               // objects, however the unique methods available to postgresql makes
-               // things a little easier.
-               System.out.println("Gaining access to large object api");
-               lobj = ((org.postgresql.PGConnection)db).getLargeObjectAPI();
-
-               int oid = ownapi_test1();
-               ownapi_test2(oid);
-
-               // Now call the jdbc2api test
-               jdbc2api(oid);
-
-               // finally delete the large object
-               ownapi_test3(oid);
-               System.out.println("\n\nOID=" + oid);
-       }
-
-       private int ownapi_test1() throws FileNotFoundException, IOException, SQLException
-       {
-               System.out.println("Test 1 Creating a large object\n");
-
-               // Ok, test 1 is to create a large object. To do this, we use the create
-               // method.
-               System.out.println("Creating a large object");
-               int oid = lobj.create(LargeObjectManager.READ | LargeObjectManager.WRITE);
-               DriverManager.println("got large object oid=" + oid);
-
-               LargeObject obj = lobj.open(oid, LargeObjectManager.WRITE);
-               DriverManager.println("got large object obj=" + obj);
-
-               // Now open a test file - this class will do
-               System.out.println("Opening test source object");
-               FileInputStream fis = new FileInputStream("example/blobtest.java");
-
-               // copy the data
-               System.out.println("Copying file to large object");
-               byte buf[] = new byte[2048];
-               int s, tl = 0;
-               while ((s = fis.read(buf, 0, 2048)) > 0)
-               {
-                       System.out.println("Block size=" + s + " offset=" + tl);
-                       //System.out.write(buf);
-                       obj.write(buf, 0, s);
-                       tl += s;
-               }
-               DriverManager.println("Copied " + tl + " bytes");
-
-               // Close the object
-               System.out.println("Closing object");
-               obj.close();
-
-               return oid;
-       }
-
-       private void ownapi_test2(int oid) throws FileNotFoundException, IOException, SQLException
-       {
-               System.out.println("Test 2 Reading a large object and save as a file\n");
-
-               // Now open the large object
-               System.out.println("Opening large object " + oid);
-               LargeObject obj = lobj.open(oid, LargeObjectManager.READ);
-               DriverManager.println("got obj=" + obj);
-
-               // Now open a test file - this class will do
-               System.out.println("Opening test destination object");
-               FileOutputStream fos = new FileOutputStream("blob_testoutput");
-
-               // copy the data
-               System.out.println("Copying large object to file");
-               byte buf[] = new byte[512];
-               int s = obj.size();
-               int tl = 0;
-               while (s > 0)
-               {
-                       int rs = buf.length;
-                       if (s < rs)
-                               rs = s;
-                       obj.read(buf, 0, rs);
-                       fos.write(buf, 0, rs);
-                       tl += rs;
-                       s -= rs;
-               }
-               DriverManager.println("Copied " + tl + "/" + obj.size() + " bytes");
-
-               // Close the object
-               System.out.println("Closing object");
-               obj.close();
-       }
-
-       private void ownapi_test3(int oid) throws SQLException
-       {
-               System.out.println("Test 3 Deleting a large object\n");
-
-               // Now open the large object
-               System.out.println("Deleting large object " + oid);
-               lobj.unlink(oid);
-       }
-
-       // This tests the Blob interface of the JDBC 2.0 specification
-       public void jdbc2api(int oid) throws SQLException, IOException
-       {
-               System.out.println("Testing JDBC2 Blob interface:");
-               jdbc2api_cleanup();
-
-               System.out.println("Creating Blob on large object " + oid);
-               s.executeUpdate("create table basic (a oid)");
-
-               System.out.println("Inserting row");
-               s.executeUpdate("insert into basic values (" + oid + ")");
-
-               System.out.println("Selecting row");
-               ResultSet rs = s.executeQuery("select a from basic");
-               if (rs != null)
-               {
-                       while (rs.next())
-                       {
-                               System.out.println("Fetching Blob");
-                               Blob b = rs.getBlob("a");
-                               System.out.println("Blob.length() = " + b.length());
-                               System.out.println("Characters 400-500:");
-                               System.out.write(b.getBytes(400l, 100));
-                               System.out.println();
-                       }
-                       rs.close();
-               }
-
-               System.out.println("Cleaning up");
-               jdbc2api_cleanup();
-       }
-
-       private void jdbc2api_cleanup() throws SQLException
-       {
-               db.setAutoCommit(true);
-               try
-               {
-                       s.executeUpdate("drop table basic");
-               }
-               catch (Exception ex)
-               {
-                       // We ignore any errors here
-               }
-               db.setAutoCommit(false);
-       }
-
-       public static void instructions()
-       {
-               System.err.println("java example.blobtest jdbc-url user password [debug]");
-               System.err.println("\nExamples:\n");
-               System.err.println("java -Djdbc.driver=org.postgresql.Driver example.blobtest jdbc:postgresql:test postgres password\nThis will run the tests on the database test on the local host.\n");
-               System.err.println("java -Djdbc.driver=org.postgresql.Driver example.blobtest jdbc:postgresql:test postgres password debug\nThis is the same as above, but will output debug information.\n");
-
-               System.err.println("This example tests the binary large object api of the driver.\nThis allows images or java objects to be stored in the database, and retrieved\nusing both postgresql's own api, and the standard JDBC api.");
-       }
-
-       public static void main(String args[])
-       {
-               System.out.println("PostgreSQL blobtest v7.0 rev 1\n");
-
-               if (args.length < 3)
-               {
-                       instructions();
-                       System.exit(1);
-               }
-
-               // This line outputs debug information to stderr. To enable this, simply
-               // add an extra parameter to the command line
-               if (args.length > 3)
-                       DriverManager.setLogStream(System.err);
-
-               // Now run the tests
-               try
-               {
-                       blobtest test = new blobtest(args);
-               }
-               catch (Exception ex)
-               {
-                       System.err.println("Exception caught.\n" + ex);
-                       ex.printStackTrace();
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/example/corba/StockClient.java b/src/interfaces/jdbc/example/corba/StockClient.java
deleted file mode 100644 (file)
index 217552f..0000000
+++ /dev/null
@@ -1,348 +0,0 @@
-package example.corba;
-
-import java.io.*;
-import java.sql.*;
-import org.omg.CosNaming.*;
-
-/*
- * This class is the frontend to our mini CORBA application.
- *
- * It has no GUI, just a text frontend to keep it simple.
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/example/corba/StockClient.java,v 1.7 2003/11/29 22:41:21 pgsql Exp $
- */
-public class StockClient
-{
-       org.omg.CosNaming.NamingContext nameService;
-
-       stock.StockDispenser dispenser;
-       stock.StockItem item;
-
-       BufferedReader  in;
-
-       public StockClient(String[] args)
-       {
-               try
-               {
-                       // We need this for our IO
-                       in = new BufferedReader(new InputStreamReader(System.in));
-
-                       // Initialize the orb
-                       org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
-
-                       // Get a reference to the Naming Service
-                       org.omg.CORBA.Object nameServiceObj = orb.resolve_initial_references("NameService");
-                       if (nameServiceObj == null)
-                       {
-                               System.err.println("nameServiceObj == null");
-                               return ;
-                       }
-
-                       nameService = org.omg.CosNaming.NamingContextHelper.narrow(nameServiceObj);
-                       if (nameService == null)
-                       {
-                               System.err.println("nameService == null");
-                               return ;
-                       }
-
-                       // Resolve the dispenser
-                       NameComponent[] dispName = {
-                                                                                  new NameComponent("StockDispenser", "Stock")
-                                                                          };
-                       dispenser = stock.StockDispenserHelper.narrow(nameService.resolve(dispName));
-                       if (dispenser == null)
-                       {
-                               System.err.println("dispenser == null");
-                               return ;
-                       }
-
-                       // Now run the front end.
-                       run();
-               }
-               catch (Exception e)
-               {
-                       System.out.println(e.toString());
-                       e.printStackTrace();
-                       System.exit(1);
-               }
-       }
-
-       public static void main(String[] args)
-       {
-               new StockClient(args);
-       }
-
-       public void run()
-       {
-               // First reserve a StockItem
-               try
-               {
-                       item = dispenser.reserveItem();
-               }
-               catch (Exception e)
-               {
-                       System.out.println(e.toString());
-                       e.printStackTrace();
-                       System.exit(1);
-               }
-
-               mainMenu();
-
-               // finally free the StockItem
-               try
-               {
-                       dispenser.releaseItem(item);
-               }
-               catch (Exception e)
-               {
-                       System.out.println(e.toString());
-                       e.printStackTrace();
-                       System.exit(1);
-               }
-       }
-
-       private void mainMenu()
-       {
-               boolean run = true;
-               while (run)
-               {
-                       System.out.println("\nCORBA Stock System\n");
-                       System.out.println("  1 Display stock item");
-                       System.out.println("  2 Remove item from stock");
-                       System.out.println("  3 Put item into stock");
-                       System.out.println("  4 Order item");
-                       System.out.println("  5 Display all items");
-                       System.out.println("  0 Exit");
-                       int i = getMenu("Main", 5);
-                       switch (i)
-                       {
-                               case 0:
-                                       run = false;
-                                       break;
-
-                               case 1:
-                                       displayItem();
-                                       break;
-
-                               case 2:
-                                       bookOut();
-                                       break;
-
-                               case 3:
-                                       bookIn();
-                                       break;
-
-                               case 4:
-                                       order(0);
-                                       break;
-
-                               case 5:
-                                       displayAll();
-                                       break;
-                       }
-               }
-       }
-
-       private void displayItem()
-       {
-               try
-               {
-                       int id = getMenu("\nStockID to display", item.getLastID());
-                       if (id > 0)
-                       {
-                               item.fetchItem(id);
-                               System.out.println("========================================");
-
-                               String status = "";
-                               if (!item.isItemValid())
-                                       status = " ** Superceded **";
-
-                               int av = item.getAvailable();
-
-                               System.out.println("      Stock ID: " + id + status +
-                                                                  "\nItems Available: " + av +
-                                                                  "\nItems on order: " + item.getOrdered() +
-                                                                  "\n   Description: " + item.getDescription());
-                               System.out.println("========================================");
-
-                               if (av > 0)
-                                       if (yn("Take this item out of stock?"))
-                                       {
-                                               int rem = 1;
-                                               if (av > 1)
-                                                       rem = getMenu("How many?", av);
-                                               if (rem > 0)
-                                                       item.removeStock(rem);
-                                       }
-
-                       }
-               }
-               catch (Exception e)
-               {
-                       System.out.println(e.toString());
-                       e.printStackTrace();
-               }
-       }
-
-       private void bookOut()
-       {
-               try
-               {
-                       int id = getMenu("\nStockID to take out", item.getLastID());
-                       if (id > 0)
-                       {
-                               item.fetchItem(id);
-                               int av = item.getAvailable();
-                               if (av > 0)
-                                       if (yn("Take this item out of stock?"))
-                                       {
-                                               int rem = 1;
-                                               if (av > 1)
-                                                       rem = getMenu("How many?", av);
-                                               if (rem > 0)
-                                                       item.removeStock(rem);
-                                       }
-                                       else
-                                       {
-                                               System.out.println("This item is not in stock.");
-                                               int order = item.getOrdered();
-                                               if (order > 0)
-                                                       System.out.println("There are " + item.getOrdered() + " items on order.");
-                                               else
-                                               {
-                                                       if (item.isItemValid())
-                                                       {
-                                                               System.out.println("You will need to order some more " + item.getDescription());
-                                                               order(id);
-                                                       }
-                                                       else
-                                                               System.out.println("This item is now obsolete");
-                                               }
-                                       }
-                       }
-                       else
-                               System.out.println(item.getDescription() + "\nThis item is out of stock");
-               }
-               catch (Exception e)
-               {
-                       System.out.println(e.toString());
-                       e.printStackTrace();
-               }
-       }
-
-       // book an item into stock
-       private void bookIn()
-       {
-               try
-               {
-                       int id = getMenu("\nStockID to book in", item.getLastID());
-                       item.fetchItem(id);
-                       System.out.println(item.getDescription());
-
-                       if (item.getOrdered() > 0)
-                       {
-                               int am = getMenu("How many do you want to book in", item.getOrdered());
-                               if (am > 0)
-                                       item.addNewStock(am);
-                       }
-                       else
-                               System.out.println("You don't have any of this item on ordered");
-
-               }
-               catch (Exception e)
-               {
-                       System.out.println(e.toString());
-                       e.printStackTrace();
-               }
-       }
-
-       // Order an item
-       private void order(int id)
-       {
-               try
-               {
-                       if (id == 0)
-                               id = getMenu("\nStockID to order", item.getLastID());
-                       item.fetchItem(id);
-                       System.out.println(item.getDescription());
-                       int am = getMenu("How many do you want to order", 999);
-                       if (am > 0)
-                               item.orderStock(am);
-               }
-               catch (Exception e)
-               {
-                       System.out.println(e.toString());
-                       e.printStackTrace();
-               }
-       }
-
-       private void displayAll()
-       {
-               try
-               {
-                       boolean cont = true;
-                       int nr = item.getLastID();
-                       String header = "\nId\tAvail\tOrdered\tDescription";
-                       System.out.println(header);
-                       for (int i = 1;i <= nr && cont;i++)
-                       {
-                               item.fetchItem(i);
-                               System.out.println("" + i + "\t" + item.getAvailable() + "\t" + item.getOrdered() + "\t" + item.getDescription());
-                               if ((i % 20) == 0)
-                               {
-                                       if ((cont = yn("Continue?")))
-                                               System.out.println(header);
-                               }
-                       }
-               }
-               catch (Exception e)
-               {
-                       System.out.println(e.toString());
-                       e.printStackTrace();
-               }
-       }
-
-       private int getMenu(String title, int max)
-       {
-               int v = -1;
-               while (v < 0 || v > max)
-               {
-                       System.out.print(title);
-                       System.out.print(" [0-" + max + "]: ");
-                       System.out.flush();
-                       try
-                       {
-                               v = Integer.parseInt(in.readLine());
-                       }
-                       catch (Exception nfe)
-                       {
-                               v = -1;
-                       }
-               }
-               return v;
-       }
-
-       private boolean yn(String title)
-       {
-               try
-               {
-                       while (true)
-                       {
-                               System.out.print(title);
-                               System.out.flush();
-                               String s = in.readLine();
-                               if (s.startsWith("y") || s.startsWith("Y"))
-                                       return true;
-                               if (s.startsWith("n") || s.startsWith("N"))
-                                       return false;
-                       }
-               }
-               catch (Exception nfe)
-               {
-                       System.out.println(nfe.toString());
-                       nfe.printStackTrace();
-                       System.exit(1);
-               }
-               return false;
-       }
-}
diff --git a/src/interfaces/jdbc/example/corba/StockDB.java b/src/interfaces/jdbc/example/corba/StockDB.java
deleted file mode 100644 (file)
index 90fb8d2..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-package example.corba;
-
-import java.sql.*;
-
-/*
- * This class handles the JDBC side of things. It opens a connection to
- * the database, and performes queries on that database.
- *
- * In essence, you could use this class on it's own. The rest of the classes
- * in this example handle either the CORBA mechanism, or the frontend.
- *
- * Note: Before you ask, why perform a query on each call, you have to remember
- * that an object could be changed by another client, and we need to ensure that
- * the returned data is live and accurate.
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/example/corba/StockDB.java,v 1.5 2003/11/29 22:41:21 pgsql Exp $
- */
-public class StockDB
-{
-       Connection con;
-       Statement st;
-
-       // the current stock number
-       int id = -1;
-
-       public void connect(String url, String usr, String pwd) throws Exception
-       {
-               Class.forName("org.postgresql.Driver");
-               System.out.println("Connecting to " + url);
-               con = DriverManager.getConnection(url, usr, pwd);
-               st = con.createStatement();
-       }
-
-       public void closeConnection() throws Exception
-       {
-               con.close();
-       }
-
-       public void fetchItem(int id) throws Exception
-       {
-               this.id = id;
-       }
-
-       public int newItem() throws Exception
-       {
-               // tba
-               return -1;
-       }
-
-       public String getDescription() throws SQLException
-       {
-               ResultSet rs = st.executeQuery("select description from stock where id=" + id);
-               if (rs != null)
-               {
-                       rs.next();
-                       String s = rs.getString(1);
-                       rs.close();
-                       return s;
-               }
-               throw new SQLException("No ResultSet");
-       }
-
-       public int getAvailable() throws SQLException
-       {
-               ResultSet rs = st.executeQuery("select avail from stock where id=" + id);
-               if (rs != null)
-               {
-                       rs.next();
-                       int v = rs.getInt(1);
-                       rs.close();
-                       return v;
-               }
-               throw new SQLException("No ResultSet");
-       }
-
-       public int getOrdered() throws SQLException
-       {
-               ResultSet rs = st.executeQuery("select ordered from stock where id=" + id);
-               if (rs != null)
-               {
-                       rs.next();
-                       int v = rs.getInt(1);
-                       rs.close();
-                       return v;
-               }
-               throw new SQLException("No ResultSet");
-       }
-
-       public boolean isItemValid() throws SQLException
-       {
-               ResultSet rs = st.executeQuery("select valid from stock where id=" + id);
-               if (rs != null)
-               {
-                       rs.next();
-                       boolean b = rs.getBoolean(1);
-                       rs.close();
-                       return b;
-               }
-               throw new SQLException("No ResultSet");
-       }
-
-       public void addNewStock(int amount) throws SQLException
-       {
-               st.executeUpdate("update stock set avail=avail+" + amount +
-                                                ", ordered=ordered-" + amount +
-                                                " where id=" + id + " and ordered>=" + amount);
-       }
-
-       public void removeStock(int amount) throws SQLException
-       {
-               st.executeUpdate("update stock set avail=avail-" + amount +
-                                                " where id=" + id);
-       }
-
-       public void orderStock(int amount) throws SQLException
-       {
-               st.executeUpdate("update stock set ordered=ordered+" + amount +
-                                                " where id=" + id);
-       }
-
-       public int getLastID() throws SQLException
-       {
-               ResultSet rs = st.executeQuery("select max(id) from stock");
-               if (rs != null)
-               {
-                       rs.next();
-                       int v = rs.getInt(1);
-                       rs.close();
-                       return v;
-               }
-               throw new SQLException("No ResultSet");
-       }
-
-}
diff --git a/src/interfaces/jdbc/example/corba/StockDispenserImpl.java b/src/interfaces/jdbc/example/corba/StockDispenserImpl.java
deleted file mode 100644 (file)
index 132b58f..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-package example.corba;
-
-import org.omg.CosNaming.*;
-
-/*
- * This class implements the server side of the example.
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/example/corba/StockDispenserImpl.java,v 1.6 2003/11/29 22:41:21 pgsql Exp $
- */
-public class StockDispenserImpl extends stock._StockDispenserImplBase
-{
-       private int maxObjects = 10;
-       private int numObjects = 0;
-       private StockItemStatus[] stock = new StockItemStatus[maxObjects];
-
-       public StockDispenserImpl(String[] args, String name, int num)
-       {
-               super();
-
-               try
-               {
-                       // get reference to orb
-                       org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
-
-                       // prestart num objects
-                       if (num >= maxObjects)
-                               num = maxObjects;
-                       numObjects = num;
-                       for (int i = 0;i < numObjects;i++)
-                       {
-                               stock[i] = new StockItemStatus();
-                               stock[i].ref = new StockItemImpl(args, "StockItem" + (i + 1));
-                               orb.connect(stock[i].ref);
-                       }
-               }
-               catch (org.omg.CORBA.SystemException e)
-               {
-                       e.printStackTrace();
-               }
-       }
-
-       /*
-        * This method, defined in stock.idl, reserves a slot in the dispenser
-        */
-       public stock.StockItem reserveItem() throws stock.StockException
-       {
-               for (int i = 0;i < numObjects;i++)
-               {
-                       if (!stock[i].inUse)
-                       {
-                               stock[i].inUse = true;
-                               System.out.println("Reserving slot " + i);
-                               return stock[i].ref;
-                       }
-               }
-               return null;
-       }
-
-       /*
-        * This releases a slot from the dispenser
-        */
-       public void releaseItem(stock.StockItem item) throws stock.StockException
-       {
-               for (int i = 0;i < numObjects;i++)
-               {
-                       if (stock[i].ref.getInstanceName().equals(item.getInstanceName()))
-                       {
-                               stock[i].inUse = false;
-                               System.out.println("Releasing slot " + i);
-                               return ;
-                       }
-               }
-               System.out.println("Reserved object not a member of this dispenser");
-               return ;
-       }
-
-       /*
-        * This class defines a slot in the dispenser
-        */
-       class StockItemStatus
-       {
-               StockItemImpl ref;
-               boolean inUse;
-
-               StockItemStatus()
-               {
-                       ref = null;
-                       inUse = false;
-               }
-       }
-
-}
diff --git a/src/interfaces/jdbc/example/corba/StockItemImpl.java b/src/interfaces/jdbc/example/corba/StockItemImpl.java
deleted file mode 100644 (file)
index 4b52dc1..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-package example.corba;
-
-import org.omg.CosNaming.*;
-
-/*
- * This class implements the server side of the example.
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/example/corba/StockItemImpl.java,v 1.4 2003/11/29 22:41:21 pgsql Exp $
- */
-public class StockItemImpl extends stock._StockItemImplBase
-{
-       private StockDB db;
-       private String instanceName;
-
-       public StockItemImpl(String[] args, String iname)
-       {
-               super();
-               try
-               {
-                       db = new StockDB();
-                       db.connect(args[1], args[2], args[3]);
-                       System.out.println("StockDB object " + iname + " created");
-                       instanceName = iname;
-               }
-               catch (Exception e)
-               {
-                       e.printStackTrace();
-               }
-       }
-
-       /*
-        * This is defined in stock.idl
-        *
-        * It sets the item to view
-        */
-       public void fetchItem(int id) throws stock.StockException
-       {
-               try
-               {
-                       db.fetchItem(id);
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-
-       /*
-        * This is defined in stock.idl
-        *
-        * It sets the item to view
-        */
-       public int newItem() throws stock.StockException
-       {
-               try
-               {
-                       return db.newItem();
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-       /*
-        * This is defined in stock.idl
-        *
-        * It returns the description of a Stock item
-        */
-       public String getDescription() throws stock.StockException
-       {
-               try
-               {
-                       return db.getDescription();
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-       /*
-        * This is defined in stock.idl
-        *
-        * It returns the description of a Stock item
-        */
-       public int getAvailable() throws stock.StockException
-       {
-               try
-               {
-                       return db.getAvailable();
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-       /*
-        * This is defined in stock.idl
-        *
-        * It returns the description of a Stock item
-        */
-       public int getOrdered() throws stock.StockException
-       {
-               try
-               {
-                       return db.getOrdered();
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-       /*
-        * This is defined in stock.idl
-        *
-        * It returns the description of a Stock item
-        */
-       public boolean isItemValid() throws stock.StockException
-       {
-               try
-               {
-                       return db.isItemValid();
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-       /*
-        * This is defined in stock.idl
-        *
-        * It returns the description of a Stock item
-        */
-       public void addNewStock(int id) throws stock.StockException
-       {
-               try
-               {
-                       db.addNewStock(id);
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-       /*
-        * This is defined in stock.idl
-        *
-        * It returns the description of a Stock item
-        */
-       public void removeStock(int id) throws stock.StockException
-       {
-               try
-               {
-                       db.removeStock(id);
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-       /*
-        * This is defined in stock.idl
-        *
-        * It returns the description of a Stock item
-        */
-       public void orderStock(int id) throws stock.StockException
-       {
-               try
-               {
-                       db.orderStock(id);
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-       /*
-        * This returns the highest id used, hence the number of items available
-        */
-       public int getLastID() throws stock.StockException
-       {
-               try
-               {
-                       return db.getLastID();
-               }
-               catch (Exception e)
-               {
-                       throw new stock.StockException(e.toString());
-               }
-       }
-
-       /*
-        * This is used by our Dispenser
-        */
-       public String getInstanceName()
-       {
-               return instanceName;
-       }
-}
-
diff --git a/src/interfaces/jdbc/example/corba/StockServer.java b/src/interfaces/jdbc/example/corba/StockServer.java
deleted file mode 100644 (file)
index 18c8b89..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-package example.corba;
-
-import org.omg.CosNaming.*;
-
-/*
- * This class implements the server side of the example.
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/example/corba/StockServer.java,v 1.6 2003/11/29 22:41:21 pgsql Exp $
- */
-public class StockServer
-{
-       public static void main(String[] args)
-       {
-               int numInstances = 3;
-
-               try
-               {
-                       // Initialise the ORB
-                       org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
-
-                       // Create the StockDispenser object
-                       StockDispenserImpl dispenser = new StockDispenserImpl(args, "Stock Dispenser", numInstances);
-
-                       // Export the new object
-                       orb.connect(dispenser);
-
-                       // Get the naming service
-                       org.omg.CORBA.Object nameServiceObj = orb.resolve_initial_references("NameService");
-                       if (nameServiceObj == null)
-                       {
-                               System.err.println("nameServiceObj = null");
-                               return ;
-                       }
-
-                       org.omg.CosNaming.NamingContext nameService = org.omg.CosNaming.NamingContextHelper.narrow(nameServiceObj);
-                       if (nameService == null)
-                       {
-                               System.err.println("nameService = null");
-                               return ;
-                       }
-
-                       // bind the dispenser into the naming service
-                       NameComponent[] dispenserName = {
-                                                                                               new NameComponent("StockDispenser", "Stock")
-                                                                                       };
-                       nameService.rebind(dispenserName, dispenser);
-
-                       // Now wait forever for the current thread to die
-                       Thread.currentThread().join();
-               }
-               catch (Exception e)
-               {
-                       e.printStackTrace();
-               }
-       }
-}
-
-
diff --git a/src/interfaces/jdbc/example/corba/readme b/src/interfaces/jdbc/example/corba/readme
deleted file mode 100644 (file)
index d44c176..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-
-The CORBA example is the most complicated of the examples. It
-aims to show how to use JDBC & Java2's ORB to access PostgreSQL.
-
-To compile:
-
-Type "make corba" to build the example. This will create a new directory
-stock which contains the stubs needed by the orb, and all required classes
-under the example/corba directory.
-
-To run:
-
-NOTE: To run, you will need 3 shells on Win32 (under unix you can get away
-with two shells):
-
-1: Start the naming service
-
-Unix:  tnameserv -ORBInitialPort 1050 &
-Win32: tnameserv -ORBInitialPort 1050
-
-2: Start the StockServer
-
-       java example.corba.StockServer 3 jdbc:postgresql:dbase user passwd -ORBInitialPort 1050
-
-Where:
-       3       Number of concurrent sessions to allow
-       dbase   The database (including a hostname if required)
-       user    The PostgreSQL user name
-       passwd  The password
-
-3: Using a fresh shell, run the client:
-
-       java example.corba.StockClient -ORBInitialPort 1050
-
diff --git a/src/interfaces/jdbc/example/corba/stock.idl b/src/interfaces/jdbc/example/corba/stock.idl
deleted file mode 100755 (executable)
index 4be5a79..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-// $PostgreSQL: pgsql/src/interfaces/jdbc/example/corba/stock.idl,v 1.2 2003/11/29 22:41:21 pgsql Exp $
-//
-// This is our CORBA bindings for a very simple stock control
-// system.
-//
-// $PostgreSQL: pgsql/src/interfaces/jdbc/example/corba/stock.idl,v 1.2 2003/11/29 22:41:21 pgsql Exp $
-//
-
-// For some reason, idltojava on my setup doesn't like this to be
-// in caps. It could be a problem with Win95 & Samba, but for now,
-// this is in lowercase
-module stock
-{
-  exception StockException
-    {
-      string reason;
-    };
-  
-  interface StockItem
-      {
-         void fetchItem(in long id) raises (StockException);
-         long newItem() raises (StockException);
-         string getDescription() raises (StockException);
-         long getAvailable() raises (StockException);
-         long getOrdered() raises (StockException);
-         boolean isItemValid() raises (StockException);
-         void addNewStock(in long amount) raises (StockException);
-         void removeStock(in long amount) raises (StockException);
-         void orderStock(in long amount) raises (StockException);
-         long getLastID() raises (StockException);
-         string getInstanceName();
-      };
-  
-  interface StockDispenser
-      {
-         StockItem reserveItem() raises (StockException);
-         void releaseItem(in StockItem item) raises (StockException);
-      };
-  
-};
diff --git a/src/interfaces/jdbc/example/corba/stock.sql b/src/interfaces/jdbc/example/corba/stock.sql
deleted file mode 100644 (file)
index 6082ad6..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---
--- This creates the database for the stock example
--- $PostgreSQL: pgsql/src/interfaces/jdbc/example/corba/stock.sql,v 1.2 2003/11/29 22:41:21 pgsql Exp $
---
-drop table stock;
-
-create table stock (
-       id int4,
-       avail int4,
-       ordered int4,
-       valid bool,
-       description text
-);
-
-create index stock_id on stock(id);
-
-copy stock from stdin;
-1      19      0       t       Dell Latitude XPi P133 Laptop
-2      3       2       t       Iomega Zip Plus drive
-3      2       0       f       Iomega Ext/Par drive
-4      0       4       t       Iomega Ext USB drive
-5      200     0       t       Blank Unbranded CDR media
-6      20      30      t       Iomega Zip media 100Mb
-\.
-
-grant all on stock to public;
-grant all on stock_id to public;
diff --git a/src/interfaces/jdbc/example/datestyle.java b/src/interfaces/jdbc/example/datestyle.java
deleted file mode 100644 (file)
index 26a14a7..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-package example;
-
-import java.io.*;
-import java.sql.*;
-
-/*
- * This example tests the various date styles that are available to postgresql.
- *
- * To use this example, you need a database to be in existence. This example
- * will create a table called datestyle.
- */
-
-public class datestyle
-{
-       Connection db;  // The connection to the database
-       Statement st;   // Our statement to run queries with
-
-       // This is our standard to compare results with.
-       java.sql.Date standard;
-
-       // This is a list of the available date styles including variants.
-       // These have to match what the "set datestyle" statement accepts.
-       String styles[] = {
-                                                 "postgres,european",
-                                                 "postgres,us",
-                                                 "iso",                // iso has no variants - us/european has no affect
-                                                 "sql,european",
-                                                 "sql,us",
-                                                 "german"              // german has no variants - us/european has no affect
-                                         };
-
-       public datestyle(String args[]) throws ClassNotFoundException, FileNotFoundException, IOException, SQLException
-       {
-               String url = args[0];
-               String usr = args[1];
-               String pwd = args[2];
-
-               // Load the driver
-               Class.forName("org.postgresql.Driver");
-
-               // Connect to database
-               System.out.println("Connecting to Database URL = " + url);
-               db = DriverManager.getConnection(url, usr, pwd);
-
-               System.out.println("Connected...Now creating a statement");
-               st = db.createStatement();
-
-               // Clean up the database (in case we failed earlier) then initialise
-               cleanup();
-               init();
-
-               // Now run tests using JDBC methods
-               doexample();
-
-               // Clean up the database
-               cleanup();
-
-               // Finally close the database
-               System.out.println("Now closing the connection");
-               st.close();
-               db.close();
-
-       }
-
-       /*
-        * This drops the table (if it existed). No errors are reported.
-        */
-       public void cleanup()
-       {
-               try
-               {
-                       st.executeUpdate("drop table datestyle");
-               }
-               catch (Exception ex)
-               {
-                       // We ignore any errors here
-               }
-       }
-
-       /*
-        * This initialises the database for this example
-        */
-       public void init() throws SQLException
-       {
-               // Create a table holding a single date
-               st.executeUpdate("create table datestyle (dt date)");
-
-               // Now create our standard date for the test.
-               //
-               // NB: each component of the date should be different, otherwise the tests
-               //         will not be valid.
-               //
-               // NB: January = 0 here
-               //
-               standard = new java.sql.Date(98, 0, 8);
-
-               // Now store the result.
-               //
-               // This is an example of how to set a date in a date style independent way.
-               // The only way of doing this is by using a PreparedStatement.
-               //
-               PreparedStatement ps = db.prepareStatement("insert into datestyle values (?)");
-               ps.setDate(1, standard);
-               ps.executeUpdate();
-               ps.close();
-       }
-
-       /*
-        * This performs the example
-        */
-       public void doexample() throws SQLException
-       {
-               System.out.println("\nRunning tests:");
-
-               for (int i = 0;i < styles.length;i++)
-               {
-                       System.out.print("Test " + i + " - " + styles[i]);
-                       System.out.flush();
-
-                       // set the style
-                       st.executeUpdate("set datestyle='" + styles[i] + "'");
-
-                       // Now because the driver needs to know what the current style is,
-                       // we have to run the following:
-                       st.executeUpdate("show datestyle");
-                       // This is a limitation, but there is no real way around this.
-
-                       // Now we query the table.
-                       ResultSet rs = st.executeQuery("select dt from datestyle");
-
-                       // Throw an exception if there is no result (if the table is empty
-                       // there should still be a result).
-                       if (rs == null)
-                               throw new SQLException("The test query returned no data");
-
-                       while (rs.next())
-                       {
-                               // The JDBC spec states we should only read each column once.
-                               // In the current implementation of the driver, this is not necessary.
-                               // Here we use this fact to see what the query really returned.
-                               if (standard.equals(rs.getDate(1)))
-                                       System.out.println(" passed, returned " + rs.getString(1));
-                               else
-                                       System.out.println(" failed, returned " + rs.getString(1));
-                       }
-                       rs.close();
-               }
-       }
-
-       /*
-        * Display some instructions on how to run the example
-        */
-       public static void instructions()
-       {
-               System.out.println("\nThis example tests the drivers ability to handle dates correctly if the\nbackend is running any of the various date styles that it supports.\nIdealy this should work fine. If it doesn't, then there is something wrong\npossibly in postgresql.Connection or in the backend itself. If this does occur\nthen please email a bug report.\n");
-               System.out.println("Useage:\n java example.datestyle jdbc:postgresql:database user password [debug]\n\nThe debug field can be anything. It's presence will enable DriverManager's\ndebug trace. Unless you want to see screens of items, don't put anything in\nhere.");
-               System.exit(1);
-       }
-
-       /*
-        * This little lot starts the test
-        */
-       public static void main(String args[])
-       {
-               System.out.println("PostgreSQL datestyle test v6.3 rev 1\n");
-
-               if (args.length < 3)
-                       instructions();
-
-               // This line outputs debug information to stderr. To enable this, simply
-               // add an extra parameter to the command line
-               if (args.length > 3)
-                       DriverManager.setLogStream(System.err);
-
-               // Now run the tests
-               try
-               {
-                       datestyle test = new datestyle(args);
-               }
-               catch (Exception ex)
-               {
-                       System.err.println("Exception caught.\n" + ex);
-                       ex.printStackTrace();
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/example/metadata.java b/src/interfaces/jdbc/example/metadata.java
deleted file mode 100644 (file)
index b796329..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-package example;
-
-import java.io.*;
-import java.sql.*;
-
-/*
- * This example application is not really an example. It actually performs
- * some tests on various methods in the DatabaseMetaData and ResultSetMetaData
- * classes.
- *
- * To use it, simply have a database created. It will create some work tables
- * and run tests on them.
- */
-
-public class metadata
-{
-       Connection      db;             // The connection to the database
-       Statement       st;             // Our statement to run queries with
-       DatabaseMetaData dbmd;  // This defines the structure of the database
-
-       /*
-        * These are the available tests on DatabaseMetaData
-        */
-       public void doDatabaseMetaData() throws SQLException
-       {
-               if (doTest("getProcedures() - should show all available procedures"))
-                       displayResult(dbmd.getProcedures(null, null, null));
-
-               if (doTest("getProcedures() with pattern - should show all circle procedures"))
-                       displayResult(dbmd.getProcedures(null, null, "circle%"));
-
-               if (doTest("getProcedureColumns() on circle procedures"))
-                       displayResult(dbmd.getProcedureColumns(null, null, "circle%", null));
-
-               if (doTest("getTables()"))
-                       displayResult(dbmd.getTables(null, null, null, null));
-
-               if (doTest("getColumns() - should show all tables, can take a while to run"))
-                       displayResult(dbmd.getColumns(null, null, null, null));
-
-               if (doTest("getColumns() - should show the test_b table"))
-                       displayResult(dbmd.getColumns(null, null, "test_b", null));
-
-               if (doTest("getColumnPrivileges() - should show all tables"))
-                       displayResult(dbmd.getColumnPrivileges(null, null, null, null));
-
-               if (doTest("getPrimaryKeys()"))
-                       displayResult(dbmd.getPrimaryKeys(null, null, null));
-
-               if (doTest("getTypeInfo()"))
-                       displayResult(dbmd.getTypeInfo());
-
-       }
-
-       /*
-        * These are the available tests on ResultSetMetaData
-        */
-       public void doResultSetMetaData() throws SQLException
-       {
-
-               String sql = "select imagename,descr,source,cost from test_a,test_b,test_c where test_a.id=test_b.imageid and test_a.id=test_c.imageid";
-
-               System.out.println("Executing query for tests");
-               ResultSet rs = st.executeQuery(sql);
-               ResultSetMetaData rsmd = rs.getMetaData();
-
-               if (doTest("isCurrency()"))
-                       System.out.println("isCurrency on col 1 = " + rsmd.isCurrency(1) + " should be false\nisCurrency on col 4 = " + rsmd.isCurrency(4) + " should be true");
-
-               // Finally close the query. Now give the user a chance to display the
-               // ResultSet.
-               //
-               // NB: displayResult() actually closes the ResultSet.
-               if (doTest("Display query result"))
-               {
-                       System.out.println("Query: " + sql);
-                       displayResult(rs);
-               }
-               else
-                       rs.close();
-       }
-
-       /*
-        * This creates some test data
-        */
-       public void init() throws SQLException
-       {
-               System.out.println("Creating some tables");
-               cleanup();
-               st.executeUpdate("create table test_a (imagename name,image oid,id int4)");
-               st.executeUpdate("create table test_b (descr text,imageid int4,id int4)");
-               st.executeUpdate("create table test_c (source text,cost money,imageid int4)");
-
-               System.out.println("Adding some data");
-               st.executeUpdate("insert into test_a values ('test1',0,1)");
-               st.executeUpdate("insert into test_b values ('A test description',1,2)");
-               st.executeUpdate("insert into test_c values ('nowhere particular','$10.99',1)");
-       }
-
-       /*
-        * This removes the test data
-        */
-       public void cleanup() throws SQLException
-       {
-               try
-               {
-                       st.executeUpdate("drop table test_a");
-                       st.executeUpdate("drop table test_b");
-                       st.executeUpdate("drop table test_c");
-               }
-               catch (Exception ex)
-               {
-                       // We ignore any errors here
-               }
-       }
-
-       public metadata(String args[]) throws ClassNotFoundException, FileNotFoundException, IOException, SQLException
-       {
-               String url = args[0];
-               String usr = args[1];
-               String pwd = args[2];
-
-               // Load the driver
-               Class.forName("org.postgresql.Driver");
-
-               // Connect to database
-               System.out.println("Connecting to Database URL = " + url);
-               db = DriverManager.getConnection(url, usr, pwd);
-
-               dbmd = db.getMetaData();
-               st = db.createStatement();
-
-               // This prints the backend's version
-               System.out.println("Connected to " + dbmd.getDatabaseProductName() + " " + dbmd.getDatabaseProductVersion());
-
-               init();
-
-               System.out.println();
-
-               // Now the tests
-               if (doTest("Test DatabaseMetaData"))
-                       doDatabaseMetaData();
-
-               if (doTest("Test ResultSetMetaData"))
-                       doResultSetMetaData();
-
-               System.out.println("\nNow closing the connection");
-               st.close();
-               db.close();
-
-               cleanup();
-       }
-
-       /*
-        * This asks if the user requires to run a test.
-        */
-       public boolean doTest(String s)
-       {
-               System.out.println();
-               System.out.print(s);
-               System.out.print(" Perform test? Y or N:");
-               System.out.flush();
-               char c = ' ';
-               try
-               {
-                       while (!(c == 'n' || c == 'y' || c == 'N' || c == 'Y'))
-                       {
-                               c = (char)System.in.read();
-                       }
-               }
-               catch (IOException ioe)
-               {
-                       return false;
-               }
-
-               return c == 'y' || c == 'Y';
-       }
-
-       /*
-        * This displays a result set.
-        * Note: it closes the result once complete.
-        */
-       public void displayResult(ResultSet rs) throws SQLException
-       {
-               ResultSetMetaData rsmd = rs.getMetaData();
-               int count = 0;
-
-               // Print the result column names
-               int cols = rsmd.getColumnCount();
-               for (int i = 1;i <= cols;i++)
-                       System.out.print(rsmd.getColumnLabel(i) + (i < cols ? "\t" : "\n"));
-
-               // now the results
-               while (rs.next())
-               {
-                       count++;
-                       for (int i = 1;i <= cols;i++)
-                       {
-                               Object o = rs.getObject(i);
-                               if (rs.wasNull())
-                                       System.out.print("{null}" + (i < cols ? "\t" : "\n"));
-                               else
-                                       System.out.print(o.toString() + (i < cols ? "\t" : "\n"));
-                       }
-               }
-
-               System.out.println("Result returned " + count + " rows.");
-
-               // finally close the result set
-               rs.close();
-       }
-
-       /*
-        * This process / commands (for now just /d)
-        */
-       public void processSlashCommand(String line) throws SQLException
-       {
-               if (line.startsWith("\\d"))
-               {
-                       if (line.startsWith("\\d "))
-                       {
-                               // Display details about a table
-                               String table = line.substring(3);
-                               displayResult(dbmd.getColumns(null, null, table, "%"));
-                       }
-                       else
-                       {
-                               String types[] = null;
-                               if (line.equals("\\d"))
-                                       types = allUserTables;
-                               else if (line.equals("\\di"))
-                                       types = usrIndices;
-                               else if (line.equals("\\dt"))
-                                       types = usrTables;
-                               else if (line.equals("\\ds"))
-                                       types = usrSequences;
-                               else if (line.equals("\\dS"))
-                                       types = sysTables;
-                               else
-                                       throw new SQLException("Unsupported \\d command: " + line);
-
-                               // Display details about all system tables
-                               //
-                               // Note: the first two arguments are ignored. To keep to the spec,
-                               //               you must put null here
-                               //
-                               displayResult(dbmd.getTables(null, null, "%", types));
-                       }
-               }
-               else
-                       throw new SQLException("Unsupported \\ command: " + line);
-       }
-
-       private static final String allUserTables[] = {"TABLE", "INDEX", "SEQUENCE"};
-       private static final String usrIndices[] = {"INDEX"};
-       private static final String usrTables[] = {"TABLE"};
-       private static final String usrSequences[] = {"SEQUENCE"};
-       private static final String sysTables[] = {"SYSTEM TABLE", "SYSTEM INDEX"};
-
-       /*
-        * Display some instructions on how to run the example
-        */
-       public static void instructions()
-       {
-               System.out.println("\nThis is not really an example, but is used to test the various methods in\nthe DatabaseMetaData and ResultSetMetaData classes.\n");
-               System.out.println("Useage:\n java example.metadata jdbc:postgresql:database user password [debug]\n\nThe debug field can be anything. It's presence will enable DriverManager's\ndebug trace. Unless you want to see screens of debug items, don't put anything in\nhere.");
-               System.exit(1);
-       }
-
-       /*
-        * This little lot starts the test
-        */
-       public static void main(String args[])
-       {
-               System.out.println("PostgreSQL metdata tester v6.4 rev 1\n");
-
-               if (args.length < 3)
-                       instructions();
-
-               // This line outputs debug information to stderr. To enable this, simply
-               // add an extra parameter to the command line
-               if (args.length > 3)
-                       DriverManager.setLogStream(System.err);
-
-               // Now run the tests
-               try
-               {
-                       metadata test = new metadata(args);
-               }
-               catch (Exception ex)
-               {
-                       System.err.println("Exception caught.\n" + ex);
-                       ex.printStackTrace();
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/example/psql.java b/src/interfaces/jdbc/example/psql.java
deleted file mode 100644 (file)
index 283739a..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-package example;
-
-import java.io.*;
-import java.sql.*;
-
-/*
- * This example application demonstrates some of the drivers other features
- * by implementing a simple psql replacement in Java.
- *
- */
-
-public class psql
-{
-       Connection      db;             // The connection to the database
-       Statement       st;             // Our statement to run queries with
-       DatabaseMetaData dbmd;  // This defines the structure of the database
-       boolean done = false;             // Added by CWJ to permit \q command
-
-       public psql(String args[]) throws ClassNotFoundException, FileNotFoundException, IOException, SQLException
-       {
-               String url = args[0];
-               String usr = args[1];
-               String pwd = args[2];
-
-               // Load the driver
-               Class.forName("org.postgresql.Driver");
-
-               // Connect to database
-               System.out.println("Connecting to Database URL = " + url);
-               db = DriverManager.getConnection(url, usr, pwd);
-
-               dbmd = db.getMetaData();
-               st = db.createStatement();
-
-               // This prints the backend's version
-               System.out.println("Connected to " + dbmd.getDatabaseProductName() + " " + dbmd.getDatabaseProductVersion());
-
-               System.out.println();
-
-               // This provides us the means of reading from stdin
-               StreamTokenizer input = new StreamTokenizer(new InputStreamReader(System.in));
-               input.resetSyntax();
-               input.slashSlashComments(true); // allow // as a comment delimiter
-               input.eolIsSignificant(false);  // treat eol's as spaces
-               input.wordChars(32, 126);
-               input.whitespaceChars(59, 59);
-               // input.quoteChar(39); *** CWJ: messes up literals in query string ***
-
-               // Now the main loop.
-               int tt = 0, lineno = 1;
-               while (tt != StreamTokenizer.TT_EOF && ! done)
-               {
-                       System.out.print("[" + lineno + "] ");
-                       System.out.flush();
-
-                       // Here, we trap SQLException so they don't terminate the application
-                       try
-                       {
-                               if ((tt = input.nextToken()) == StreamTokenizer.TT_WORD)
-                               {
-                                       processLine(input.sval);
-                                       lineno++;
-                               }
-                       }
-                       catch (SQLException ex)
-                       {
-                               System.out.println(ex.getMessage());
-                       }
-               }
-
-               System.out.println("Now closing the connection");
-               st.close();
-               db.close();
-       }
-
-       /*
-        * This processes a statement
-        */
-       public void processLine(String line) throws SQLException
-       {
-               if (line.startsWith("\\"))
-               {
-                       processSlashCommand(line);
-                       return ;
-               }
-
-               boolean type = st.execute(line);
-               boolean loop = true;
-               while (loop)
-               {
-                       if (type)
-                       {
-                               // A ResultSet was returned
-                               ResultSet rs = st.getResultSet();
-                               displayResult(rs);
-                       }
-                       else
-                       {
-                               int count = st.getUpdateCount();
-
-                               if (count == -1)
-                               {
-                                       // This indicates nothing left
-                                       loop = false;
-                               }
-                               else
-                               {
-                                       // An update count was returned
-                                       System.out.println("Updated " + st.getUpdateCount() + " rows");
-                               }
-                       }
-
-                       if (loop)
-                               type = st.getMoreResults();
-               }
-       }
-
-       /*
-        * This displays a result set.
-        * Note: it closes the result once complete.
-        */
-       public void displayResult(ResultSet rs) throws SQLException
-       {
-               ResultSetMetaData rsmd = rs.getMetaData();
-
-               // Print the result column names
-               int cols = rsmd.getColumnCount();
-               for (int i = 1;i <= cols;i++)
-                       System.out.print(rsmd.getColumnLabel(i) + (i < cols ? "\t" : "\n"));
-
-               // now the results
-               while (rs.next())
-               {
-                       for (int i = 1;i <= cols;i++)
-                       {
-                               Object o = rs.getObject(i);
-                               if (rs.wasNull())
-                                       System.out.print("{null}" + (i < cols ? "\t" : "\n"));
-                               else
-                                       System.out.print(o.toString() + (i < cols ? "\t" : "\n"));
-                       }
-               }
-
-               // finally close the result set
-               rs.close();
-       }
-
-       /*
-        * This process / commands (for now just /d)
-        */
-       public void processSlashCommand(String line) throws SQLException
-       {
-               if (line.startsWith("\\d"))
-               {
-
-                       if (line.startsWith("\\d "))
-                       {
-                               // Display details about a table
-                               String table = line.substring(3);
-                               displayResult(dbmd.getColumns(null, null, table, "%"));
-                       }
-                       else
-                       {
-                               String types[] = null;
-                               if (line.equals("\\d"))
-                                       types = allUserTables;
-                               else if (line.equals("\\di"))
-                                       types = usrIndices;
-                               else if (line.equals("\\dt"))
-                                       types = usrTables;
-                               else if (line.equals("\\ds"))
-                                       types = usrSequences;
-                               else if (line.equals("\\dS"))
-                                       types = sysTables;
-                               else
-                                       throw new SQLException("Unsupported \\d command: " + line);
-
-                               // Display details about all system tables
-                               //
-                               // Note: the first two arguments are ignored. To keep to the spec,
-                               //               you must put null here
-                               //
-                               displayResult(dbmd.getTables(null, null, "%", types));
-                       }
-               }
-               else if (line.equals("\\q")) // Added by CWJ to permit \q command
-                       done = true;
-               else
-                       throw new SQLException("Unsupported \\ command: " + line);
-       }
-
-       private static final String allUserTables[] = {"TABLE", "INDEX", "SEQUENCE"};
-       private static final String usrIndices[] = {"INDEX"};
-       private static final String usrTables[] = {"TABLE"};
-       private static final String usrSequences[] = {"SEQUENCE"};
-       private static final String sysTables[] = {"SYSTEM TABLE", "SYSTEM INDEX"};
-
-       /*
-        * Display some instructions on how to run the example
-        */
-       public static void instructions()
-       {
-               System.out.println("\nThis example shows how some of the other JDBC features work within the\ndriver. It does this by implementing a very simple psql equivalent in java.\nNot everything that psql does is implemented.\n");
-               System.out.println("Useage:\n java example.psql jdbc:postgresql:database user password [debug]\n\nThe debug field can be anything. It's presence will enable DriverManager's\ndebug trace. Unless you want to see screens of items, don't put anything in\nhere.");
-               System.exit(1);
-       }
-
-       /*
-        * This little lot starts the test
-        */
-       public static void main(String args[])
-       {
-               System.out.println("PostgreSQL psql example v6.3 rev 1\n");
-
-               if (args.length < 3)
-                       instructions();
-
-               // This line outputs debug information to stderr. To enable this, simply
-               // add an extra parameter to the command line
-               if (args.length > 3)
-                       DriverManager.setLogStream(System.err);
-
-               // Now run the tests
-               try
-               {
-                       psql test = new psql(args);
-               }
-               catch (Exception ex)
-               {
-                       System.err.println("Exception caught.\n" + ex);
-                       ex.printStackTrace();
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/example/threadsafe.java b/src/interfaces/jdbc/example/threadsafe.java
deleted file mode 100644 (file)
index cb6c0d0..0000000
+++ /dev/null
@@ -1,402 +0,0 @@
-package example;
-
-import java.io.*;
-import java.sql.*;
-
-// rare in user code, but we use the LargeObject API in this test
-import org.postgresql.largeobject.*;
-
-/*
- * This example tests the thread safety of the driver.
- *
- * It does this by performing several queries, in different threads. Each
- * thread has it's own Statement object, which is (in my understanding of the
- * jdbc specification) the minimum requirement.
- *
- */
-
-public class threadsafe
-{
-       Connection db;  // The connection to the database
-       Statement st;   // Our statement to run queries with
-
-       public threadsafe(String args[]) throws ClassNotFoundException, FileNotFoundException, IOException, SQLException
-       {
-               String url = args[0];
-               String usr = args[1];
-               String pwd = args[2];
-
-               // Load the driver
-               Class.forName("org.postgresql.Driver");
-
-               // Connect to database
-               System.out.println("Connecting to Database URL = " + url);
-               db = DriverManager.getConnection(url, usr, pwd);
-
-               System.out.println("Connected...Now creating a statement");
-               st = db.createStatement();
-
-               // Clean up the database (in case we failed earlier) then initialise
-               cleanup();
-
-               // Because we use LargeObjects, we must use Transactions
-               db.setAutoCommit(false);
-
-               // Now run tests using JDBC methods, then LargeObjects
-               doexample();
-
-               // Clean up the database
-               cleanup();
-
-               // Finally close the database
-               System.out.println("Now closing the connection");
-               st.close();
-               db.close();
-       }
-
-       /*
-        * This drops the table (if it existed). No errors are reported.
-        */
-       public void cleanup()
-       {
-               try
-               {
-                       st.executeUpdate("drop table basic1");
-               }
-               catch (Exception ex)
-               {
-                       // We ignore any errors here
-               }
-
-               try
-               {
-                       st.executeUpdate("drop table basic2");
-               }
-               catch (Exception ex)
-               {
-                       // We ignore any errors here
-               }
-       }
-
-       /*
-        * This performs the example
-        */
-       public void doexample() throws SQLException
-       {
-               System.out.println("\nThis test runs three Threads. Two simply insert data into a table, then\nthey perform a query. While they are running, a third thread is running,\nand it load data into, then reads from a Large Object.\n\nIf alls well, this should run without any errors. If so, we are Thread Safe.\nWhy test JDBC & LargeObject's? Because both will run over the network\nconnection, and if locking on the stream isn't done correctly, the backend\nwill get pretty confused!\n");
-
-               thread3 thread3 = null;
-
-               try
-               {
-
-                       // create the two threads
-                       Thread thread0 = Thread.currentThread();
-                       Thread thread1 = new thread1(db);
-                       Thread thread2 = new thread2(db);
-                       thread3 = new thread3(db);
-
-                       // now run, and wait for them
-                       thread1.start();
-                       thread2.start();
-                       thread3.start();
-
-                       // ok, I know this is bad, but it does the trick here as our main thread
-                       // will yield as long as either of the children are still running
-                       System.out.println("Waiting for threads to run");
-                       while (thread1.isAlive() || thread2.isAlive() || thread3.isAlive())
-                               Thread.yield();
-               }
-               finally
-               {
-                       // clean up after thread3 (the finally ensures this is run even
-                       // if an exception is thrown inside the try { } construct)
-                       if (thread3 != null)
-                               thread3.cleanup();
-               }
-
-               System.out.println("No Exceptions have been thrown. This is a good omen, as it means that we are\npretty much thread safe as we can get.");
-       }
-
-       // This is the first thread. It's the same as the basic test
-       class thread1 extends Thread
-       {
-               Connection c;
-               Statement st;
-
-               public thread1(Connection c) throws SQLException
-               {
-                       this.c = c;
-                       st = c.createStatement();
-               }
-
-               public void run()
-               {
-                       try
-                       {
-                               System.out.println("Thread 1 running...");
-
-                               // First we need a table to store data in
-                               st.executeUpdate("create table basic1 (a int2, b int2)");
-
-                               // Now insert some data, using the Statement
-                               st.executeUpdate("insert into basic1 values (1,1)");
-                               st.executeUpdate("insert into basic1 values (2,1)");
-                               st.executeUpdate("insert into basic1 values (3,1)");
-
-                               // For large inserts, a PreparedStatement is more efficient, because it
-                               // supports the idea of precompiling the SQL statement, and to store
-                               // directly, a Java object into any column. PostgreSQL doesnt support
-                               // precompiling, but does support setting a column to the value of a
-                               // Java object (like Date, String, etc).
-                               //
-                               // Also, this is the only way of writing dates in a datestyle independent
-                               // manner. (DateStyles are PostgreSQL's way of handling different methods
-                               // of representing dates in the Date data type.)
-                               PreparedStatement ps = db.prepareStatement("insert into basic1 values (?,?)");
-                               for (int i = 2;i < 2000;i++)
-                               {
-                                       ps.setInt(1, 4);                // "column a" = 5
-                                       ps.setInt(2, i);                // "column b" = i
-                                       ps.executeUpdate(); // executeUpdate because insert returns no data
-                                       //        c.commit();
-                                       if ((i % 50) == 0)
-                                               DriverManager.println("Thread 1 done " + i + " inserts");
-                               }
-                               ps.close();                     // Always close when we are done with it
-
-                               // Finally perform a query on the table
-                               DriverManager.println("Thread 1 performing a query");
-                               ResultSet rs = st.executeQuery("select a, b from basic1");
-                               int cnt = 0;
-                               if (rs != null)
-                               {
-                                       // Now we run through the result set, printing out the result.
-                                       // Note, we must call .next() before attempting to read any results
-                                       while (rs.next())
-                                       {
-                                               int a = rs.getInt("a"); // This shows how to get the value by name
-                                               int b = rs.getInt(2);   // This shows how to get the value by column
-                                               //System.out.println("  a="+a+" b="+b);
-                                               cnt++;
-                                       }
-                                       rs.close(); // again, you must close the result when done
-                               }
-                               DriverManager.println("Thread 1 read " + cnt + " rows");
-
-                               // The last thing to do is to drop the table. This is done in the
-                               // cleanup() method.
-                               System.out.println("Thread 1 finished");
-                       }
-                       catch (SQLException se)
-                       {
-                               System.err.println("Thread 1: " + se.toString());
-                               se.printStackTrace();
-                               System.exit(1);
-                       }
-               }
-       }
-
-       // This is the second thread. It's the similar to the basic test, and thread1
-       // except it works on another table.
-       class thread2 extends Thread
-       {
-               Connection c;
-               Statement st;
-
-               public thread2(Connection c) throws SQLException
-               {
-                       this.c = c;
-                       st = c.createStatement();
-               }
-
-               public void run()
-               {
-                       try
-                       {
-                               System.out.println("Thread 2 running...");
-
-                               // First we need a table to store data in
-                               st.executeUpdate("create table basic2 (a int2, b int2)");
-
-                               // For large inserts, a PreparedStatement is more efficient, because it
-                               // supports the idea of precompiling the SQL statement, and to store
-                               // directly, a Java object into any column. PostgreSQL doesnt support
-                               // precompiling, but does support setting a column to the value of a
-                               // Java object (like Date, String, etc).
-                               //
-                               // Also, this is the only way of writing dates in a datestyle independent
-                               // manner. (DateStyles are PostgreSQL's way of handling different methods
-                               // of representing dates in the Date data type.)
-                               PreparedStatement ps = db.prepareStatement("insert into basic2 values (?,?)");
-                               for (int i = 2;i < 2000;i++)
-                               {
-                                       ps.setInt(1, 4);                // "column a" = 5
-                                       ps.setInt(2, i);                // "column b" = i
-                                       ps.executeUpdate(); // executeUpdate because insert returns no data
-                                       //        c.commit();
-                                       if ((i % 50) == 0)
-                                               DriverManager.println("Thread 2 done " + i + " inserts");
-                               }
-                               ps.close();                     // Always close when we are done with it
-
-                               // Finally perform a query on the table
-                               DriverManager.println("Thread 2 performing a query");
-                               ResultSet rs = st.executeQuery("select * from basic2 where b>1");
-                               int cnt = 0;
-                               if (rs != null)
-                               {
-                                       // First find out the column numbers.
-                                       //
-                                       // It's best to do this here, as calling the methods with the column
-                                       // numbers actually performs this call each time they are called. This
-                                       // really speeds things up on large queries.
-                                       //
-                                       int col_a = rs.findColumn("a");
-                                       int col_b = rs.findColumn("b");
-
-                                       // Now we run through the result set, printing out the result.
-                                       // Again, we must call .next() before attempting to read any results
-                                       while (rs.next())
-                                       {
-                                               int a = rs.getInt(col_a); // This shows how to get the value by name
-                                               int b = rs.getInt(col_b); // This shows how to get the value by column
-                                               //System.out.println("  a="+a+" b="+b);
-                                               cnt++;
-                                       }
-                                       rs.close(); // again, you must close the result when done
-                               }
-                               DriverManager.println("Thread 2 read " + cnt + " rows");
-
-                               // The last thing to do is to drop the table. This is done in the
-                               // cleanup() method.
-                               System.out.println("Thread 2 finished");
-                       }
-                       catch (SQLException se)
-                       {
-                               System.err.println("Thread 2: " + se.toString());
-                               se.printStackTrace();
-                               System.exit(1);
-                       }
-               }
-       }
-
-       // This is the third thread. It loads, then reads from a LargeObject, using
-       // our LargeObject api.
-       //
-       // The purpose of this is to test that FastPath will work in between normal
-       // JDBC queries.
-       class thread3 extends Thread
-       {
-               Connection c;
-               Statement st;
-               LargeObjectManager lom;
-               LargeObject lo;
-               int oid;
-
-               public thread3(Connection c) throws SQLException
-               {
-                       this.c = c;
-                       //st = c.createStatement();
-
-                       // create a blob
-                       lom = ((org.postgresql.PGConnection)c).getLargeObjectAPI();
-                       oid = lom.create();
-                       System.out.println("Thread 3 has created a blob of oid " + oid);
-               }
-
-               public void run()
-               {
-                       try
-                       {
-                               System.out.println("Thread 3 running...");
-
-                               DriverManager.println("Thread 3: Loading data into blob " + oid);
-                               lo = lom.open(oid);
-                               FileInputStream fis = new FileInputStream("example/threadsafe.java");
-                               // keep the buffer size small, to allow the other thread a chance
-                               byte buf[] = new byte[128];
-                               int rc, bc = 1, bs = 0;
-                               while ((rc = fis.read(buf)) > 0)
-                               {
-                                       DriverManager.println("Thread 3 read block " + bc + " " + bs + " bytes");
-                                       lo.write(buf, 0, rc);
-                                       bc++;
-                                       bs += rc;
-                               }
-                               lo.close();
-                               fis.close();
-
-                               DriverManager.println("Thread 3: Reading blob " + oid);
-                               lo = lom.open(oid);
-                               bc = 0;
-                               while (buf.length > 0)
-                               {
-                                       buf = lo.read(buf.length);
-                                       if (buf.length > 0)
-                                       {
-                                               String s = new String(buf);
-                                               bc++;
-                                               DriverManager.println("Thread 3 block " + bc);
-                                               DriverManager.println("Block " + bc + " got " + s);
-                                       }
-                               }
-                               lo.close();
-
-                               System.out.println("Thread 3 finished");
-                       }
-                       catch (Exception se)
-                       {
-                               System.err.println("Thread 3: " + se.toString());
-                               se.printStackTrace();
-                               System.exit(1);
-                       }
-               }
-
-               public void cleanup() throws SQLException
-               {
-                       if (lom != null && oid != 0)
-                       {
-                               System.out.println("Thread 3: Removing blob oid=" + oid);
-                               lom.delete(oid);
-                       }
-               }
-       }
-
-       /*
-        * Display some instructions on how to run the example
-        */
-       public static void instructions()
-       {
-               System.out.println("\nThis tests the thread safety of the driver.\n\nThis is done in two parts, the first with standard JDBC calls, and the\nsecond mixing FastPath and LargeObject calls with queries.\n");
-               System.out.println("Useage:\n java example.threadsafe jdbc:postgresql:database user password [debug]\n\nThe debug field can be anything. It's presence will enable DriverManager's\ndebug trace. Unless you want to see screens of items, don't put anything in\nhere.");
-               System.exit(1);
-       }
-
-       /*
-        * This little lot starts the test
-        */
-       public static void main(String args[])
-       {
-               System.out.println("PostgreSQL Thread Safety test v6.4 rev 1\n");
-
-               if (args.length < 3)
-                       instructions();
-
-               // This line outputs debug information to stderr. To enable this, simply
-               // add an extra parameter to the command line
-               if (args.length > 3)
-                       DriverManager.setLogStream(System.err);
-
-               // Now run the tests
-               try
-               {
-                       threadsafe test = new threadsafe(args);
-               }
-               catch (Exception ex)
-               {
-                       System.err.println("Exception caught.\n" + ex);
-                       ex.printStackTrace();
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/Driver.java.in b/src/interfaces/jdbc/org/postgresql/Driver.java.in
deleted file mode 100644 (file)
index 2e95bb7..0000000
+++ /dev/null
@@ -1,503 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * Driver.java(.in)
- *       The Postgresql JDBC Driver implementation
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/Driver.java.in,v 1.40 2003/12/11 18:10:40 davec Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql;
-
-import java.io.*;
-import java.sql.*;
-import java.util.*;
-
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-/*
- * The Java SQL framework allows for multiple database drivers.  Each
- * driver should supply a class that implements the Driver interface
- *
- * <p>The DriverManager will try to load as many drivers as it can find and
- * then for any given connection request, it will ask each driver in turn
- * to try to connect to the target URL.
- *
- * <p>It is strongly recommended that each Driver class should be small and
- * standalone so that the Driver class can be loaded and queried without
- * bringing in vast quantities of supporting code.
- *
- * <p>When a Driver class is loaded, it should create an instance of itself
- * 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.PGConnection
- * @see java.sql.Driver
- */
-public class Driver implements java.sql.Driver
-{
-
-       // make these public so they can be used in setLogLevel below
-
-       public static final int DEBUG = 2;
-       public static final int INFO = 1;
-       public static boolean logDebug = false;
-       public static boolean logInfo = false;
-
-       static
-       {
-               try
-               {
-                       // moved the registerDriver from the constructor to here
-                       // because some clients call the driver themselves (I know, as
-                       // my early jdbc work did - and that was based on other examples).
-                       // Placing it here, means that the driver is registered once only.
-                       java.sql.DriverManager.registerDriver(new Driver());
-               }
-               catch (SQLException e)
-               {
-                       e.printStackTrace();
-               }
-       }
-
-       /*
-        * Try to make a database connection to the given URL.  The driver
-        * should return "null" if it realizes it is the wrong kind of
-        * driver to connect to the given URL.  This will be common, as
-        * when the JDBC driverManager is asked to connect to a given URL,
-        * it passes the URL to each loaded driver in turn.
-        *
-        * <p>The driver should raise an SQLException if it is the right driver
-        * to connect to the given URL, but has trouble connecting to the
-        * database.
-        *
-        * <p>The java.util.Properties argument can be used to pass arbitrary
-        * string tag/value pairs as connection arguments.
-        *
-        * user - (optional) The user to connect as
-        * password - (optional) The password for the user
-        * ssl - (optional) Use SSL when connecting to the server
-        * charSet - (optional) The character set to be used for converting
-        *       to/from the database to unicode.  If multibyte is enabled on the
-        *       server then the character set of the database is used as the default,
-        *       otherwise the jvm character encoding is used as the default.
-        *   This value is only used when connecting to a 7.2 or older server.
-        * loglevel - (optional) Enable logging of messages from the driver.
-        *              The value is an integer from 1 to 2 where:
-        *                INFO = 1, DEBUG = 2
-        *              The output is sent to DriverManager.getPrintWriter() if set,
-        *              otherwise it is sent to System.out.
-        * compatible - (optional) This is used to toggle
-        *       between different functionality as it changes across different releases
-        *       of the jdbc driver code.  The values here are versions of the jdbc
-        *       client and not server versions.  For example in 7.1 get/setBytes
-        *       worked on LargeObject values, in 7.2 these methods were changed
-        *       to work on bytea values.  This change in functionality could
-        *       be disabled by setting the compatible level to be "7.1", in
-        *       which case the driver will revert to the 7.1 functionality.
-        *
-        * <p>Normally, at least
-        * "user" and "password" properties should be included in the
-        * properties.  For a list of supported
-        * character encoding , see
-        * http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html
-        * Note that you will probably want to have set up the Postgres database
-        * itself to use the same encoding, with the "-E <encoding>" argument
-        * to createdb.
-        *
-        * Our protocol takes the forms:
-        * <PRE>
-        *      jdbc:postgresql://host:port/database?param1=val1&...
-        * </PRE>
-        *
-        * @param url the URL of the database to connect to
-        * @param info a list of arbitrary tag/value pairs as connection
-        *      arguments
-        * @return a connection to the URL or null if it isnt us
-        * @exception SQLException if a database access error occurs
-        * @see java.sql.Driver#connect
-        */
-       public java.sql.Connection connect(String url, Properties info) throws SQLException
-       {
-               Properties props;
-               if ((props = parseURL(url, info)) == null)
-               {
-                       if (Driver.logDebug)
-                               Driver.debug("Error in url" + url);
-                       return null;
-               }
-               try
-               {
-                       if (Driver.logDebug)
-                               Driver.debug("connect " + url);
-
-                       @JDBCCONNECTCLASS@ con = (@JDBCCONNECTCLASS@)(Class.forName("@JDBCCONNECTCLASS@").newInstance());
-                       con.openConnection (host(props), port(props), props, database(props), url, this);
-                       return (java.sql.Connection)con;
-               }
-               catch (ClassNotFoundException ex)
-               {
-                       if (Driver.logDebug)
-                               Driver.debug("error", ex);
-                       throw new PSQLException("postgresql.jvm.version", PSQLState.SYSTEM_ERROR, ex);
-               }
-               catch (PSQLException ex1)
-               {
-                       // re-throw the exception, otherwise it will be caught next, and a
-                       // org.postgresql.unusual error will be returned instead.
-                       throw ex1;
-               }
-               catch (Exception ex2)
-               {
-                       if (Driver.logDebug) {
-                               Driver.debug("error", ex2);
-                       }
-                       throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, ex2);
-               }
-       }
-
-       /*
-        * Returns true if the driver thinks it can open a connection to the
-        * given URL.  Typically, drivers will return true if they understand
-        * the subprotocol specified in the URL and false if they don't.  Our
-        * protocols start with jdbc:postgresql:
-        *
-        * @see java.sql.Driver#acceptsURL
-        * @param url the URL of the driver
-        * @return true if this driver accepts the given URL
-        * @exception SQLException if a database-access error occurs
-        *      (Dont know why it would *shrug*)
-        */
-       public boolean acceptsURL(String url) throws SQLException
-       {
-               if (parseURL(url, null) == null)
-                       return false;
-               return true;
-       }
-
-       /*
-        * The getPropertyInfo method is intended to allow a generic GUI
-        * tool to discover what properties it should prompt a human for
-        * in order to get enough information to connect to a database.
-        *
-        * <p>Note that depending on the values the human has supplied so
-        * far, additional values may become necessary, so it may be necessary
-        * to iterate through several calls to getPropertyInfo
-        *
-        * @param url the Url of the database to connect to
-        * @param info a proposed list of tag/value pairs that will be sent on
-        *      connect open.
-        * @return An array of DriverPropertyInfo objects describing
-        *      possible properties.  This array may be an empty array if
-        *      no properties are required
-        * @exception SQLException if a database-access error occurs
-        * @see java.sql.Driver#getPropertyInfo
-        */
-       public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
-       {
-               //This method isn't really implemented
-               //we just parse the URL to ensure it is valid
-               parseURL(url, info);
-               return new DriverPropertyInfo[0];
-       }
-
-       /*
-        * Gets the drivers major version number
-        *
-        * @return the drivers major version number
-        */
-       public int getMajorVersion()
-       {
-               return @MAJORVERSION@;
-       }
-
-       /*
-        * Get the drivers minor version number
-        *
-        * @return the drivers minor version number
-        */
-       public int getMinorVersion()
-       {
-               return @MINORVERSION@;
-       }
-
-       /*
-        * Returns the VERSION variable from Makefile.global
-        */
-       public static String getVersion()
-       {
-               return "@VERSION@ (build " + m_buildNumber + ")";
-       }
-
-       /*
-        * Report whether the driver is a genuine JDBC compliant driver.  A
-        * driver may only report "true" here if it passes the JDBC compliance
-        * tests, otherwise it is required to return false.  JDBC compliance
-        * requires full support for the JDBC API and full support for SQL 92
-        * Entry Level.
-        *
-        * <p>For PostgreSQL, this is not yet possible, as we are not SQL92
-        * compliant (yet).
-        */
-       public boolean jdbcCompliant()
-       {
-               return false;
-       }
-
-       static private String[] protocols = { "jdbc", "postgresql" };
-
-       /*
-        * Constructs a new DriverURL, splitting the specified URL into its
-        * component parts
-        * @param url JDBC URL to parse
-        * @param defaults Default properties
-        * @return Properties with elements added from the url
-        * @exception SQLException
-        */
-       Properties parseURL(String url, Properties defaults) throws SQLException
-       {
-               int state = -1;
-               Properties urlProps = new Properties(defaults);
-
-               String l_urlServer = url;
-               String l_urlArgs = "";
-
-               int l_qPos = url.indexOf('?');
-               if (l_qPos != -1) {
-                       l_urlServer = url.substring(0,l_qPos);
-                       l_urlArgs = url.substring(l_qPos+1);
-               }
-
-               // look for an IPv6 address that is enclosed by []
-               // the upcoming parsing that uses colons as identifiers can't handle
-               // the colons in an IPv6 address.
-               int ipv6start = l_urlServer.indexOf("[");
-               int ipv6end = l_urlServer.indexOf("]");
-               String ipv6address = null;
-               if (ipv6start != -1 && ipv6end > ipv6start) {
-                       ipv6address = l_urlServer.substring(ipv6start+1,ipv6end);
-                       l_urlServer = l_urlServer.substring(0,ipv6start)+"ipv6host"+l_urlServer.substring(ipv6end+1);
-               }
-
-               //parse the server part of the url
-               StringTokenizer st = new StringTokenizer(l_urlServer, ":/", true);
-               int count;
-               for (count = 0; (st.hasMoreTokens()); count++)
-               {
-                       String token = st.nextToken();
-
-                       // PM Aug 2 1997 - Modified to allow multiple backends
-                       if (count <= 3)
-                       {
-                               if ((count % 2) == 1 && token.equals(":"))
-                                       ;
-                               else if ((count % 2) == 0)
-                               {
-                                       boolean found = (count == 0) ? true : false;
-                                       for (int tmp = 0;tmp < protocols.length;tmp++)
-                                       {
-                                               if (token.equals(protocols[tmp]))
-                                               {
-                                                       // PM June 29 1997 Added this property to enable the driver
-                                                       // to handle multiple backend protocols.
-                                                       if (count == 2 && tmp > 0)
-                                                       {
-                                                               urlProps.put("Protocol", token);
-                                                               found = true;
-                                                       }
-                                               }
-                                       }
-
-                                       if (found == false)
-                                               return null;
-                               }
-                               else
-                                       return null;
-                       }
-                       else if (count > 3)
-                       {
-                               if (count == 4 && token.equals("/"))
-                                       state = 0;
-                               else if (count == 4)
-                               {
-                                       urlProps.put("PGDBNAME", token);
-                                       state = -2;
-                               }
-                               else if (count == 5 && state == 0 && token.equals("/"))
-                                       state = 1;
-                               else if (count == 5 && state == 0)
-                                       return null;
-                               else if (count == 6 && state == 1)
-                                       urlProps.put("PGHOST", token);
-                               else if (count == 7 && token.equals(":"))
-                                       state = 2;
-                               else if (count == 8 && state == 2)
-                               {
-                                       try
-                                       {
-                                               Integer portNumber = Integer.decode(token);
-                                               urlProps.put("PGPORT", portNumber.toString());
-                                       }
-                                       catch (Exception e)
-                                       {
-                                               return null;
-                                       }
-                               }
-                               else if ((count == 7 || count == 9) &&
-                                                (state == 1 || state == 2) && token.equals("/"))
-                                       state = -1;
-                               else if (state == -1)
-                               {
-                                       urlProps.put("PGDBNAME", token);
-                                       state = -2;
-                               }
-                       }
-               }
-               if (count <= 1) {
-                       return null;
-               }
-
-               // if we extracted an IPv6 address out earlier put it back
-               if (ipv6address != null)
-                       urlProps.put("PGHOST",ipv6address);
-
-               //parse the args part of the url
-               StringTokenizer qst = new StringTokenizer(l_urlArgs, "&");
-               for (count = 0; (qst.hasMoreTokens()); count++)
-               {
-                       String token = qst.nextToken();
-                       int l_pos = token.indexOf('=');
-                       if (l_pos == -1) {
-                               urlProps.put(token, "");
-                       } else {
-                               urlProps.put(token.substring(0,l_pos), token.substring(l_pos+1));
-                       }
-               }
-
-               return urlProps;
-
-       }
-
-       /*
-        * @return the hostname portion of the URL
-        */
-       public String host(Properties props)
-       {
-               return props.getProperty("PGHOST", "localhost");
-       }
-
-       /*
-        * @return the port number portion of the URL or the default if no port was specified
-        */
-       public int port(Properties props)
-       {
-               return Integer.parseInt(props.getProperty("PGPORT", "@DEF_PGPORT@"));
-       }
-
-       /*
-        * @return the database name of the URL
-        */
-       public String database(Properties props)
-       {
-               return props.getProperty("PGDBNAME", "");
-       }
-
-       /*
-        * This method was added in v6.5, and simply throws an SQLException
-        * for an unimplemented method. I decided to do it this way while
-        * implementing the JDBC2 extensions to JDBC, as it should help keep the
-        * overall driver size down.
-        */
-       public static SQLException notImplemented()
-       {
-               return new PSQLException("postgresql.unimplemented", PSQLState.NOT_IMPLEMENTED);
-       }
-
-       /**
-       *       used to turn logging on to a certain level, can be called
-       *       by specifying fully qualified class ie org.postgresql.Driver.setLogLevel()
-       *       @param logLevel sets the level which logging will respond to
-       *       INFO being almost no messages
-       *       DEBUG most verbose
-       */
-       public static void setLogLevel(int logLevel)
-       {
-               logDebug = (logLevel >= DEBUG) ? true : false;
-               logInfo = (logLevel >= INFO) ? true : false;
-       }
-       /*
-        * logging message at the debug level
-        * messages will be printed if the logging level is less or equal to DEBUG
-        */
-       public static void debug(String msg)
-       {
-               if (logDebug)
-               {
-                       DriverManager.println(msg);
-               }
-       }
-       /*
-        * logging message at the debug level
-        * messages will be printed if the logging level is less or equal to DEBUG
-        */
-       public static void debug(String msg, Exception ex)
-       {
-               if (logDebug)
-               {
-                       DriverManager.println(msg);
-                       if(ex != null) {
-                               DriverManager.println(ex.toString());
-                       }
-               }
-       }
-       /*
-        * logging message at info level
-        * messages will be printed if the logging level is less or equal to INFO
-        */
-       public static void info(String msg)
-       {
-               if (logInfo)
-               {
-                       DriverManager.println(msg);
-               }
-       }
-       /*
-        * logging message at info level
-        * messages will be printed if the logging level is less or equal to INFO
-        */
-       public static void info(String msg, Exception ex)
-       {
-               if (logInfo)
-               {
-                       DriverManager.println(msg);
-                       if(ex != null) {
-                               DriverManager.println(ex.toString());
-                       }
-               }
-       }
-
-
-       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();
-@SSL@          p_stream.connection = (javax.net.ssl.SSLSocket) factory.createSocket(p_stream.connection,p_stream.host,p_stream.port,true);
-@SSL@          p_stream.pg_input = new BufferedInputStream(p_stream.connection.getInputStream(), 8192);
-@SSL@          p_stream.pg_output = new BufferedOutputStream(p_stream.connection.getOutputStream(), 8192);
-       }
-
-       public static boolean sslEnabled() {
-               boolean l_return = false;
-@SSL@          l_return = true;
-               return l_return;
-       }
-
-
-       //The build number should be incremented for every new build
-       private static int m_buildNumber = 300;
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/PGConnection.java b/src/interfaces/jdbc/org/postgresql/PGConnection.java
deleted file mode 100644 (file)
index 7871a9d..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * 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
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/PGConnection.java,v 1.7 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql;
-
-import java.sql.*;
-import org.postgresql.core.Encoding;
-import org.postgresql.fastpath.Fastpath;
-import org.postgresql.largeobject.LargeObjectManager;
-
-public interface PGConnection
-{
-       /**
-        * 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 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 allows client code to add a handler for one of org.postgresql's
-         * more unique data types.
-         *
-         * <p><b>NOTE:</b> This is not part of JDBC, but an extension.
-         *
-         * <p>The best way to use this is as follows:
-         *
-         * <p><pre>
-         * ...
-         * ((org.postgresql.PGConnection)myconn).addDataType("mytype","my.class.name");
-         * ...
-         * </pre>
-         *
-         * <p>where myconn is an open Connection to org.postgresql.
-         *
-         * <p>The handling class must extend org.postgresql.util.PGobject
-         *
-         * @see org.postgresql.util.PGobject
-         */
-        public void addDataType(String type, String name);
-
-
-       /** @deprecated */
-       public Encoding getEncoding() throws SQLException;
-
-       /** @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;
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/PGNotification.java b/src/interfaces/jdbc/org/postgresql/PGNotification.java
deleted file mode 100644 (file)
index b6d9f32..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGNotification.java
- *    This interface defines public PostgreSQL extention for Notifications
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/PGNotification.java,v 1.4 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql;
-
-
-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();
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/PGRefCursorResultSet.java b/src/interfaces/jdbc/org/postgresql/PGRefCursorResultSet.java
deleted file mode 100644 (file)
index 411b227..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGRefCursorResultSet.java
- *       Describes a PLPGSQL refcursor type.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/PGRefCursorResultSet.java,v 1.2 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql;
-
-
-/** A ref cursor based result set.
- */
-public interface PGRefCursorResultSet
-{
-
-        /** return the name of the cursor.
-         */
-       public String getRefCursor ();
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/PGStatement.java b/src/interfaces/jdbc/org/postgresql/PGStatement.java
deleted file mode 100644 (file)
index 5bfad1b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * 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
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/PGStatement.java,v 1.8 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql;
-
-
-import java.sql.*;
-
-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();
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/core/BaseConnection.java b/src/interfaces/jdbc/org/postgresql/core/BaseConnection.java
deleted file mode 100644 (file)
index 49320ae..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * BaseConnection.java
- *       The internal interface definition for a jdbc connection
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/core/BaseConnection.java,v 1.5 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.core;
-
-import java.sql.DatabaseMetaData;
-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 boolean getAutoCommit();
-       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 int getPGProtocolVersionMajor();
-       public int getPGProtocolVersionMinor();
-       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 setAutoCommit(boolean autoCommit) throws SQLException;
-       public void setCursorName(String cursor) throws SQLException;
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/core/BaseResultSet.java b/src/interfaces/jdbc/org/postgresql/core/BaseResultSet.java
deleted file mode 100644 (file)
index 536197c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * BaseResultSet.java
- *       The internal interface definition for a jdbc result set
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/core/BaseResultSet.java,v 1.3 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.core;
-
-
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.text.SimpleDateFormat;
-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 SimpleDateFormat getDateFormat();
-       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 SimpleDateFormat getTimestampFormat();
-       public SimpleDateFormat getTimestampTZFormat();
-       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);
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/core/BaseStatement.java b/src/interfaces/jdbc/org/postgresql/core/BaseStatement.java
deleted file mode 100644 (file)
index 50113ea..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * BaseStatement.java
- *       The internal interface definition for a jdbc statement
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/core/BaseStatement.java,v 1.7 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.core;
-
-import org.postgresql.PGRefCursorResultSet;
-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 PGRefCursorResultSet createRefCursorResultSet(String cursorName) 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 void addWarning(String p_warning) throws SQLException;
-       public void close() throws SQLException;
-       public int getFetchSize();
-       public int getMaxFieldSize() throws SQLException;
-       public int getMaxRows() throws SQLException;
-       public int getResultSetConcurrency() throws SQLException;
-       public String getFetchingCursorName();
-       public SQLWarning getWarnings() throws SQLException;
-       public void setMaxFieldSize(int max) throws SQLException;
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/core/Encoding.java b/src/interfaces/jdbc/org/postgresql/core/Encoding.java
deleted file mode 100644 (file)
index b3312be..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * Encoding.java
- *     Converts to and from the character encoding used by the backend.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/core/Encoding.java,v 1.13 2003/11/29 19:52:09 pgsql 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;
-import org.postgresql.util.PSQLState;
-
-public class Encoding
-{
-
-       private static final Encoding DEFAULT_ENCODING = new Encoding(null);
-
-       /*
-        * Preferred JVM encodings for backend encodings.
-        */
-       private static final Hashtable encodings = new Hashtable();
-
-       static {
-               //Note: this list should match the set of supported server
-               // encodings found in backend/util/mb/encnames.c
-               encodings.put("SQL_ASCII", new String[] { "ASCII", "us-ascii" });
-               encodings.put("UNICODE", new String[] { "UTF-8", "UTF8" });
-               encodings.put("LATIN1", new String[] { "ISO8859_1" });
-               encodings.put("LATIN2", new String[] { "ISO8859_2" });
-               encodings.put("LATIN3", new String[] { "ISO8859_3" });
-               encodings.put("LATIN4", new String[] { "ISO8859_4" });
-               encodings.put("ISO_8859_5", new String[] { "ISO8859_5" });
-               encodings.put("ISO_8859_6", new String[] { "ISO8859_6" });
-               encodings.put("ISO_8859_7", new String[] { "ISO8859_7" });
-               encodings.put("ISO_8859_8", new String[] { "ISO8859_8" });
-               encodings.put("LATIN5", new String[] { "ISO8859_9" });
-               encodings.put("LATIN7", new String[] { "ISO8859_13" });
-               encodings.put("LATIN9", new String[] { "ISO8859_15_FDIS" });
-               encodings.put("EUC_JP", new String[] { "EUC_JP" });
-               encodings.put("EUC_CN", new String[] { "EUC_CN" });
-               encodings.put("EUC_KR", new String[] { "EUC_KR" });
-               encodings.put("JOHAB", new String[] { "Johab" });
-               encodings.put("EUC_TW", new String[] { "EUC_TW" });
-               encodings.put("SJIS", new String[] { "MS932", "SJIS" });
-               encodings.put("BIG5", new String[] { "Big5", "MS950", "Cp950" });
-               encodings.put("GBK", new String[] { "GBK", "MS936" });
-               encodings.put("UHC", new String[] { "MS949", "Cp949", "Cp949C" });
-               encodings.put("TCVN", new String[] { "Cp1258" });
-               encodings.put("WIN1256", new String[] { "Cp1256" });
-               encodings.put("WIN1250", new String[] { "Cp1250" });
-               encodings.put("WIN874", new String[] { "MS874", "Cp874" });
-               encodings.put("WIN", new String[] { "Cp1251" });
-               encodings.put("ALT", new String[] { "Cp866" });
-               // We prefer KOI8-U, since it is a superset of KOI8-R.
-               encodings.put("KOI8", new String[] { "KOI8_U", "KOI8_R" });
-               // If the database isn't encoding-aware then we can't have
-               // any preferred encodings.
-               encodings.put("UNKNOWN", new String[0]);
-               // The following encodings do not have a java equivalent
-               encodings.put("MULE_INTERNAL", new String[0]);
-               encodings.put("LATIN6", new String[0]);
-               encodings.put("LATIN8", new String[0]);
-               encodings.put("LATIN10", new String[0]);
-       }
-
-       private final String encoding;
-
-       private Encoding(String encoding)
-       {
-               this.encoding = encoding;
-       }
-
-       /*
-        * Get an Encoding for from the given database encoding and
-        * the encoding passed in by the user.
-        */
-       public static Encoding getEncoding(String databaseEncoding,
-                                                                          String passedEncoding)
-       {
-               if (passedEncoding != null)
-               {
-                       if (isAvailable(passedEncoding))
-                       {
-                               return new Encoding(passedEncoding);
-                       }
-                       else
-                       {
-                               return defaultEncoding();
-                       }
-               }
-               else
-               {
-                       return encodingForDatabaseEncoding(databaseEncoding);
-               }
-       }
-
-       /*
-        * Get an Encoding matching the given database encoding.
-        */
-       private static Encoding encodingForDatabaseEncoding(String databaseEncoding)
-       {
-               // If the backend encoding is known and there is a suitable
-               // encoding in the JVM we use that. Otherwise we fall back
-               // to the default encoding of the JVM.
-
-               if (encodings.containsKey(databaseEncoding))
-               {
-                       String[] candidates = (String[]) encodings.get(databaseEncoding);
-                       for (int i = 0; i < candidates.length; i++)
-                       {
-                               if (isAvailable(candidates[i]))
-                               {
-                                       return new Encoding(candidates[i]);
-                               }
-                       }
-               }
-               return defaultEncoding();
-       }
-
-       /*
-        * Name of the (JVM) encoding used.
-        */
-       public String name()
-       {
-               return encoding;
-       }
-
-       /*
-        * Encode a string to an array of bytes.
-        */
-       public byte[] encode(String s) throws SQLException
-       {
-               byte[] l_return;
-               try
-               {
-                       if (encoding == null)
-                       {
-                               l_return = s.getBytes();
-                       }
-                       else
-                       {
-                               l_return = s.getBytes(encoding);
-                       }
-                       //Don't return null, return an empty byte[] instead
-                       if (l_return == null) {
-                               return new byte[0];
-                       } else {
-                               return l_return;
-                       }
-               }
-               catch (UnsupportedEncodingException e)
-               {
-                       throw new PSQLException("postgresql.stream.encoding", PSQLState.DATA_ERROR, e);
-               }
-       }
-
-       /*
-        * Decode an array of bytes into a string.
-        */
-       public String decode(byte[] encodedString, int offset, int length) throws SQLException
-       {
-               try
-               {
-                       if (encoding == null)
-                       {
-                               return new String(encodedString, offset, length);
-                       }
-                       else
-                       {
-                               if (encoding.equals("UTF-8")) {
-                                       return decodeUTF8(encodedString, offset, length);
-                               }
-                               return new String(encodedString, offset, length, encoding);
-                       }
-               }
-               catch (UnsupportedEncodingException e)
-               {
-                       throw new PSQLException("postgresql.stream.encoding", PSQLState.DATA_ERROR, e);
-               }
-       }
-
-       /*
-        * Decode an array of bytes into a string.
-        */
-       public String decode(byte[] encodedString) throws SQLException
-       {
-               return decode(encodedString, 0, encodedString.length);
-       }
-
-       /*
-        * Get a Reader that decodes the given InputStream.
-        */
-       public Reader getDecodingReader(InputStream in) throws SQLException
-       {
-               try
-               {
-                       if (encoding == null)
-                       {
-                               return new InputStreamReader(in);
-                       }
-                       else
-                       {
-                               return new InputStreamReader(in, encoding);
-                       }
-               }
-               catch (UnsupportedEncodingException e)
-               {
-                       throw new PSQLException("postgresql.res.encoding", PSQLState.DATA_ERROR, e);
-               }
-       }
-
-       /*
-        * Get an Encoding using the default encoding for the JVM.
-        */
-       public static Encoding defaultEncoding()
-       {
-               return DEFAULT_ENCODING;
-       }
-
-       /*
-        * Test if an encoding is available in the JVM.
-        */
-       private static boolean isAvailable(String encodingName)
-       {
-               try
-               {
-                       "DUMMY".getBytes(encodingName);
-                       return true;
-               }
-               catch (UnsupportedEncodingException e)
-               {
-                       return false;
-               }
-       }
-
-       /**
-        * custom byte[] -> String conversion routine, 3x-10x faster than
-        * standard new String(byte[])
-        */
-       private static final int pow2_6 = 64;           // 26
-       private static final int pow2_12 = 4096;        // 212
-       private char[] cdata = new char[50];
-
-       private synchronized String decodeUTF8(byte data[], int offset, int length) throws SQLException {
-               try {
-                       char[] l_cdata = cdata;
-                       if (l_cdata.length < (length)) {
-                               l_cdata = new char[length];
-                       }
-                       int i = offset;
-                       int j = 0;
-                       int k = length + offset;
-                       int z, y, x, val;
-                       while (i < k) {
-                               z = data[i] & 0xFF;
-                               if (z < 0x80) {
-                                       l_cdata[j++] = (char)data[i];
-                                       i++;
-                               } else if (z >= 0xE0) {         // length == 3
-                                       y = data[i+1] & 0xFF;
-                                       x = data[i+2] & 0xFF;
-                                       val = (z-0xE0)*pow2_12 + (y-0x80)*pow2_6 + (x-0x80);
-                                       l_cdata[j++] = (char) val;
-                                       i+= 3;
-                               } else {                // length == 2 (maybe add checking for length > 3, throw exception if it is
-                                       y = data[i+1] & 0xFF;
-                                       val = (z - 0xC0)* (pow2_6)+(y-0x80);
-                                       l_cdata[j++] = (char) val;
-                                       i+=2;
-                               } 
-                       }
-       
-                       String s = new String(l_cdata, 0, j);
-                       return s;
-               } catch (Exception l_e) {
-                       throw new PSQLException("postgresql.con.invalidchar", l_e);
-               }
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/core/Field.java b/src/interfaces/jdbc/org/postgresql/core/Field.java
deleted file mode 100644 (file)
index 08d143f..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * Field.java
- *     Field is a class used to describe fields in a PostgreSQL ResultSet
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/core/Field.java,v 1.3 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.core;
-
-import java.sql.*;
-import org.postgresql.core.BaseConnection;
-
-/*
- */
-public class Field
-{
-       private int length;             // Internal Length of this field
-       private int oid;                // OID of the type
-       private int mod;                // type modifier of this field
-       private String name;            // Name of this field
-
-       private BaseConnection conn;    // Connection Instantation
-
-
-       /*
-        * Construct a field based on the information fed to it.
-        *
-        * @param conn the connection this field came from
-        * @param name the name of the field
-        * @param oid the OID of the field
-        * @param len the length of the field
-        */
-       public Field(BaseConnection conn, String name, int oid, int length, int mod)
-       {
-               this.conn = conn;
-               this.name = name;
-               this.oid = oid;
-               this.length = length;
-               this.mod = mod;
-       }
-
-       /*
-        * Constructor without mod parameter.
-        *
-        * @param conn the connection this field came from
-        * @param name the name of the field
-        * @param oid the OID of the field
-        * @param len the length of the field
-        */
-       public Field(BaseConnection conn, String name, int oid, int length)
-       {
-               this(conn, name, oid, length, 0);
-       }
-
-       /*
-        * @return the oid of this Field's data type
-        */
-       public int getOID()
-       {
-               return oid;
-       }
-
-       /*
-        * @return the mod of this Field's data type
-        */
-       public int getMod()
-       {
-               return mod;
-       }
-
-       /*
-        * @return the name of this Field's data type
-        */
-       public String getName()
-       {
-               return name;
-       }
-
-       /*
-        * @return the length of this Field's data type
-        */
-       public int getLength()
-       {
-               return length;
-       }
-
-       /*
-        * We also need to get the PG type name as returned by the back end.
-        *
-        * @return the String representation of the PG type of this field
-        * @exception SQLException if a database access error occurs
-        */
-       public String getPGType() throws SQLException
-       {
-               return conn.getPGType(oid);
-       }
-
-       /*
-        * We also need to get the java.sql.types type.
-        *
-        * @return the int representation of the java.sql.types type of this field
-        * @exception SQLException if a database access error occurs
-        */
-       public int getSQLType() throws SQLException
-       {
-               return conn.getSQLType(oid);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/core/Notification.java b/src/interfaces/jdbc/org/postgresql/core/Notification.java
deleted file mode 100644 (file)
index dec4142..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * Notification.java
- *     This is the implementation of the PGNotification interface
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/core/Notification.java,v 1.4 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.core;
-
-import org.postgresql.PGNotification;
-
-public class Notification implements PGNotification
-{
-       public Notification(String p_name, int p_pid)
-       {
-               m_name = p_name;
-               m_pid = p_pid;
-       }
-
-       /*
-        * Returns name of this notification
-        */
-       public String getName()
-       {
-               return m_name;
-       }
-
-       /*
-        * Returns the process id of the backend process making this notification
-        */
-       public int getPID()
-       {
-               return m_pid;
-       }
-
-       private String m_name;
-       private int m_pid;
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/core/PGStream.java b/src/interfaces/jdbc/org/postgresql/core/PGStream.java
deleted file mode 100644 (file)
index 28d516a..0000000
+++ /dev/null
@@ -1,431 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGStream.java
- *      This class is used by Connection for communicating with the
- *      backend.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/core/PGStream.java,v 1.4 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-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;
-import org.postgresql.util.PSQLState;
-
-
-public class PGStream
-{
-       public String host;
-       public int port;
-       public Socket connection;
-       public InputStream pg_input;
-       public BufferedOutputStream pg_output;
-       private byte[] byte_buf = new byte[8*1024];
-
-       /*
-        * Constructor:  Connect to the PostgreSQL back end and return
-        * a stream connection.
-        *
-        * @param host the hostname to connect to
-        * @param port the port number that the postmaster is sitting on
-        * @exception IOException if an IOException occurs below it.
-        */
-       public PGStream(String p_host, int p_port) throws IOException
-       {
-               host = p_host;
-               port = p_port;
-               connection = new Socket(host, port);
-
-               // Submitted by Jason Venner <jason@idiom.com> adds a 10x speed
-               // improvement on FreeBSD machines (caused by a bug in their TCP Stack)
-               connection.setTcpNoDelay(true);
-
-               // Buffer sizes submitted by Sverre H Huseby <sverrehu@online.no>
-               pg_input = new BufferedInputStream(connection.getInputStream(), 8192);
-               pg_output = new BufferedOutputStream(connection.getOutputStream(), 8192);
-       }
-
-       /*
-        * Sends a single character to the back end
-        *
-        * @param val the character to be sent
-        * @exception IOException if an I/O error occurs
-        */
-       public void SendChar(int val) throws IOException
-       {
-               pg_output.write((byte)val);
-       }
-
-       /*
-        * Sends an integer to the back end
-        *
-        * @param val the integer to be sent
-        * @param siz the length of the integer in bytes (size of structure)
-        * @exception IOException if an I/O error occurs
-        */
-       public void SendInteger(int val, int siz) throws IOException
-       {
-               byte[] buf = new byte[siz];
-
-               while (siz-- > 0)
-               {
-                       buf[siz] = (byte)(val & 0xff);
-                       val >>= 8;
-               }
-               Send(buf);
-       }
-
-       /*
-        * Sends an integer to the back end
-        *
-        * @param val the integer to be sent
-        * @param siz the length of the integer in bytes (size of structure)
-        * @exception IOException if an I/O error occurs
-        */
-       public void SendIntegerR(int val, int siz) throws IOException
-       {
-               byte[] buf = new byte[siz];
-
-               for (int i = 0; i < siz; i++)
-               {
-                       buf[i] = (byte)(val & 0xff);
-                       val >>= 8;
-               }
-               Send(buf);
-       }
-
-       /*
-        * Send an array of bytes to the backend
-        *
-        * @param buf The array of bytes to be sent
-        * @exception IOException if an I/O error occurs
-        */
-       public void Send(byte buf[]) throws IOException
-       {
-               pg_output.write(buf);
-       }
-
-       /*
-        * Send an exact array of bytes to the backend - if the length
-        * has not been reached, send nulls until it has.
-        *
-        * @param buf the array of bytes to be sent
-        * @param siz the number of bytes to be sent
-        * @exception IOException if an I/O error occurs
-        */
-       public void Send(byte buf[], int siz) throws IOException
-       {
-               Send(buf, 0, siz);
-       }
-
-       /*
-        * Send an exact array of bytes to the backend - if the length
-        * has not been reached, send nulls until it has.
-        *
-        * @param buf the array of bytes to be sent
-        * @param off offset in the array to start sending from
-        * @param siz the number of bytes to be sent
-        * @exception IOException if an I/O error occurs
-        */
-       public void Send(byte buf[], int off, int siz) throws IOException
-       {
-               int i;
-
-               pg_output.write(buf, off, ((buf.length - off) < siz ? (buf.length - off) : siz));
-               if ((buf.length - off) < siz)
-               {
-                       for (i = buf.length - off ; i < siz ; ++i)
-                       {
-                               pg_output.write(0);
-                       }
-               }
-       }
-
-       /*
-        * Receives a single character from the backend
-        *
-        * @return the character received
-        * @exception SQLException if an I/O Error returns
-        */
-       public int ReceiveChar() throws SQLException
-       {
-               int c = 0;
-
-               try
-               {
-                       c = pg_input.read();
-                       if (c < 0)
-                               throw new PSQLException("postgresql.stream.eof", PSQLState.COMMUNICATION_ERROR);
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.stream.ioerror", PSQLState.COMMUNICATION_ERROR, e);
-               }
-               return c;
-       }
-
-       /*
-        * Receives an integer from the backend
-        *
-        * @param siz length of the integer in bytes
-        * @return the integer received from the backend
-        * @exception SQLException if an I/O error occurs
-        */
-       public int ReceiveInteger(int siz) throws SQLException
-       {
-               int n = 0;
-
-               try
-               {
-                       for (int i = 0 ; i < siz ; i++)
-                       {
-                               int b = pg_input.read();
-
-                               if (b < 0)
-                                       throw new PSQLException("postgresql.stream.eof", PSQLState.COMMUNICATION_ERROR);
-                               n = n | (b << (8 * i)) ;
-                       }
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.stream.ioerror", PSQLState.COMMUNICATION_ERROR, e);
-               }
-               return n;
-       }
-
-       /*
-        * Receives an integer from the backend
-        *
-        * @param siz length of the integer in bytes
-        * @return the integer received from the backend
-        * @exception SQLException if an I/O error occurs
-        */
-       public int ReceiveIntegerR(int siz) throws SQLException
-       {
-               int n = 0;
-
-               try
-               {
-                       for (int i = 0 ; i < siz ; i++)
-                       {
-                               int b = pg_input.read();
-
-                               if (b < 0)
-                                       throw new PSQLException("postgresql.stream.eof", PSQLState.COMMUNICATION_ERROR);
-                               n = b | (n << 8);
-                       }
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.stream.ioerror", PSQLState.COMMUNICATION_ERROR, e);
-               }
-               return n;
-       }
-
-       /*
-        * Receives a null-terminated string from the backend.  If we don't see a
-        * null, then we assume something has gone wrong.
-        *
-        * @param encoding the charset encoding to use.
-        * @return string from back end
-        * @exception SQLException if an I/O error occurs, or end of file
-        */
-       public String ReceiveString(Encoding encoding)
-       throws SQLException
-       {
-               int s = 0;
-               byte[] rst = byte_buf;
-               try
-               {
-                       int buflen = rst.length;
-                       boolean done = false;
-                       while (!done)
-                       {
-                               while (s < buflen)
-                               {
-                                       int c = pg_input.read();
-                                       if (c < 0)
-                                               throw new PSQLException("postgresql.stream.eof", PSQLState.COMMUNICATION_ERROR);
-                                       else if (c == 0)
-                                       {
-                                               rst[s] = 0;
-                                               done = true;
-                                               break;
-                                       }
-                                       else
-                                       {
-                                               rst[s++] = (byte)c;
-                                       }
-                                       if (s >= buflen)
-                                       { // Grow the buffer
-                                               buflen = (int)(buflen * 2); // 100% bigger
-                                               byte[] newrst = new byte[buflen];
-                                               System.arraycopy(rst, 0, newrst, 0, s);
-                                               rst = newrst;
-                                       }
-                               }
-                       }
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.stream.ioerror", PSQLState.COMMUNICATION_ERROR, e);
-               }
-               return encoding.decode(rst, 0, s);
-       }
-
-       /*
-        * Read a tuple from the back end.      A tuple is a two dimensional
-        * array of bytes
-        *
-        * @param nf the number of fields expected
-        * @param bin true if the tuple is a binary tuple
-        * @return null if the current response has no more tuples, otherwise
-        *      an array of strings
-        * @exception SQLException if a data I/O error occurs
-        */
-       public byte[][] ReceiveTupleV3(int nf, boolean bin) throws SQLException
-       {
-               //TODO: use l_msgSize
-               int l_msgSize = ReceiveIntegerR(4);
-               int i;
-               int l_nf = ReceiveIntegerR(2);
-               byte[][] answer = new byte[l_nf][0];
-               
-               for (i = 0 ; i < l_nf ; ++i)
-               {
-                       int l_size = ReceiveIntegerR(4);
-                       boolean isNull = l_size == -1;
-                       if (isNull)
-                               answer[i] = null;
-                       else
-                       {
-                               answer[i] = Receive(l_size);
-                       }
-               }
-               return answer;
-       }
-
-       /*
-        * Read a tuple from the back end.      A tuple is a two dimensional
-        * array of bytes
-        *
-        * @param nf the number of fields expected
-        * @param bin true if the tuple is a binary tuple
-        * @return null if the current response has no more tuples, otherwise
-        *      an array of strings
-        * @exception SQLException if a data I/O error occurs
-        */
-       public byte[][] ReceiveTupleV2(int nf, boolean bin) throws SQLException
-       {
-               int i, bim = (nf + 7) / 8;
-               byte[] bitmask = Receive(bim);
-               byte[][] answer = new byte[nf][0];
-
-               int whichbit = 0x80;
-               int whichbyte = 0;
-
-               for (i = 0 ; i < nf ; ++i)
-               {
-                       boolean isNull = ((bitmask[whichbyte] & whichbit) == 0);
-                       whichbit >>= 1;
-                       if (whichbit == 0)
-                       {
-                               ++whichbyte;
-                               whichbit = 0x80;
-                       }
-                       if (isNull)
-                               answer[i] = null;
-                       else
-                       {
-                               int len = ReceiveIntegerR(4);
-                               if (!bin)
-                                       len -= 4;
-                               if (len < 0)
-                                       len = 0;
-                               answer[i] = Receive(len);
-                       }
-               }
-               return answer;
-       }
-
-       /*
-        * Reads in a given number of bytes from the backend
-        *
-        * @param siz number of bytes to read
-        * @return array of bytes received
-        * @exception SQLException if a data I/O error occurs
-        */
-       public byte[] Receive(int siz) throws SQLException
-       {
-               byte[] answer = new byte[siz];
-               Receive(answer, 0, siz);
-               return answer;
-       }
-
-       /*
-        * Reads in a given number of bytes from the backend
-        *
-        * @param buf buffer to store result
-        * @param off offset in buffer
-        * @param siz number of bytes to read
-        * @exception SQLException if a data I/O error occurs
-        */
-       public void Receive(byte[] b, int off, int siz) throws SQLException
-       {
-               int s = 0;
-
-               try
-               {
-                       while (s < siz)
-                       {
-                               int w = pg_input.read(b, off + s, siz - s);
-                               if (w < 0)
-                                       throw new PSQLException("postgresql.stream.eof", PSQLState.COMMUNICATION_ERROR);
-                               s += w;
-                       }
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.stream.ioerror", PSQLState.COMMUNICATION_ERROR, e);
-               }
-       }
-
-       /*
-        * This flushes any pending output to the backend. It is used primarily
-        * by the Fastpath code.
-        * @exception SQLException if an I/O error occurs
-        */
-       public void flush() throws SQLException
-       {
-               try
-               {
-                       pg_output.flush();
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.stream.flush", PSQLState.COMMUNICATION_ERROR, e);
-               }
-       }
-
-       /*
-        * Closes the connection
-        *
-        * @exception IOException if a IO Error occurs
-        */
-       public void close() throws IOException
-       {
-               pg_output.close();
-               pg_input.close();
-               connection.close();
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java b/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
deleted file mode 100644 (file)
index b1d69ce..0000000
+++ /dev/null
@@ -1,511 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * QueryExecutor.java
- *     Executes a query on the backend.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java,v 1.28 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.core;
-
-import java.util.Vector;
-import java.io.IOException;
-import java.sql.*;
-import org.postgresql.Driver;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-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 BaseResultSet execute(String[] p_sqlFrags,
-                                   Object[] p_binds,
-                                   BaseStatement statement)
-       throws SQLException
-       {
-               QueryExecutor qe = new QueryExecutor();
-               qe.m_sqlFrags = p_sqlFrags;
-               qe.m_binds = p_binds;
-               qe.statement = statement;
-               if (statement != null)
-                       qe.maxRows = statement.getMaxRows();
-               else
-                       qe.maxRows = 0;
-
-        qe.connection = statement.getPGConnection();
-               qe.pgStream = qe.connection.getPGStream();
-
-               return qe.execute();
-       }
-
-       //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,
-                                   Object[] p_binds,
-                                   BaseResultSet rs)
-       throws SQLException
-       {
-               QueryExecutor qe = new QueryExecutor();
-               qe.m_sqlFrags = p_sqlFrags;
-               qe.m_binds = p_binds;
-               qe.rs = rs;
-               qe.statement = qe.rs.getPGStatement();
-               if (qe.statement != null)
-                       qe.maxRows = qe.statement.getMaxRows();
-               else
-                       qe.maxRows = 0;
-
-        qe.connection = qe.statement.getPGConnection();
-               qe.pgStream =   qe.connection.getPGStream();
-
-               qe.execute();
-       }
-
-
-       private QueryExecutor ()
-       {
-       }
-
-       private String[] m_sqlFrags;
-       private Object[] m_binds;
-       private BaseStatement statement;
-       private BaseResultSet rs;
-
-       private BaseConnection connection;
-       private PGStream pgStream;
-
-       private Field[] fields = null;
-       private Vector tuples = new Vector();
-       private boolean binaryCursor = false;
-       private String status = null;
-       private int update_count = 1;
-       private long insert_oid = 0;
-       private int maxRows;
-
-
-       /*
-        * Execute a query on the backend.
-        *
-        */
-       private BaseResultSet execute() throws SQLException
-       {
-               if (connection.getPGProtocolVersionMajor() == 3) {
-                       if (Driver.logDebug)
-                               Driver.debug("Using Protocol Version3 to send query");
-                       return executeV3();
-               } else {
-                       if (Driver.logDebug)
-                               Driver.debug("Using Protocol Version2 to send query");
-                       return executeV2();
-               }
-       }
-
-       private BaseResultSet executeV3() throws SQLException
-       {
-
-               PSQLException error = null;
-
-               if (pgStream == null) 
-               {
-                       throw new PSQLException("postgresql.con.closed", PSQLState.CONNECTION_DOES_NOT_EXIST);
-               }
-
-               synchronized (pgStream)
-               {
-
-                       sendQueryV3();
-
-                       int c;
-                       boolean l_endQuery = false;
-                       while (!l_endQuery)
-                       {
-                               c = pgStream.ReceiveChar();
-                               switch (c)
-                               {
-                                       case 'A':       // Asynchronous Notify
-                                               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
-                                               receiveTupleV3(true);
-                                               break;
-                                       case 'C':       // Command Status
-                                               receiveCommandStatusV3();
-                                               break;
-                                       case 'D':       // Text Data Transfer
-                                               receiveTupleV3(false);
-                                               break;
-                                       case 'E':       // Error Message
-
-                                               // it's possible to get more than one error message for a query
-                                               // see libpq comments wrt backend closing a connection
-                                               // so, append messages to a string buffer and keep processing
-                                               // check at the bottom to see if we need to throw an exception
-
-                                               int l_elen = pgStream.ReceiveIntegerR(4);
-                                               String totalMessage = connection.getEncoding().decode(pgStream.Receive(l_elen-4));
-                                               PSQLException l_error = PSQLException.parseServerError(totalMessage);
-
-                                               if (error != null) {
-                                                       error.setNextException(l_error);
-                                               } else {
-                                                       error = l_error;
-                                               }
-
-                                               // keep processing
-                                               break;
-                                       case 'I':       // Empty Query
-                                               int t = pgStream.ReceiveIntegerR(4);
-                                               break;
-                                       case 'N':       // Error Notification
-                                               int l_nlen = pgStream.ReceiveIntegerR(4);
-                                               statement.addWarning(connection.getEncoding().decode(pgStream.Receive(l_nlen-4)));
-                                               break;
-                                       case 'P':       // Portal Name
-                                               String pname = pgStream.ReceiveString(connection.getEncoding());
-                                               break;
-                               case 'S':
-                                               //TODO: handle parameter status messages
-                                               int l_len = pgStream.ReceiveIntegerR(4);
-                                               String l_pStatus = connection.getEncoding().decode(pgStream.Receive(l_len-4));
-                                               if (Driver.logDebug)
-                                                       Driver.debug("ParameterStatus="+ l_pStatus);
-                                               break;
-                                       case 'T':       // MetaData Field Description
-                                               receiveFieldsV3();
-                                               break;
-                                       case 'Z':
-                                               // read ReadyForQuery
-                                               //TODO: use size better
-                                               if (pgStream.ReceiveIntegerR(4) != 5) throw new PSQLException("postgresql.con.setup", PSQLState.CONNECTION_UNABLE_TO_CONNECT); 
-                                               //TODO: handle transaction status
-                                               char l_tStatus = (char)pgStream.ReceiveChar();
-                                               l_endQuery = true;
-                                               break;
-                                       default:
-                                               throw new PSQLException("postgresql.con.type", PSQLState.CONNECTION_FAILURE, new Character((char) c));
-                               }
-
-                       }
-
-                       // did we get an error during this query?
-                       if ( error != null )
-                               throw error;
-
-                       //if an existing result set was passed in reuse it, else
-                       //create a new one
-                       if (rs != null) 
-                       {
-                               rs.reInit(fields, tuples, status, update_count, insert_oid, binaryCursor);
-                       }
-                       else 
-                       {
-                               rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid, binaryCursor);
-                       }
-                       return rs;
-               }
-       }
-
-       private BaseResultSet executeV2() throws SQLException
-       {
-
-               StringBuffer errorMessage = null;
-
-               if (pgStream == null) 
-               {
-                       throw new PSQLException("postgresql.con.closed", PSQLState.CONNECTION_DOES_NOT_EXIST);
-               }
-
-               synchronized (pgStream)
-               {
-
-                       sendQueryV2();
-
-                       int c;
-                       boolean l_endQuery = false;
-                       while (!l_endQuery)
-                       {
-                               c = pgStream.ReceiveChar();
-
-                               switch (c)
-                               {
-                                       case 'A':       // Asynchronous Notify
-                                               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
-                                               receiveTupleV2(true);
-                                               break;
-                                       case 'C':       // Command Status
-                                               receiveCommandStatusV2();
-                                               break;
-                                       case 'D':       // Text Data Transfer
-                                               receiveTupleV2(false);
-                                               break;
-                                       case 'E':       // Error Message
-
-                                               // it's possible to get more than one error message for a query
-                                               // see libpq comments wrt backend closing a connection
-                                               // so, append messages to a string buffer and keep processing
-                                               // check at the bottom to see if we need to throw an exception
-
-                                               if ( errorMessage == null )
-                                                       errorMessage = new StringBuffer();
-
-                                               errorMessage.append(pgStream.ReceiveString(connection.getEncoding()));
-                                               // keep processing
-                                               break;
-                                       case 'I':       // Empty Query
-                                               int t = pgStream.ReceiveIntegerR(4);
-                                               break;
-                                       case 'N':       // Error Notification
-                                               statement.addWarning(pgStream.ReceiveString(connection.getEncoding()));
-                                               break;
-                                       case 'P':       // Portal Name
-                                               String pname = pgStream.ReceiveString(connection.getEncoding());
-                                               break;
-                                       case 'T':       // MetaData Field Description
-                                               receiveFieldsV2();
-                                               break;
-                                       case 'Z':
-                                               l_endQuery = true;
-                                               break;
-                                       default:
-                                               throw new PSQLException("postgresql.con.type", PSQLState.CONNECTION_FAILURE, new Character((char) c));
-                               }
-
-                       }
-
-                       // did we get an error during this query?
-                       if ( errorMessage != null )
-                               throw new SQLException( errorMessage.toString().trim() );
-
-
-                       //if an existing result set was passed in reuse it, else
-                       //create a new one
-                       if (rs != null) 
-                       {
-                               rs.reInit(fields, tuples, status, update_count, insert_oid, binaryCursor);
-                       }
-                       else 
-                       {
-                               rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid, binaryCursor);
-                       }
-                       return rs;
-               }
-       }
-
-       /*
-        * Send a query to the backend.
-        */
-       private void sendQueryV3() throws SQLException
-       {
-               for ( int i = 0; i < m_binds.length ; i++ )
-               {
-                       if ( m_binds[i] == null )
-                               throw new PSQLException("postgresql.prep.param", PSQLState.INVALID_PARAMETER_VALUE, new Integer(i + 1));
-               }
-               try
-               {
-                       byte[][] l_parts = new byte[(m_binds.length*2)+1][];
-                       int j = 0;
-                       int l_msgSize = 4;
-                       Encoding l_encoding = connection.getEncoding();
-                       pgStream.SendChar('Q');
-                       for (int i = 0 ; i < m_binds.length ; ++i)
-                       {
-                               l_parts[j] = l_encoding.encode(m_sqlFrags[i]);
-                               l_msgSize += l_parts[j].length;
-                               j++;
-                               l_parts[j] = l_encoding.encode(m_binds[i].toString());
-                               l_msgSize += l_parts[j].length;
-                               j++;
-                       }
-                       l_parts[j] = l_encoding.encode(m_sqlFrags[m_binds.length]);
-                       l_msgSize += l_parts[j].length;
-                       pgStream.SendInteger(l_msgSize+1,4);
-                       for (int k = 0; k < l_parts.length; k++) {
-                               pgStream.Send(l_parts[k]);
-                       }
-                       pgStream.SendChar(0);
-                       pgStream.flush();
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.con.ioerror", PSQLState.CONNECTION_FAILURE_DURING_TRANSACTION, e);
-               }
-       }
-
-       /*
-        * Send a query to the backend.
-        */
-       private void sendQueryV2() throws SQLException
-       {
-               for ( int i = 0; i < m_binds.length ; i++ )
-               {
-                       if ( m_binds[i] == null )
-                               throw new PSQLException("postgresql.prep.param", PSQLState.INVALID_PARAMETER_VALUE, new Integer(i + 1));
-               }
-               try
-               {
-                       pgStream.SendChar('Q');
-                       for (int i = 0 ; i < m_binds.length ; ++i)
-                       {
-                               pgStream.Send(connection.getEncoding().encode(m_sqlFrags[i]));
-                               pgStream.Send(connection.getEncoding().encode(m_binds[i].toString()));
-                       }
-
-                       pgStream.Send(connection.getEncoding().encode(m_sqlFrags[m_binds.length]));
-                       pgStream.SendChar(0);
-                       pgStream.flush();
-
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.con.ioerror", PSQLState.CONNECTION_FAILURE_DURING_TRANSACTION, e);
-               }
-       }
-
-       /*
-        * Receive a tuple from the backend.
-        *
-        * @param isBinary set if the tuple should be treated as binary data
-        */
-       private void receiveTupleV3(boolean isBinary) throws SQLException
-       {
-               if (fields == null)
-                       throw new PSQLException("postgresql.con.tuple", PSQLState.CONNECTION_FAILURE);
-               Object tuple = pgStream.ReceiveTupleV3(fields.length, isBinary);
-               if (isBinary)
-                       binaryCursor = true;
-               if (maxRows == 0 || tuples.size() < maxRows)
-                       tuples.addElement(tuple);
-       }
-
-       /*
-        * Receive a tuple from the backend.
-        *
-        * @param isBinary set if the tuple should be treated as binary data
-        */
-       private void receiveTupleV2(boolean isBinary) throws SQLException
-       {
-               if (fields == null)
-                       throw new PSQLException("postgresql.con.tuple", PSQLState.CONNECTION_FAILURE);
-               Object tuple = pgStream.ReceiveTupleV2(fields.length, isBinary);
-               if (isBinary)
-                       binaryCursor = true;
-               if (maxRows == 0 || tuples.size() < maxRows)
-                       tuples.addElement(tuple);
-       }
-
-       /*
-        * Receive command status from the backend.
-        */
-       private void receiveCommandStatusV3() throws SQLException
-       {
-               //TODO: better handle the msg len
-               int l_len = pgStream.ReceiveIntegerR(4);
-               //read l_len -5 bytes (-4 for l_len and -1 for trailing \0)
-               status = connection.getEncoding().decode(pgStream.Receive(l_len-5)); 
-               //now read and discard the trailing \0
-               pgStream.Receive(1);
-               try
-               {
-                       // Now handle the update count correctly.
-                       if (status.startsWith("INSERT") || status.startsWith("UPDATE") || status.startsWith("DELETE") || status.startsWith("MOVE"))
-                       {
-                               update_count = Integer.parseInt(status.substring(1 + status.lastIndexOf(' ')));
-                       }
-                       if (status.startsWith("INSERT"))
-                       {
-                               insert_oid = Long.parseLong(status.substring(1 + status.indexOf(' '),
-                                                                                       status.lastIndexOf(' ')));
-                       }
-               }
-               catch (NumberFormatException nfe)
-               {
-                       throw new PSQLException("postgresql.con.fathom", PSQLState.CONNECTION_FAILURE, status);
-               }
-       }
-       /*
-        * Receive command status from the backend.
-        */
-       private void receiveCommandStatusV2() throws SQLException
-       {
-
-               status = pgStream.ReceiveString(connection.getEncoding());
-
-               try
-               {
-                       // Now handle the update count correctly.
-                       if (status.startsWith("INSERT") || status.startsWith("UPDATE") || status.startsWith("DELETE") || status.startsWith("MOVE"))
-                       {
-                               update_count = Integer.parseInt(status.substring(1 + status.lastIndexOf(' ')));
-                       }
-                       if (status.startsWith("INSERT"))
-                       {
-                               insert_oid = Long.parseLong(status.substring(1 + status.indexOf(' '),
-                                                                                       status.lastIndexOf(' ')));
-                       }
-               }
-               catch (NumberFormatException nfe)
-               {
-                       throw new PSQLException("postgresql.con.fathom", PSQLState.CONNECTION_FAILURE, status);
-               }
-       }
-
-       /*
-        * Receive the field descriptions from the back end.
-        */
-       private void receiveFieldsV3() throws SQLException
-       {
-               //TODO: use the msgSize
-               //TODO: use the tableOid, and tablePosition
-               if (fields != null)
-                       throw new PSQLException("postgresql.con.multres", PSQLState.CONNECTION_FAILURE);
-               int l_msgSize = pgStream.ReceiveIntegerR(4);
-               int size = pgStream.ReceiveIntegerR(2);
-               fields = new Field[size];
-
-               for (int i = 0; i < fields.length; i++)
-               {
-                       String typeName = pgStream.ReceiveString(connection.getEncoding());
-                       int tableOid = pgStream.ReceiveIntegerR(4);
-                       int tablePosition = pgStream.ReceiveIntegerR(2);
-                       int typeOid = pgStream.ReceiveIntegerR(4);
-                       int typeLength = pgStream.ReceiveIntegerR(2);
-                       int typeModifier = pgStream.ReceiveIntegerR(4);
-                       int formatType = pgStream.ReceiveIntegerR(2);
-                       //TODO: use the extra values coming back
-                       fields[i] = new Field(connection, typeName, typeOid, typeLength, typeModifier);
-               }
-       }
-       /*
-        * Receive the field descriptions from the back end.
-        */
-       private void receiveFieldsV2() throws SQLException
-       {
-               if (fields != null)
-                       throw new PSQLException("postgresql.con.multres", PSQLState.CONNECTION_FAILURE);
-
-               int size = pgStream.ReceiveIntegerR(2);
-               fields = new Field[size];
-
-               for (int i = 0; i < fields.length; i++)
-               {
-                       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);
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/core/StartupPacket.java b/src/interfaces/jdbc/org/postgresql/core/StartupPacket.java
deleted file mode 100644 (file)
index a8ca754..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.postgresql.core;
-
-import java.io.IOException;
-
-/**
- * Sent to the backend to initialize a newly created connection.
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/core/StartupPacket.java,v 1.5 2003/11/29 22:41:22 pgsql Exp $
- */
-
-public class StartupPacket
-{
-       private static final int SM_DATABASE = 64;
-       private static final int SM_USER = 32;
-       private static final int SM_OPTIONS = 64;
-       private static final int SM_UNUSED = 64;
-       private static final int SM_TTY = 64;
-
-       private int protocolMajor;
-       private int protocolMinor;
-       private String user;
-       private String database;
-
-       public StartupPacket(int protocolMajor, int protocolMinor, String user, String database)
-       {
-               this.protocolMajor = protocolMajor;
-               this.protocolMinor = protocolMinor;
-               this.user = user;
-               this.database = database;
-       }
-
-       public void writeTo(PGStream stream) throws IOException
-       {
-               if (protocolMajor == 3) {
-                       v3WriteTo(stream);
-               } else {
-                       v2WriteTo(stream);
-               }
-       }
-
-       public void v3WriteTo(PGStream stream) throws IOException
-       {
-               stream.SendInteger(4 + 4 + "user".length() + 1 + user.length() + 1 + "database".length() +1 + database.length() + 1 + 1, 4);
-               stream.SendInteger(protocolMajor, 2);
-               stream.SendInteger(protocolMinor, 2);
-               stream.Send("user".getBytes());
-               stream.SendChar(0);
-               stream.Send(user.getBytes());
-               stream.SendChar(0);
-               stream.Send("database".getBytes());
-               stream.SendChar(0);
-               stream.Send(database.getBytes());
-               stream.SendChar(0);
-               stream.SendChar(0);
-       }
-
-       public void v2WriteTo(PGStream stream) throws IOException
-       {
-               stream.SendInteger(4 + 4 + SM_DATABASE + SM_USER + SM_OPTIONS + SM_UNUSED + SM_TTY, 4);
-               stream.SendInteger(protocolMajor, 2);
-               stream.SendInteger(protocolMinor, 2);
-               stream.Send(database.getBytes(), SM_DATABASE);
-
-               // This last send includes the unused fields
-               stream.Send(user.getBytes(), SM_USER + SM_OPTIONS + SM_UNUSED + SM_TTY);
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/errors.properties b/src/interfaces/jdbc/org/postgresql/errors.properties
deleted file mode 100644 (file)
index 468ef71..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-# This is the default errors
-postgresql.arr.range:The array index is out of range.
-postgresql.drv.version:An internal error has occured. Please recompile the driver.
-postgresql.con.auth:The authentication type {0} is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or Subnet, and that it is using an authentication scheme supported by the driver.
-postgresql.con.authfail:An error occured while getting the authentication request.
-postgresql.con.backend:Backend start-up failed: {0}
-postgresql.con.call:Callable Statements are not supported at this time.
-postgresql.con.invalidchar:Invalid character data was found.  This is most likely caused by stored data containing characters that are invalid for the character set the database was created in.  The most common example of this is storing 8bit data in a SQL_ASCII database.
-postgresql.con.closed:Connection is closed.  Operation is not permitted.
-postgresql.con.creobj:Failed to create object for {0} {1}
-postgresql.con.failed:The connection attempt failed because {0}
-postgresql.con.failed.bad.encoding:The connection attempt failed trying to get the server encoding
-postgresql.con.failed.bad.autocommit:The connection attempt failed trying to get the autocommit status
-postgresql.con.fathom:Unable to fathom update count {0}
-postgresql.con.garbled:Garbled data received.
-postgresql.con.ioerror:An IO erro occured while sending to the backend - {0}
-postgresql.con.kerb4:Kerberos 4 authentication is not supported by this driver.
-postgresql.con.kerb5:Kerberos 5 authentication is not supported by this driver.
-postgresql.con.misc:A connection error has occurred: {0}
-postgresql.con.multres:Cannot handle multiple result groups.
-postgresql.con.pass:The password property is missing. It is mandatory.
-postgresql.con.refused:Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
-postgresql.con.scm:SCM credentials authentication is not supported by this driver.
-postgresql.con.setup:Protocol error. Session setup failed.
-postgresql.con.sslfail:An error occured while getting setting up the SSL connection.
-postgresql.con.sslnotsupported:The server does not support SSL
-postgresql.con.strobj:The object could not be stored. Check that any tables required have already been created in the database.
-postgresql.con.strobjex:Failed to store object - {0}
-postgresql.con.toolong:The SQL Statement is too long - {0}
-postgresql.con.isolevel:Transaction isolation level {0} is not supported.
-postgresql.con.tuple:Tuple received before MetaData.
-postgresql.con.type:Unknown Response Type {0}
-postgresql.con.user:The user property is missing. It is mandatory.
-postgresql.error.detail:Detail: {0}
-postgresql.error.hint:Hint: {0}
-postgresql.error.position:Position: {0}
-postgresql.error.where:Where: {0}
-postgresql.error.location:Location: {0}
-postgresql.fp.error:FastPath call returned {0}
-postgresql.fp.expint:Fastpath call {0} - No result was returned and we expected an integer.
-postgresql.fp.protocol:FastPath protocol error: {0}
-postgresql.fp.send:Failed to send fastpath call {0} {1}
-postgresql.fp.unknown:The fastpath function {0} is unknown.
-postgresql.geo.box:Conversion of box failed - {0}
-postgresql.geo.circle:Conversion of circle failed - {0}
-postgresql.geo.line:Conversion of line failed - {0}
-postgresql.geo.lseg:Conversion of lseg failed - {0}
-postgresql.geo.path:Cannot tell if path is open or closed.
-postgresql.geo.point:Conversion of point failed - {0}
-postgresql.jvm.version:The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try rebuilding. If that fails, try forcing the version supplying it to the command line using the argument -Djava.version=1.1 or -Djava.version=1.2\nException thrown was {0}
-postgresql.lo.init:failed to initialise LargeObject API
-postgresql.metadata.unavailable:Metadata unavailable.
-postgresql.money:conversion of money failed - {0}
-postgresql.noupdate:This ResultSet is not updateable.
-postgresql.notsensitive:This ResultSet is not sensitive to realtime updates after the query has run.
-postgresql.psqlnotimp:The backend currently does not support this feature.
-postgresql.prep.is:InputStream as parameter not supported
-postgresql.prep.param:No value specified for parameter {0}
-postgresql.prep.range:Parameter index out of range.
-postgresql.prep.type:Unknown Types value.
-postgresql.res.badbigdec:Bad BigDecimal {0}
-postgresql.res.badbyte:Bad Byte {0}
-postgresql.res.baddate:Bad Date Format at {0} in {1}
-postgresql.res.baddouble:Bad Double {0}
-postgresql.res.badfloat:Bad Float {0}
-postgresql.res.badint:Bad Integer {0}
-postgresql.res.badlong:Bad Long {0}
-postgresql.res.badshort:Bad Short {0}
-postgresql.res.badtime:Bad Time {0}
-postgresql.res.badtimestamp:Bad Timestamp Format at {0} in {1}
-postgresql.res.closed:Result set is closed.  Operation is not permitted.
-postgresql.res.colname:The column name {0} not found.
-postgresql.res.colrange:The column index is out of range.
-postgresql.res.nextrequired:Result set not positioned properly, perhaps you need to call next().
-postgresql.serial.interface:You cannot serialize an interface.
-postgresql.serial.namelength:Class & Package name length cannot be longer than 64 characters. {0} is {1} characters.
-postgresql.serial.noclass:No class found for {0}
-postgresql.serial.table:The table for {0} is not in the database. Contact the DBA, as the database is in an inconsistent state.
-postgresql.serial.underscore:Class names may not have _ in them. You supplied {0}.
-postgresql.stat.batch.error:Batch entry {0} {1} was aborted. Call getNextException() to see the cause.
-postgresql.stat.noresult:No results were returned by the query.
-postgresql.stat.result:A result was returned when none was expected.
-postgresql.stream.eof:The backend has broken the connection. Possibly the action you have attempted has caused it to close.
-postgresql.stream.flush:An I/O error has occured while flushing the output - {0}
-postgresql.stream.ioerror:An I/O error occured while reading from backend - {0}
-postgresql.stream.toomuch:Too much data was received.
-postgresql.unusual:Something unusual has occured to cause the driver to fail. Please report this exception: {0}
-postgresql.unimplemented:This method is not yet implemented.
-postgresql.unexpected:An unexpected result was returned by a query.
-postgresql.updateable.notupdateable: Result Set not updateable. The query that generated this result set must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.
-postgresql.updateable.oninsertrow:Can not call deleteRow() when on insert row
-postgresql.updateable.emptydelete:Can't deleteRow() on empty result set
-postgresql.updateable.beforestartdelete:Before start of result set. Can not call deleteRow().
-postgresql.updateable.afterlastdelete:After end of result set. Can not call deleteRow().
-postgresql.updateable.notoninsertrow:Not on insert row.
-postgresql.updateable.inputstream:Input Stream is null.
-postgresql.updateable.ioerror:Input Stream Error - {0}
-postgresql.call.noreturntype:A CallableStatement Function was declared but no call to 'registerOutParameter (1, <some_type>)' was made.
-postgresql.call.noinout:PostgreSQL only supports function return value [@ 1] (no OUT or INOUT arguments)
-postgresql.call.procasfunc:This Statement [{0}] defines a procedure call (needs ?= call <stmt> to be considered a function.
-postgresql.call.malformed:Malformed stmt [{0}] usage : {1}
-postgresql.call.funcover:Cannot execute Query a call to setXXX (1, ..) was made where argument 1 is the return value of a function.
-postgresql.call.wrongget:Parameter of type {0} was registered but call to get{1} (sqltype={2}) was made.
-postgresql.call.noreturnval:A CallableStatement Function was executed with nothing returned.
-postgresql.call.wrongrtntype:A CallableStatement Function was executed and the return was of type ({0}) however type={1} was registered.
-postgresql.input.fetch.gt0:Fetch size must be a value greater than or equal to 0.
-postgresql.input.query.gt0:Query Timeout must be a value greater than or equal to 0.
-postgresql.input.rows.gt0:Maximum number of rows must be a value greater than or equal to 0.
-postgresql.format.baddate:The date given: {0} does not match the format required: {1}.
-postgresql.format.badtime:The time given: {0} does not match the format required: {1}.
-postgresql.format.badtimestamp:The timestamp given {0} does not match the format required: {1}.
-postgresql.input.field.gt0:The maximum field size must be a value greater than or equal to 0.
diff --git a/src/interfaces/jdbc/org/postgresql/errors_de.properties b/src/interfaces/jdbc/org/postgresql/errors_de.properties
deleted file mode 100644 (file)
index 2358000..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-# Message translation file for PostgreSQL JDBC driver
-# Peter Eisentraut <peter_e@gmx.net>, 2001.
-#
-# $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/errors_de.properties,v 1.6 2003/11/29 19:52:09 pgsql Exp $
-
-postgresql.con.auth:Der Authentifizierungstyp »{0}« wird nicht unterstützt.
-postgresql.con.authfail:Ein Fehler trat auf während die Authentifizierungsanfrage empfangen wurde.
-postgresql.con.call:CallableStatement wird nicht unterstützt.
-postgresql.con.creobj:Konnte Objekt vom Typ {0} nicht erstellen: {1}
-postgresql.con.encoding:Nicht unterstützte Kodierung: {0}
-postgresql.con.failed:Der Verbindungsversuch schlug fehl: {0}
-postgresql.con.fathom:Kann Anzahl der veränderten Zeilen nicht ermitteln: {0}
-postgresql.con.garbled:Unverständliche Daten wurden empfangen.
-postgresql.con.ioerror:Eingabe/Ausgabe-Fehler: {0}
-postgresql.con.isolevel:Transaktionsisolation {0} wird nicht unterstützt.
-postgresql.con.kerb4:Kerberos-IV-Authentifizierung wird von diesem Treiber nicht unterstützt.
-postgresql.con.kerb5:Kerberos-V-Authentifizierung wird von diesem Treiber nicht unterstützt.
-postgresql.con.multres:Mehrere Ergebnisgruppen können nicht verarbeitet werden.
-postgresql.con.pass:Das Paßwort fehlt.
-postgresql.con.refused:Verbindung verweigert. Prüfen Sie, daß der Server TCP/IP-Verbindungen annimmt.
-postgresql.con.setup:Protokollfehler - Sitzung konnte nicht gestartet werden.
-postgresql.con.strobj:Konnte Objekt nicht speichern - {0}
-postgresql.con.strobjex:Das Objekt konnte nicht gespeichert werden. Prüfen Sie, daß die benötigten Tabellen bereits erstellt wurden.
-postgresql.con.tuple:Ergebnisdaten wurden empfangen, als sie nicht erwartet wurden.
-postgresql.con.type:Unbekannte Antwort vom Server: »{0}«
-postgresql.con.user:Benutzername wurde nicht angegeben.
-postgresql.ds.onlyjdbc2:Es werden nur JDBC2-Verbindungen unterstützt.
-postgresql.ds.userpswd:Kein Benutzername oder Paßwort angegeben.
-postgresql.fp.error:FastPath-Aufruf ergab »{0}«.
-postgresql.fp.expint:FastPath-Aufruf »{0}« gab kein Ergebnis zurück, aber ein Integer wurde erwartet.
-postgresql.fp.protocol:FastPath-Protokollfehler: {0}
-postgresql.fp.send:Konnte FastPath-Aufruf »{0}« nicht senden: {1}
-postgresql.fp.unknown:Die FastPath-Funktion »{0}« ist nicht bekannt.
-postgresql.geo.box:Konnte »{0}« nicht in Typ »box« umwandeln
-postgresql.geo.circle:Konnte »{0}« nicht in Typ »circle« umwandeln
-postgresql.geo.line:Konnte »{0}« nicht in Typ »line« umwandeln
-postgresql.geo.lseg:Konnte »{0}« nicht in Typ »lseg« umwandeln
-postgresql.geo.path:Konnte nicht in Typ »path« umwandeln - konnte nicht ermitteln ob der Pfad offen oder geschlossen ist
-postgresql.geo.point:Konnte »{0}« nicht in Typ »point« umwandeln
-postgresql.jvm.version:Die Datei postgresql.jar enthält nicht die benötigten Klassen für diese JVM-Version. Versuchen Sie, den Treiber neu zu übersetzen. Falls das nicht hilft, bestimmen Sie die Version mit den Kommandozeilenoptionen -Djava.version=1.1 oder -Djava.version=1.2. Der Fehler war »{0}«
-postgresql.lo.init:Konnte Large-Object-API nicht initialisieren.
-postgresql.money:Ungültiges Format für Typ »money«: {0}
-postgresql.notsensitive:Dieses ResultSet ermöglicht keine Auffrischungen nach der Abfrage.
-postgresql.noupdate:Dieses ResultSet kann nicht verändert werden.
-postgresql.prep.is:InputStream als Parameter wird nicht unterstützt.
-postgresql.prep.param:Keinen Wert für Parameter {0} angegeben
-postgresql.prep.range:Parameterindex außerhalb des gültigen Bereichs
-postgresql.prep.type:Unbekannter Zieltyp
-postgresql.psqlnotimp:Der Server unterstützt diese Funktion nicht.
-postgresql.res.badbigdec:Ungültiges Format für BigDecimal: {0}
-postgresql.res.badbyte:Ungültiges Format für Byte: {0}
-postgresql.res.baddate:Ungültiger Datumswert »{0}«
-postgresql.res.baddouble:Ungültiges Format für Double: {0}
-postgresql.res.badfloat:Ungültiges Format für Float: {0}
-postgresql.res.badint:Ungültiges Format für Integer: {0}
-postgresql.res.badlong:Ungültiges Format für Long: {0}
-postgresql.res.badshort:Ungültiges Format für Short: {0}
-postgresql.res.badtime:Ungültiger Zeitwert »{0}«
-postgresql.res.badtimestamp:Ungültiger Wert für Timestamp (Datum und Zeit), in »{1}« bei Position {1}
-postgresql.res.colname:Spaltenname »{0}« nicht gefunden
-postgresql.res.colrange:Spaltenindex außerhalb des gültigen Bereichs
-postgresql.res.encoding:Nicht unterstützte Kodierung: {0}
-postgresql.serial.interface:Ein Interface kann nicht serialisiert werden.
-postgresql.serial.namelength:Klassen- und Paketname können nicht länger als 32 Zeichen sein. »{0}« ist {1} Zeichen lang.
-postgresql.serial.noclass:Keine Klasse für Typ »{0}« gefunden
-postgresql.serial.table:Keine Tabelle für Typ »{0}« in der Datenbank gefunden. Die Datenbank ist in einem unbeständigen Zustand.
-postgresql.serial.underscore:Zu serialisierende Klassennamen dürfen keine Unterstriche (_) enthälten. Der angegebene Name war »{0}«.
-postgresql.stat.batch.error:Batch-Anweisung Nummer {0} ({1}) wurde abgebrochen.
-postgresql.stat.noresult:Die Abfrage ergab kein Ergebnis.
-postgresql.stat.result:Die Anweisung ergab einen Abfrageergebnissatz, obwohl keiner erwartet wurde.
-postgresql.stream.encoding:Nicht unterstützte Kodierung: {0}
-postgresql.stream.eof:Unerwarteter Verbindungsabbruch vom Server
-postgresql.stream.flush:Eingabe/Ausgabe-Fehler beim Flush zum Server: {0}
-postgresql.stream.ioerror:Eingabe/Ausgabe-Fehler beim Empfang vom Server: {0}
-postgresql.stream.toomuch:Zu viele Daten wurden empfangen.
-postgresql.unexpected:Ein unerwartetes Resultat wurde nach einer Abfrage zurückgesendet.
-postgresql.unimplemented:Diese Methode ist noch nicht implementiert.
-postgresql.unusual:Etwas ungewöhnliches ist passiert.  Bitte Teilen Sie diesem Fehler mit: {0}
diff --git a/src/interfaces/jdbc/org/postgresql/errors_fr.properties b/src/interfaces/jdbc/org/postgresql/errors_fr.properties
deleted file mode 100644 (file)
index 79d40e2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# This is the french version of some errors. Errors not in this file
-# are handled by the parent errors.properties file.
-postgresql.jvm.version:Le fichier de postgresql.jar ne contient pas les classes correctes de JDBC pour ce JVM. Try que rebuilding.\nException jet\81ées \81était {0}
-postgresql.metadata.unavailable: Les métadonnées ne sont pas disponibles.
-postgresql.unusual:Quelque chose de peu commun s'est produit pour faire \81échouer le gestionnaire. Veuillez enregistrer cette exception: {0}
-postgresql.unimplemented:Cette m\81éthode n'est pas encore appliqu\81ée.
diff --git a/src/interfaces/jdbc/org/postgresql/errors_it.properties b/src/interfaces/jdbc/org/postgresql/errors_it.properties
deleted file mode 100644 (file)
index 197eac2..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-# This is the italian version of some errors. Errors not in this file
-# are handled by the parent errors.properties file.
-#
-# Daniele Arduini <darduini@cinetica.it <mailto:darduini@cinetica.it>>
-# Tue Aug 21 09:26:47 CEST 2001
-#
-postgresql.drv.version:Si è verificato un errore interno. Si consiglia di ricompilare il driver.
-postgresql.con.auth:L'autenticazione di tipo {0} non è supportata. Verificare che nel file di configurazione pg_hba.conf sia presente l'indirizzo IP o la sotto-rete del client, e che lo schema di autenticazione utilizzato sia supportato dal driver.
-postgresql.con.authfail:Si è verificato un errore durante la richiesta di autenticazione.
-postgresql.con.call:I ``Callable Statements'' non sono supportati al momento. 
-postgresql.con.creobj:Fallita la creazione dell'oggetto per {0} {1}
-postgresql.con.failed:Il tentativo di connessione è fallito perché {0}
-postgresql.con.fathom:Impossibile il conteggio di ``update'' {0}
-postgresql.con.garbled:Ricevuti dati incomprensibili.
-postgresql.con.ioerror:Si è verificato un errore di I/O nella spedizione di dati al processo server - {0}
-postgresql.con.kerb4:L'autenticazione di tipo ``Kerberos 4'' non è supportata da questo driver.
-postgresql.con.kerb5:L'autenticazione di tipo ``Kerberos 5'' non è supportata da questo driver.
-postgresql.con.multres:Impossibile gestire gruppi multipli di risultati.
-postgresql.con.pass:La proprietà ``password'' è mancante. E` obbligatoria.
-postgresql.con.refused:Connessione rifiutata. Controllare che il nome dell'host e la porta siano corretti, e che il server (postmaster) è in esecuzione con l'opzione -i, che abilita le connessioni attraverso la rete TCP/IP.
-postgresql.con.setup:Errore di protocollo. Fallita l'impostazione della sessione.
-postgresql.con.strobj:L'oggetto potrebbe non essere stato memorizzato. Controllare che ogni tabella richiesta è stata creata nel database.
-postgresql.con.strobjex:Fallita la memorizzazione dell'oggetto - {0}
-postgresql.con.toolong:L'istruzione SQL è troppo lunga - {0}
-postgresql.con.isolevel:Il livello d'isolamento delle transazioni {0} non è supportato.
-postgresql.con.tuple:Tupla ricevuta prima del MetaData.
-postgresql.con.type:Tipo di risposta sconosciuta {0}
-postgresql.con.user:La proprietà ``user'' è mancante. E` obbligatoria.
-postgresql.fp.error:La chiamata a FastPath ha restituito {0}
-postgresql.fp.expint:Chiamata Fastpath {0} - Nessun risultato restituito mentre ci si aspettava un intero.
-postgresql.fp.protocol:Errore nel protocollo FastPath: {0}
-postgresql.fp.send:Fallito l'invio della chiamata fastpath {0} {1}
-postgresql.fp.unknown:La funzione fastpath {0} è sconosciuta.
-postgresql.geo.box:Fallita la conversione di un ``box'' - {0}
-postgresql.geo.circle:Fallita la conversione di un ``circle'' - {0}
-postgresql.geo.line:Fallita la conversione di una ``line'' - {0}
-postgresql.geo.lseg:Fallita la conversione di un ``lseg'' - {0}
-postgresql.geo.path:Impossibile stabilire se il percorso è aperto o chiuso.
-postgresql.geo.point:Fallita la conversione di un ``point'' - {0}
-postgresql.jvm.version:Il file ``postgresql.jar'' non contiene le classi JDBC corrette per questa JVM. Provare a ricompilarle. Se il problema persiste, tentare di forzare la versione fornendo sulla linea di comando l'opzione -Djava.version=1.1 oppure -Djava.version=1.2\nL'eccezione ricevuta è stata {0}
-postgresql.lo.init:Inizializzazione di LargeObject API fallita.
-postgresql.money:Fallita la conversione di un ``money'' - {0}.
-postgresql.noupdate:Questo ResultSet non è modificabile.
-postgresql.notsensitive:Questo ResultSet non risente delle modifiche in tempo reale dopo che la query è stata eseguita.
-postgresql.psqlnotimp:Il processo server al momento non supporta questa funzionalità.
-postgresql.prep.is:InputStream come parametro non è supportato
-postgresql.prep.param:Nessun valore specificato come parametro {0}.
-postgresql.prep.range:Indice del parametro fuori dall'intervallo ammissibile.
-postgresql.prep.type:Valore di tipo sconosciuto.
-postgresql.res.badbigdec:BigDecimal non corretto {0}
-postgresql.res.badbyte:Byte non corretto {0}
-postgresql.res.baddate:Date Format non corretto a {0} in {1}
-postgresql.res.baddouble:Double non corretto {0}
-postgresql.res.badfloat:Float non corretto {0}
-postgresql.res.badint:Integer non corretto {0}
-postgresql.res.badlong:Long non corretto {0}
-postgresql.res.badshort:Short non corretto {0}
-postgresql.res.badtime:Time non corretto {0}
-postgresql.res.badtimestamp:Timestamp Format non corretto a {0} in {1}
-postgresql.res.colname:Colonna denominata {0} non trovata.
-postgresql.res.colrange:Indice di colonna fuori dall'intervallo ammissibile.
-postgresql.serial.interface:Impossibile serializzare un'interfaccia.
-postgresql.serial.namelength:La lunghezza dei nomi per Class & Package non può essere superiore a 32 caratteri. {0} è di {1} caratteri.
-postgresql.serial.noclass:Nessuna classe trovata per {0}.
-postgresql.serial.table:La tabella per {0} non è nel database. Contattare l'amministratore del DB, visto che il database è in uno stato incosistente.
-postgresql.serial.underscore:Il nome di una classe non può contenere il carattere ``_''. E` stato fornito {0}.
-postgresql.stat.batch.error:L'operazione {0} {1} della sequenza è stata annullata.
-postgresql.stat.noresult:Nessun risultato è stato restituito dalla query.
-postgresql.stream.eof:Il backend ha interrotto la connessione. Probabilmente la tua azione ha causato la sua uscita.
-postgresql.stream.flush:Si è verificato un errore di I/O mentre si svuotava il buffer d'uscita - {0}
-postgresql.stream.ioerror:Si è verificato un errore di I/O mentre si leggevano dati dal backend - {0}
-postgresql.stream.toomuch:Troppi dati ricevuti.
-postgresql.unusual:Qualcosa di insolito si è verificato causando il fallimento del driver. Per favore riferire all'autore del driver questa eccezione: {0}
-postgresql.unimplemented:Questo metodo non è stato ancora implementato.
-postgresql.unexpected:Un risultato inaspettato è stato ricevuto dalla query.
diff --git a/src/interfaces/jdbc/org/postgresql/errors_nl.properties b/src/interfaces/jdbc/org/postgresql/errors_nl.properties
deleted file mode 100644 (file)
index 1dc9345..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# This is the default errors
-# Dutch translation by Arnout Kuiper (ajkuiper@wxs.nl)
-postgresql.con.auth:Het authenticatie type {0} wordt niet ondersteund. Controleer dat het IP adres of subnet van de client is geconfigureerd in de pg_hba.conf file, en dat het een authenticatie protocol gebruikt dat door de driver ondersteund wordt.
-postgresql.con.authfail:Een fout trad op tijdens het ophalen van het authenticatie verzoek.
-postgresql.con.call:Callable Statements worden op dit moment niet ondersteund.
-postgresql.con.creobj:Kon geen object aanmaken voor  {0} {1}
-postgresql.con.failed:De poging om verbinding the maken faalde omdat {0}
-postgresql.con.fathom:Niet in staat om the update telling te peilen {0}
-postgresql.con.garbled:Verminkte data ontvangen.
-postgresql.con.ioerror:Een I/O fout trad op tijdens het zenden naar de achterkant - {0}
-postgresql.con.kerb4:Kerberos 4 authenticatie wordt niet ondersteund door deze driver.
-postgresql.con.kerb5:Kerberos 5 authenticatie wordt niet ondersteund door deze driver.
-postgresql.con.multres:Kan niet omgaan met meerdere resultaat groepen.
-postgresql.con.pass:Het password, welke verplicht is, ontbreekt.
-postgresql.con.refused:Verbinding geweigerd. Controleer dat de hostnaam en poort correct zijn, en dat de postmaster is opgestart met de -i vlag, welke TCP/IP networking aanzet.
-postgresql.con.strobj:Het object kon niet worden opgeslagen. Controleer dat alle benodigde tabellen aangemaakt zijn in de database.
-postgresql.con.strobjex:Kon niet object opslaan - {0}
-postgresql.con.toolong:Het SQL Statement is te lang - {0}
-postgresql.con.tuple:Tuple ontvangen voor MetaData.
-postgresql.con.type:Onbekend antwoord type {0}
-postgresql.con.user:De user, welke verplicht is, ontbreekt.
-postgresql.fp.error:FastPath aanroep retourneerde {0}
-postgresql.fp.expint:Fastpath aanroep {0} - Geen resultaat werd teruggegeven, terwijl we een integer verwacht hadden.
-postgresql.fp.protocol:FastPath protocol fout: {0}
-postgresql.fp.send:Kon geen fastpath aanroep verzenden {0} {1}
-postgresql.fp.unknown:De fastpath functie {0} is onbekend.
-postgresql.geo.box:Conversie van box faalde - {0}
-postgresql.geo.circle:Conversie van circle faalde - {0}
-postgresql.geo.line:Conversie van line faalde - {0}
-postgresql.geo.lseg:Conversie van lseg faalde - {0}
-postgresql.geo.path:Kan niet zeggen of path open of gesloten is.
-postgresql.geo.point:Conversie van point faalde - {0}
-postgresql.jvm.version:De postgresql.jar file bevat niet de correcte JDBC classen voor deze JVM. Probeer opnieuw te bouwen. Als dat niet werkt, probeer de versie te forceren via de command line met het argument -Djava.version=1.1 of -Djava.version=1.2\nAfgevuurde exceptie was {0}
-postgresql.lo.init:Kon LargeObject API niet initialiseren
-postgresql.money:Conversie van money faalde - {0}.
-postgresql.prep.is:InputStream als parameter wordt niet ondersteund
-postgresql.prep.param:Geen waarde opgegeven voor parameter {0}.
-postgresql.prep.range:Parameterindex is buiten bereik.
-postgresql.prep.type:Onbekende Types waarde.
-postgresql.res.badbigdec:Foute BigDecimal {0}
-postgresql.res.badbyte:Foute Byte {0}
-postgresql.res.baddate:Foutief Date Formaat op {0} in {1}
-postgresql.res.baddouble:Foute Double {0}
-postgresql.res.badfloat:Foute Float {0}
-postgresql.res.badint:Foute Integer {0}
-postgresql.res.badlong:Foute Long {0}
-postgresql.res.badshort:Foute Short {0}
-postgresql.res.badtime:Foute Time {0}
-postgresql.res.badtimestamp:Foutief Timestamp Formaat op {0} in {1}
-postgresql.res.colname:De kolom naam {0} is niet gevonden.
-postgresql.res.colrange:De kolom index is buiten bereik.
-postgresql.serial.interface:Je can geen interface serializeren.
-postgresql.serial.namelength:Class & Package name length cannot be longer than 32 characters. {0} is {1} characters.
-postgresql.serial.noclass:Geen class gevonden voor {0}.
-postgresql.serial.table:De tabel voor {0} is niet in de database. Neem contact op met de DBA, omdat de database in een inconsistente staat verkeert.
-postgresql.serial.underscore:Class namen mogen geen _ in zich hebben. Jij voerde {0} in.
-postgresql.stat.batch.error:Batch invoer {0} {1} werd afgebroken.
-postgresql.stat.noresult:Geen resultaten werden teruggegeven door de query.
-postgresql.stream.eof:De achterkant heeft de verbinding verbroken. Mogelijk was de actie die je probeerde de oorzaak hiervan.
-postgresql.stream.flush:Een I/O fout trad op tijdens het legen van de uitvoer - {0}
-postgresql.stream.ioerror:Een I/O fout trad op tijdens het lezen van de achterkant - {0}
-postgresql.stream.toomuch:Teveel gegevens werden ontvangen
-postgresql.unusual:Iets ongewoons is opgetreden, wat deze driver doet falen. Rapporteer deze fout AUB: {0}
-postgresql.unimplemented:Deze methode is nog niet geimplementeerd
-postgresql.unexpected:Een onverwacht resultaat werd teruggegeven door een query
diff --git a/src/interfaces/jdbc/org/postgresql/errors_pl.properties b/src/interfaces/jdbc/org/postgresql/errors_pl.properties
deleted file mode 100644 (file)
index c51c1a1..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-# Polish translation of error messages.
-# Translated by Piotr Maj <piotr.maj@kernelpanic.pl>
-postgresql.arr.range:Indeks tablicy jest poza zakresem.
-postgresql.drv.version:Wyst\u0105pi\u0142 b\u0142\u0105d wewn\u0119trzny. Prosz\u0119 przekompilowa\u0107 sterownik.
-postgresql.con.auth:Typ autentykacji {0} nie jest obs\u0142ugiwany. Upewnij si\u0119, \u017ce skonfigurowa\u0142e\u015b plik pg_hba.conf tak, \u017ce zawiera on adres IP lub podsie\u0107 klienta oraz \u017ce u\u017cyta metoda authentykacji jest wspierana przez ten sterownik.
-postgresql.con.authfail:Wyst\u0105pi\u0142 b\u0142\u0105d podczas odbierania \u017c\u0105dania autentykacji.
-postgresql.con.backend:Start serwera si\u0119 nie powi\u00f3d\u0142: {0}
-postgresql.con.call:Callable Statements nie s\u0105 jeszcze obs\u0142ugiwane.
-postgresql.con.invalidchar:Znaleziono nieprawid\u0142owy znak. Najprawdopodobniej jest to spowodowane przechowywaniem w bazie znak\u00f3w, kt\u00f3re nie pasuj\u0105 do zestawu znak\u00f3w wybranego podczas tworzenia bazy danych. Najcz\u0119stszy przyk\u0142ad to przechowywanie 8-bitowych znak\u00f3w w bazie o kodowaniu SQL_ASCII.
-postgresql.con.closed:Po\u0142\u0105czenie jest zamkni\u0119te. Operacja nie dozwolona.
-postgresql.con.creobj:Utworzenie obiektu dla {0} {1} nie powiod\u0142o si\u0119.
-postgresql.con.failed:Pr\u00f3ba nawi\u0105zania po\u0142\u0105czenia nie powiod\u0142a si\u0119 z powodu: {0}
-postgresql.con.failed.bad.encoding:Pr\u00f3ba nawi\u0105zania po\u0142aczenia nie powiod\u0142a si\u0119 - nie mo\u017cna uzyska\u0107 strony kodowej serwera.
-postgresql.con.failed.bad.autocommit:Pr\u00f3ba nawi\u0105zania po\u0142\u0105czenia nie powiod\u0142a si\u0119 - nie mo\u017cna uzyska\u0107 statusu autocommit.
-postgresql.con.fathom:Nie mo\u017cna wysondowa\u0107 ilo\u015bci rekord\u00f3w {0}
-postgresql.con.garbled:Otrzymano przek\u0142amane dane.
-postgresql.con.ioerror:Wyst\u0105pi\u0142 b\u0142\u0105d IO podczas wysy\u0142ania do serwera - {0}
-postgresql.con.kerb4:Autentykacja Kerberos 4 nie jest wspierana przez ten sterownik.
-postgresql.con.kerb5:Autentykacja 5 nie jest wspierana przez ten sterownik.
-postgresql.con.misc:Wyst\u0105pi\u0142 b\u0142\u0105d po\u0142\u0105czenia: {0}
-postgresql.con.multres:Nie mo\u017cna stosowa\u0107 wielokrotnych grup wynik\u00f3w.
-postgresql.con.pass:Brak has\u0142a (password property). Jest to wymagane.
-postgresql.con.refused:Po\u0142\u0105czenie odrzucone. Sprawd\u017a, czy prawid\u0142owo ustawi\u0142e\u015b nazw\u0119 hosta oraz port i upewnij si\u0119, czy postmaster przyjmuje po\u0142\u0105czenia TCP/IP.
-postgresql.con.scm:Autentykacja SCM credentials nie jest wspierana przez ten sterownik.
-postgresql.con.setup:B\u0142\u0105d protoko\u0142u. Nie uda\u0142o si\u0119 utworzy\u0107 sesji.
-postgresql.con.sslfail:Wyst\u0105pi\u0142 b\u0142\u0105d podczas ustanawiania po\u0142\u0105czenia SSL.
-postgresql.con.sslnotsupported:Serwer nie obs\u0142uguje SSL.
-postgresql.con.strobj:Nie uda\u0142o si\u0119 zapisa\u0107 objektu. Sprawd\u017a, czy niekt\u00f3re wymagane tabele nie zosta\u0142y ju\u017c utworzone w bazie danych.
-postgresql.con.strobjex:Nie uda\u0142o sie zapisa\u0107 obiektu - {0}
-postgresql.con.toolong:Zapytanie SQL jest zbyt d\u0142ugie - {0}
-postgresql.con.isolevel:Poziom izolacji transakcji {0} nie jest obs\u0142ugiwany.
-postgresql.con.tuple:Odebrano krotk\u0119 przed MetaData.
-postgresql.con.type:Nieznany typ odpowiedzi {0}
-postgresql.con.user:Nie zdefiniowano u\u017cytkownika (user property). Jest to wymagane.
-postgresql.error.detail:Szczeg\u00f3\u0142y: {0}
-postgresql.error.hint:Wskaz\u00f3wka: {0}
-postgresql.error.position:Pozycja: {0}
-postgresql.error.where:Gdzie: {0}
-postgresql.error.location:Lokalizacja: {0}
-postgresql.fp.error:Wywo\u0142anie FastPath zwr\u00f3ci\u0142o {0}
-postgresql.fp.expint:Wywo\u0142anie FastPath {0} - Nie otrzymano \u017cadnego wyniku, a oczekiwano liczby ca\u0142kowitej.
-postgresql.fp.protocol:B\u0142\u0105d protoko\u0142u FastPath: {0}
-postgresql.fp.send:Nie uda\u0142o si\u0119 wys\u0142a\u0107 wywo\u0142ania FastPath {0} {1}
-postgresql.fp.unknown:Funkcja FastPath {0} jest nieznana.
-postgresql.geo.box:Konwersja typu box nie powiod\u0142a si\u0119 - {0}
-postgresql.geo.circle:Konwersja typu circle nie powiod\u0142a si\u0119 - {0}
-postgresql.geo.line:Konwersja typu line nie powiod\u0142a si\u0119 - {0}
-postgresql.geo.lseg:Konwersja typu lseg nie powiod\u0142a si\u0119 - {0}
-postgresql.geo.path:Nie mo\u017cna stwierdzi\u0107, czy \u015bcie\u017cka jest otwarta czy zamkni\u0119ta.
-postgresql.geo.point:Konwersja typu point nie powiod\u0142a si\u0119 - {0}
-postgresql.jvm.version: Plik postgresql.jar nie zawiera poprawnych klas JDBC dla tej JVM. Spr\u00f3buj przekompilowa\u0107 sterownik. Je\u017celi si\u0119 to nie uda spr\u00f3buj wymusi\u0107 wersj\u0119 przez podanie jej w linii polece\u0107 jako argument -Djava.version=1.1 lub -Djava.version=1.2\nZrzucony wyj\u0105tek to {0}
-postgresql.lo.init:nie uda\u0142o si\u0119 zainicjowa\u0107 LargeObject API
-postgresql.metadata.unavailable:Metadata nie dost\u0119pne.
-postgresql.money:Konwersja typu money nie powiod\u0142a si\u0119 - {0}
-postgresql.noupdate:Ten ResultSet jest niemodyfikowalny (not updateable).
-postgresql.notsensitive:Ten ResultSet nie jest wra\u017cliwy na zmiany w czasie rzeczywistym po tym, jak zapytanie si\u0119 wykona\u0142o.
-postgresql.psqlnotimp:Serwer aktualnie nie obs\u0142uguje tej funkcji.
-postgresql.prep.is:InputStream jako parametr nie jest obs\u0142ugiwany.
-postgresql.prep.param:Nie podano warto\u015bci dla parametru {0}
-postgresql.prep.range:Indeks parametru poza zakresem.
-postgresql.prep.type:Nieznana warto\u015b\u0107 Types.
-postgresql.res.badbigdec:Z\u0142y BigDecimal {0}
-postgresql.res.badbyte:Z\u0142y Byte {0}
-postgresql.res.baddate:Z\u0142y Date Format przy {0} w {1}
-postgresql.res.baddouble:Z\u0142y Double {0}
-postgresql.res.badfloat:Z\u0142y Float {0}
-postgresql.res.badint:Z\u0142y Integer {0}
-postgresql.res.badlong:Z\u0142y Long {0}
-postgresql.res.badshort:Z\u0142y Short {0}
-postgresql.res.badtime:Z\u0142y Time {0}
-postgresql.res.badtimestamp:Z\u0142y Timestamp Format przy {0} w {1}
-postgresql.res.closed:ResultSet jest zamkni\u0119ty. Operacja niedozwolona.
-postgresql.res.colname:Nieznana nazwa kolumny {0}.
-postgresql.res.colrange:Indeks kolumny jest poza zakresem.
-postgresql.res.nextrequired:Z\u0142a pozycja w ResultSet, mo\u017ce musi\u0107 wywo\u0142a\u0107 next().
-postgresql.serial.interface:Nie mo\u017cna serializowa\u0107 interfejsu.
-postgresql.serial.namelength:D\u0142ugo\u015b\u0107 nazwy klasy i pakietu nie mog\u0105 by\u0107 d\u0142u\u017csze ni\u017c 64 znaki. {0} to {1} znak\u00f3w.
-postgresql.serial.noclass:Nie znaleziono klasy dla typu {0}
-postgresql.serial.table:W bazie nie ma tabelu dla typu {0}. Skontaktuj si\u0119 z administratorem, poniewa\u017c baza utraci\u0142a sp\u00f3jno\u015b\u0107.
-postgresql.serial.underscore:Nazwy klas nie moga zawiera\u0107 _. Wprowadzi\u0142e\u015b {0}.
-postgresql.stat.batch.error:Zadanie wsadowe {0} {1} zosta\u0142o przerwane. Wywo\u0142aj getNextException(), aby pozna\u0107 przyczyn\u0119.
-postgresql.stat.noresult:Zapytanie nie zwr\u00f3ci\u0142o \u017cadnych wynik\u00f3w.
-postgresql.stat.result:Zwr\u00f3cono wynik zapytania, cho\u0107 nie by\u0142 on oczekiwany.
-postgresql.stream.eof:Serwer zerwa\u0142 po\u0142\u0105czenie. By\u0107 mo\u017ce akcja kt\u00f3r\u0105 podj\u0105\u0142e\u015b spowodowa\u0142a, \u017ce serwer zako\u0144czy\u0142 prac\u0119.
-postgresql.stream.flush:Wyst\u0105pi\u0142 b\u0142\u0105d I/O podczas opr\u00f3\u017cniania bufora wyj\u015bciowego - {0}
-postgresql.stream.ioerror:Wyst\u0105pi\u0142 b\u0142\u0105d I/O podczas odczytu z serwera - {0}
-postgresql.stream.toomuch:Otrzymano zbyt wiele danych.
-postgresql.unusual:Co\u015b niezwyk\u0142ego spowodowa\u0142o pad sterownika. Prosz\u0119, zg\u0142o\u015b ten wyj\u0105tek: {0}
-postgresql.unimplemented:Ta metoda nie jest jeszcze obs\u0142ugiwana.
-postgresql.unexpected:Zapytanie zwr\u00f3ci\u0142o nieoczekiwany wynik.
-postgresql.updateable.notupdateable:ResultSet nie jest modyfikowalny (not updateable). Zapytanie, kt\u00f3re zwr\u00f3ci\u0142o ten wynik musi dotyczy\u0107 tylko jednej tabeli oraz musi pobiera\u0107 wszystkie klucze g\u0142\u00f3wne tej tabeli. Zobacz Specyfikacj\u0119 JDBC 2.1 API, rozdzia\u0142 5.6, aby uzyska\u0107 wi\u0119cej szczeg\u00f3\u0142\u00f3w.
-postgresql.updateable.oninsertrow:Nie mo\u017cna wywo\u0142a\u0107 deleteRow() na wstawianym rekordzie.
-postgresql.updateable.emptydelete:Nie mo\u017cna wywo\u0142a\u0107 deleteRow() na pustym wyniku.
-postgresql.updateable.beforestartdelete:Przed pocz\u0105tkiek ResultSet. Nie mo\u017cna wywo\u0142a\u0107 deleteRow().
-postgresql.updateable.afterlastdelete:Za ko\u0144cem ResultSet. Nie mo\u017cna wywo\u0142a\u0107 deleteRow().
-postgresql.updateable.notoninsertrow:Nie na wstawianym rekordzie.
-postgresql.updateable.inputstream:Input Stream jest null.
-postgresql.updateable.ioerror:B\u0142\u0105d Input Stream - {0}
-postgresql.call.noreturntype:Funkcja CallableStatement zosta\u0142a zadeklarowana, ale nie wywo\u0142ano 'registerOutParameter (1, <jaki\u015b typ>)'.
-postgresql.call.noinout:PostgreSQL only supports function return value [@ 1] (no OUT or INOUT arguments)
-postgresql.call.procasfunc:This Statement [{0}] defines a procedure call (needs ?= call <stmt> to be considered a function.
-postgresql.call.malformed:Malformed stmt [{0}] usage : {1}
-postgresql.call.funcover:Cannot execute Query a call to setXXX (1, ..) was made where argument 1 is the return value of a function.
-postgresql.call.wrongget:Parameter of type {0} was registered but call to get{1} (sqltype={2}) was made.
-postgresql.call.noreturnval:A CallableStatement Function was executed with nothing returned.
-postgresql.call.wrongrtntype:A CallableStatement Function was executed and the return was of type ({0}) however type={1} was registered.
-postgresql.input.fetch.gt0:Rozmiar pobierania musi by\u0107 warto\u015bci\u0105 dodatni\u0105 lub 0.
-postgresql.input.query.gt0:Timeout zapytania musi by\u0107 warto\u015bci\u0105 dodatni\u0105 lub 0.
-postgresql.input.rows.gt0:Maksymalna liczba rekord\u00f3w musi by\u0107 warto\u015bci\u0105 dodatni\u0105 lub 0.
-postgresql.format.baddate:Podana data: {0} nie pasuje do wymaganego formatu: {1}.
-postgresql.format.badtime:Podany czas: {0} nie pasuje do wymaganego formatu: {1}.
-postgresql.format.badtimestamp:Podany timestamp: {0} nie pasuje do wymaganego formatu: {1}.
-postgresql.input.field.gt0:Maksymalny rozmiar pola musi by\u0107 warto\u015bci\u0105 dodatni\u0105 lub 0.
diff --git a/src/interfaces/jdbc/org/postgresql/errors_pt_BR.properties b/src/interfaces/jdbc/org/postgresql/errors_pt_BR.properties
deleted file mode 100644 (file)
index 984acad..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-# Message translation file for PostgreSQL JDBC driver
-# Euler Taveira de Oliveira <euler@ufgnet.ufg.br>, 2003.
-#
-postgresql.arr.range:O índice do vetor está fora do intervalo.
-postgresql.drv.version:Um erro interno ocorreu. Por favor recompile o driver.
-postgresql.con.auth:O tipo de autenticação {0} não é suportado. Verifique se você configurou o arquivo pg_hba.conf incluindo a subrede ou endereço IP do cliente, e se está utilizando o esquema de autenticação suportado pelo driver.
-postgresql.con.authfail:Um erro ocorreu quando se recebia a resposta de autenticação.
-postgresql.con.backend:Inicialização do Backend falhou: {0}
-postgresql.con.call:Instruções executáveis não são suportadas no momento.
-postgresql.con.invalidchar:Caracter inválido foi encontrado. Isso é mais comumente causado por dados armazenados que contêm caracteres que são inválidos para a codificação que foi criado o banco de dados. O exemplo mais comum disso é armazenar dados de 8 bits em um banco de dados SQL_ASCII.
-postgresql.con.closed:Conexão está fechada.  Operação não é permitida.
-postgresql.con.creobj:Falhou ao criar objeto para {0} {1}
-postgresql.con.failed:A tentativa de conexão falhou porque {0}
-postgresql.con.failed.bad.encoding:A tentativa de conexão falhou ao receber a codificação do servidor
-postgresql.con.failed.bad.autocommit:A tentativa de conexão falhou ao receber o status de autocommit
-postgresql.con.fathom:Impossível entender contador de atualização {0}
-postgresql.con.garbled:Dados truncados foram recebidos.
-postgresql.con.ioerror:Um erro de IO ocorreu ao enviar para o backend - {0}
-postgresql.con.kerb4:Autenticação Kerberos 4 não é suportada por este driver.
-postgresql.con.kerb5:Autenticação Kerberos 5 não é suportada por este driver.
-postgresql.con.misc:Um erro de conexão ocorreu: {0}
-postgresql.con.multres:Não pode manipular múltiplos grupos de resultados.
-postgresql.con.pass:A propriedade senha não foi informada. Ela é obrigatória.
-postgresql.con.refused:Conexão negada. Certifique se o nome da máquina e a porta estão corretos e se o postmaster está aceitando conexões TCP/IP.
-postgresql.con.scm:Autenticação por credenciais SCM não é suportada por este driver.
-postgresql.con.setup:Erro de protocolo. Configuração da sessão falhou.
-postgresql.con.sslfail:Um erro ocorreu quando se estabelecia uma conexão SSL.
-postgresql.con.sslnotsupported:O servidor não suporta SSL
-postgresql.con.strobj:O objeto não pôde ser armazenado. Certifique se algumas tabelas já foram criadas no banco de dados.
-postgresql.con.strobjex:Falhou ao armazenar objeto - {0}
-postgresql.con.toolong:A Instrução SQL é muito longa - {0}
-postgresql.con.isolevel:Nível de isolamento de transação {0} não é suportado.
-postgresql.con.tuple:Tupla recebida antes de MetaData.
-postgresql.con.type:Tipo de Resposta Desconhecido {0}
-postgresql.con.user:A propriedade usuário não foi informada. Ela é obrigatória.
-postgresql.error.detail:Detalhe: {0}
-postgresql.error.hint:Dica: {0}
-postgresql.error.position:Posição: {0}
-postgresql.error.where:Onde: {0}
-postgresql.error.location:Localização: {0}
-postgresql.fp.error:Chamada ao FastPath retornou {0}
-postgresql.fp.expint:Chamada ao Fastpath {0} - Nenhum resultado foi retornado e nós esperávamos um inteiro.
-postgresql.fp.protocol:Erro do protocolo FastPath: {0}
-postgresql.fp.send:Falhou ao enviar chamada ao fastpath {0} {1}
-postgresql.fp.unknown:A função do fastpath {0} é desconhecida.
-postgresql.geo.box:Conversão para box falhou - {0}
-postgresql.geo.circle:Conversão para circle falhou - {0}
-postgresql.geo.line:Conversão para line falhou - {0}
-postgresql.geo.lseg:Conversão para lseg falhou - {0}
-postgresql.geo.path:Não pode dizer se caminho está aberto ou fechado.
-postgresql.geo.point:Conversão para point falhou - {0}
-postgresql.jvm.version:O arquivo postgresql.jar não contém as classes JDBC corretas para esta JVM. Tente recontruí-lo. Se falhar, tente forçar especificando a versão na linha de comando utilizando o argumento -Djava.version=1.1 ou -Djava.version=1.2\nExceção foi {0}
-postgresql.lo.init:falhou ao inicializar API de Objetos Grandes
-postgresql.metadata.unavailable:Metadata indisponível.
-postgresql.money:conversão para money falhou - {0}
-postgresql.noupdate:Esse ResultSet não é atualizável.
-postgresql.notsensitive:Esse ResultSet não é sensitivo a atualizações em tempo real depois que a consulta foi executada.
-postgresql.psqlnotimp:O backend atualmente não suporta esta característica.
-postgresql.prep.is:InputStream como parâmetro não é suportado
-postgresql.prep.param:Nenhum valor especificado para o parâmetro {0}
-postgresql.prep.range:Índice do parâmetro fora do intervalo.
-postgresql.prep.type:Valor de Tipos desconhecidos.
-postgresql.res.badbigdec:BigDecimal inválido {0}
-postgresql.res.badbyte:Byte inválido {0}
-postgresql.res.baddate:Formato de Data inválido {1} {0}
-postgresql.res.baddouble:Double inválido {0}
-postgresql.res.badfloat:Float inválido {0}
-postgresql.res.badint:Integer inválido {0}
-postgresql.res.badlong:Long inválido {0}
-postgresql.res.badshort:Short inválido {0}
-postgresql.res.badtime:Time inválido {0}
-postgresql.res.badtimestamp:Formato de Timestamp inválido {1} {0}
-postgresql.res.closed:Conjunto de resultados está fechado.  Operação não é permitida.
-postgresql.res.colname:O nome da coluna {0} não foi encontrado.
-postgresql.res.colrange:O índice da coluna está fora do intervalo.
-postgresql.res.nextrequired:Conjunto de resultados não está posicionado corretamente, talvez você precise chamar next().
-postgresql.serial.interface:Você não pode serializar uma interface.
-postgresql.serial.namelength:Tamanho do nome da Classe e do Pacote não pode ser maior do que 64 caracteres. {0} tem {1} caracteres.
-postgresql.serial.noclass:Nenhuma classe encontrada para {0}
-postgresql.serial.table:A tabela para {0} não está no banco de dados. Entre em contato com o DBA, e pergunte se o banco de dados não está em um estado inconsistente.
-postgresql.serial.underscore:Nomes das Classes não podem ter _. Você forneceu {0}.
-postgresql.stat.batch.error:Entrada em lote {0} {1} foi abortada. Chame getNextException() para ver a causa.
-postgresql.stat.noresult:Nenhum resultado foi retornado pela consulta.
-postgresql.stat.result:Um resultado foi retornado quando nenhum era esperado.
-postgresql.stream.eof:O backend fechou a conexão. Possivelemte uma ação que você executou tenha causado o fechamento.
-postgresql.stream.flush:Um erro de I/O ocorreu ao liberar a saída - {0}
-postgresql.stream.ioerror:Um erro de I/O ocorreu ao ler do backend - {0}
-postgresql.stream.toomuch:Muitos dados foram recebidos.
-postgresql.unusual:Alguma coisa anormal ocorreu para causar a falha do driver. Por favor reporte essa exceção: {0}
-postgresql.unimplemented:Este método não foi implementado ainda.
-postgresql.unexpected:Um resultado inesperado foi retornado pela consulta.
-postgresql.updateable.notupdateable: Conjunto de Resultados não é atualizável. A consulta que gerou esse conjunto de resultados deve selecionar somente uma tabela, e deve selecionar todas as chaves primárias daquela tabela. Veja a especificação na API do JDBC 2.1, seção 5.6 para mais informação.
-postgresql.updateable.oninsertrow:Não pode chamar deleteRow() quando estiver inserindo registro
-postgresql.updateable.emptydelete:Não pode utilizar deleteRow() em um conjunto de resultados vazio
-postgresql.updateable.beforestartdelete:Antes do início do conjunto de resultados. Não pode chamar deleteRow().
-postgresql.updateable.afterlastdelete:Depois do fim do conjunto de resultados. Não pode chamar deleteRow().
-postgresql.updateable.notoninsertrow:Não está inserindo um registro.
-postgresql.updateable.inputstream:Fluxo de Entrada é nulo.
-postgresql.updateable.ioerror:Erro de Fluxo de Entrada - {0}
-postgresql.call.noreturntype:Uma Instrução Executável foi declarada mas nenhuma chamada a 'registerOutParameter (1, <algum_tipo>)' foi feita.
-postgresql.call.noinout:PostgreSQL só suporta função que retorna valor [@ 1] (nenhum argumento OUT ou INOUT)
-postgresql.call.procasfunc:Esta Instrução [{0}] define uma chamada a um procedimento (necessita ?= chamar <stmt> para ser considerado uma função.
-postgresql.call.malformed:Instrução mal formada [{0}] uso : {1}
-postgresql.call.funcover:Não pode executar Consulta porque uma chamada a setXXX (1, ..) foi feita onde argumento 1 é o valor retornado pela função.
-postgresql.call.wrongget:Parâmetro do tipo {0} foi registrado mas uma chamada a get{1} (tiposql={2}) foi feita.
-postgresql.call.noreturnval:Uma Função foi executado e nada foi retornado.
-postgresql.call.wrongrtntype:Uma Função foi executada e o retorno foi do tipo ({0}) contudo tipo={1} foi registrado.
-postgresql.input.fetch.gt0:Tamanho da busca deve ser um valor maior ou igual a 0.
-postgresql.input.query.gt0:Tempo de espera da Consulta deve ser um valor maior ou igual a 0.
-postgresql.input.rows.gt0:Número máximo de linhas deve ser um valor maior ou igual a 0.
-postgresql.format.baddate:A data informada: {0} não combina com o formato requerido: {1}.
-postgresql.format.badtime:A hora informada: {0} não combina com o formato requerido: {1}.
-postgresql.format.badtimestamp:O timestamp informado {0} não combina com o formato requerido: {1}.
-postgresql.input.field.gt0:O tamanho máximo do campo deve ser um valor maior ou igual a 0.
diff --git a/src/interfaces/jdbc/org/postgresql/errors_ru.properties b/src/interfaces/jdbc/org/postgresql/errors_ru.properties
deleted file mode 100644 (file)
index 51271b6..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-# errors_ru.properties
-# Translation into Russian, (C) 2003 Serguei A. Mokhov, mokhov@cs.concordia.ca
-#
-# ChangeLog:
-#
-# - October 12, 2003 - ... Initial translation
-#
-postgresql.arr.range:Индекс массива вне диапазона.
-postgresql.drv.version:Внутренняя ошибка. Пожалуйста перекомпилируйте драйвер.
-postgresql.con.auth:Тип аутентификации {0} не поддерживается. Проверьте что вы сконфигурировали файл pg_hba.conf чтобы включить IP адреса клиентов или подсеть. Также удостовертесь что он использует схему аутентификации поддерживаемую драйвером.
-postgresql.con.authfail:Ошибка при получении запроса на аутентификацию.
-postgresql.con.backend:Запуск бэкенда не удался: {0}
-postgresql.con.call:Callable Statements are not supported at this time.
-postgresql.con.invalidchar:Invalid character data was found.  This is most likely caused by stored data containing characters that are invalid for the character set the database was created in.  The most common example of this is storing 8bit data in a SQL_ASCII database.
-postgresql.con.closed:Connection is closed.  Operation is not permitted.
-postgresql.con.creobj:Не удалось создать объект для {0} {1}
-postgresql.con.failed:The connection attempt failed because {0}
-postgresql.con.failed.bad.encoding:The connection attempt failed trying to get the server encoding
-postgresql.con.failed.bad.autocommit:The connection attempt failed trying to get the autocommit status
-postgresql.con.fathom:Unable to fathom update count {0}
-postgresql.con.garbled:Garbled data received.
-postgresql.con.ioerror:An IO erro occured while sending to the backend - {0}
-postgresql.con.kerb4:Kerberos 4 authentication is not supported by this driver.
-postgresql.con.kerb5:Kerberos 5 authentication is not supported by this driver.
-postgresql.con.misc:A connection error has occurred: {0}
-postgresql.con.multres:Cannot handle multiple result groups.
-postgresql.con.pass:The password property is missing. It is mandatory.
-postgresql.con.refused:Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
-postgresql.con.scm:SCM credentials authentication is not supported by this driver.
-postgresql.con.setup:Protocol error. Session setup failed.
-postgresql.con.sslfail:An error occured while getting setting up the SSL connection.
-postgresql.con.sslnotsupported:The server does not support SSL
-postgresql.con.strobj:The object could not be stored. Check that any tables required have already been created in the database.
-postgresql.con.strobjex:Failed to store object - {0}
-postgresql.con.toolong:The SQL Statement is too long - {0}
-postgresql.con.isolevel:Transaction isolation level {0} is not supported.
-postgresql.con.tuple:Tuple received before MetaData.
-postgresql.con.type:Unknown Response Type {0}
-postgresql.con.user:The user property is missing. It is mandatory.
-postgresql.error.detail:Подробности: {0}
-postgresql.error.hint:Подсказка: {0}
-postgresql.error.position:Позиция: {0}
-postgresql.error.where:Где: {0}
-postgresql.error.location:Местонахождение: {0}
-postgresql.fp.error:FastPath call returned {0}
-postgresql.fp.expint:Fastpath call {0} - No result was returned and we expected an integer.
-postgresql.fp.protocol:FastPath protocol error: {0}
-postgresql.fp.send:Failed to send fastpath call {0} {1}
-postgresql.fp.unknown:The fastpath function {0} is unknown.
-postgresql.geo.box:Conversion of box failed - {0}
-postgresql.geo.circle:Conversion of circle failed - {0}
-postgresql.geo.line:Conversion of line failed - {0}
-postgresql.geo.lseg:Conversion of lseg failed - {0}
-postgresql.geo.path:Cannot tell if path is open or closed.
-postgresql.geo.point:Conversion of point failed - {0}
-postgresql.jvm.version:The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try rebuilding. If that fails, try forcing the version supplying it to the command line using the argument -Djava.version=1.1 or -Djava.version=1.2\nException thrown was {0}
-postgresql.lo.init:failed to initialise LargeObject API
-postgresql.metadata.unavailable:Metadata unavailable.
-postgresql.money:conversion of money failed - {0}
-postgresql.noupdate:This ResultSet is not updateable.
-postgresql.notsensitive:This ResultSet is not sensitive to realtime updates after the query has run.
-postgresql.psqlnotimp:The backend currently does not support this feature.
-postgresql.prep.is:InputStream as parameter not supported
-postgresql.prep.param:No value specified for parameter {0}
-postgresql.prep.range:Parameter index out of range.
-postgresql.prep.type:Unknown Types value.
-postgresql.res.badbigdec:Bad BigDecimal {0}
-postgresql.res.badbyte:Плохой Byte {0}
-postgresql.res.baddate:Bad Date Format at {0} in {1}
-postgresql.res.baddouble:Плохой Double {0}
-postgresql.res.badfloat:Плохой Float {0}
-postgresql.res.badint:Плохой Integer {0}
-postgresql.res.badlong:Плохой Long {0}
-postgresql.res.badshort:Плохой Short {0}
-postgresql.res.badtime:Bad Time {0}
-postgresql.res.badtimestamp:Bad Timestamp Format at {0} in {1}
-postgresql.res.closed:Result set is closed.  Operation is not permitted.
-postgresql.res.colname:The column name {0} not found.
-postgresql.res.colrange:Индекс колонки вне диапазона.
-postgresql.res.nextrequired:Result set not positioned properly, perhaps you need to call next().
-postgresql.serial.interface:Нельзя сериализовать интерфейс.
-postgresql.serial.namelength:Class & Package name length cannot be longer than 64 characters. {0} is {1} characters.
-postgresql.serial.noclass:Класс не найден для {0}
-postgresql.serial.table:The table for {0} is not in the database. Contact the DBA, as the database is in an inconsistent state.
-postgresql.serial.underscore:Class names may not have _ in them. You supplied {0}.
-postgresql.stat.batch.error:Batch entry {0} {1} was aborted. Call getNextException() to see the cause.
-postgresql.stat.noresult:No results were returned by the query.
-postgresql.stat.result:A result was returned when none was expected.
-postgresql.stream.eof:The backend has broken the connection. Possibly the action you have attempted has caused it to close.
-postgresql.stream.flush:An I/O error has occured while flushing the output - {0}
-postgresql.stream.ioerror:An I/O error occured while reading from backend - {0}
-postgresql.stream.toomuch:Too much data was received.
-postgresql.unusual:Something unusual has occured to cause the driver to fail. Please report this exception: {0}
-postgresql.unimplemented:This method is not yet implemented.
-postgresql.unexpected:An unexpected result was returned by a query.
-postgresql.updateable.notupdateable: Result Set not updateable. The query that generated this result set must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.
-postgresql.updateable.oninsertrow:Can not call deleteRow() when on insert row
-postgresql.updateable.emptydelete:Can't deleteRow() on empty result set
-postgresql.updateable.beforestartdelete:Before start of result set. Can not call deleteRow().
-postgresql.updateable.afterlastdelete:After end of result set. Can not call deleteRow().
-postgresql.updateable.notoninsertrow:Not on insert row.
-postgresql.updateable.inputstream:Input Stream is null.
-postgresql.updateable.ioerror:ошибка Input Stream - {0}
-postgresql.call.noreturntype:A CallableStatement Function was declared but no call to 'registerOutParameter (1, <some_type>)' was made.
-postgresql.call.noinout:PostgreSQL only supports function return value [@ 1] (no OUT or INOUT arguments)
-postgresql.call.procasfunc:This Statement [{0}] defines a procedure call (needs ?= call <stmt> to be considered a function.
-postgresql.call.malformed:Malformed stmt [{0}] usage : {1}
-postgresql.call.funcover:Cannot execute Query a call to setXXX (1, ..) was made where argument 1 is the return value of a function.
-postgresql.call.wrongget:Parameter of type {0} was registered but call to get{1} (sqltype={2}) was made.
-postgresql.call.noreturnval:A CallableStatement Function was executed with nothing returned.
-postgresql.call.wrongrtntype:A CallableStatement Function was executed and the return was of type ({0}) however type={1} was registered.
-postgresql.input.fetch.gt0:Fetch size must be a value greater than or equal to 0.
-postgresql.input.query.gt0:Query Timeout must be a value greater than or equal to 0.
-postgresql.input.rows.gt0:Maximum number of rows must be a value greater than or equal to 0.
-postgresql.format.baddate:The date given: {0} does not match the format required: {1}.
-postgresql.format.badtime:The time given: {0} does not match the format required: {1}.
-postgresql.format.badtimestamp:The timestamp given {0} does not match the format required: {1}.
-postgresql.input.field.gt0:The maximum field size must be a value greater than or equal to 0.
diff --git a/src/interfaces/jdbc/org/postgresql/errors_zh_TW.properties b/src/interfaces/jdbc/org/postgresql/errors_zh_TW.properties
deleted file mode 100644 (file)
index eed4a40..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-# 2003-11-25 Zhenbang Wei <forth@zbwei.net>
-postgresql.arr.range:\u9663\u5217\u7d22\u5f15\u8d85\u904e\u8a31\u53ef\u7bc4\u570d\u3002
-postgresql.drv.version:\u767c\u751f\u5167\u90e8\u932f\u8aa4\uff0c\u8acb\u91cd\u65b0\u7de8\u8b6f\u9a45\u52d5\u7a0b\u5f0f\u3002
-postgresql.con.auth:\u4e0d\u652f\u63f4{0}\u8a8d\u8b49\uff0c\u8acb\u78ba\u5b9a\u60a8\u5df2\u7d93\u5c07\u5ba2\u6236\u7aef\u7684IP\u4f4d\u5740\u6216\u7db2\u8def\u5340\u6bb5\u4ee5\u53ca\u9a45\u52d5\u7a0b\u5f0f\u6240\u652f\u63f4\u7684\u8a8d\u8b49\u985e\u578b\u52a0\u5165pg_hba.conf\u3002
-postgresql.con.authfail:\u8b80\u53d6\u8a8d\u8b49\u8acb\u6c42\u6642\u767c\u751f\u932f\u8aa4\u3002
-postgresql.con.backend:\u5f8c\u7aef\u555f\u52d5\u5931\u6557\uff1a{0}
-postgresql.con.call:\u76ee\u524d\u4e0d\u652f\u63f4CallableStatement\u3002
-postgresql.con.invalidchar:\u767c\u73fe\u4e0d\u5408\u6cd5\u7684\u5b57\u5143\uff0c\u53ef\u80fd\u7684\u539f\u56e0\u662f\u6b32\u5132\u5b58\u7684\u8cc7\u6599\u4e2d\u5305\u542b\u8cc7\u6599\u5eab\u7684\u5b57\u5143\u96c6\u4e0d\u652f\u63f4\u7684\u5b57\u78bc\uff0c\u5176\u4e2d\u6700\u5e38\u898b\u4f8b\u5b50\u7684\u5c31\u662f\u5c078\u4f4d\u5143\u8cc7\u6599\u5b58\u5165\u4f7f\u7528SQL_ASCII\u7684\u8cc7\u6599\u5eab\u3002
-postgresql.con.closed:\u9023\u7dda\u5df2\u95dc\u9589\uff0c\u4e0d\u5141\u8a31\u64cd\u4f5c\u3002
-postgresql.con.creobj:\u70ba{0} {1}\u5efa\u7acb\u7269\u4ef6\u5931\u6557
-postgresql.con.failed:\u9023\u7dda\u5931\u6557\uff0c\u56e0\u70ba{0}
-postgresql.con.failed.bad.encofing:\u9023\u7dda\u5931\u6557\uff0c\u7121\u6cd5\u53d6\u5f97\u4f3a\u670d\u5668\u4f7f\u7528\u7684\u7de8\u78bc
-postgresql.con.failed.bad.autocommit:\u9023\u7dda\u5931\u6557\uff0c\u7121\u6cd5\u53d6\u5f97autocommit\u72c0\u614b
-postgresql.con.fathom:\u7121\u6cd5\u53d6\u5f97\u66f4\u65b0\u7684\u8cc7\u6599\u7b46\u6578{0}
-postgresql.con.garbled:\u6536\u5230\u7121\u6548\u7684\u8cc7\u6599\u3002
-postgresql.con.ioerror:\u50b3\u9001\u8cc7\u6599\u81f3\u5f8c\u7aef\u6642\u767c\u751fIO\u932f\u8aa4 - {0}
-postgresql.con.kerb4:\u9a45\u52d5\u7a0b\u5f0f\u4e0d\u652f\u63f4Kerberos 4\u8a8d\u8b49\u3002
-postgresql.con.kerb5:\u9a45\u52d5\u7a0b\u5f0f\u4e0d\u652f\u63f4Kerberos 5\u8a8d\u8b49\u3002
-postgresql.con.misc:\u767c\u751f\u9023\u7dda\u932f\u8aa4\uff1a{0}
-postgresql.con.multres:\u7121\u6cd5\u8655\u7406\u591a\u91cd\u67e5\u8a62\u7d50\u679c\u3002
-postgresql.con.pass:\u6c92\u6709password\u5c6c\u6027\uff0c\u9019\u9805\u5c6c\u6027\u662f\u5fc5\u9700\u7684\u3002
-postgresql.con.refused:\u62d2\u7d55\u9023\u7dda\uff0c\u8acb\u6aa2\u67e5\u4e3b\u6a5f\u540d\u7a31\u548c\u57e0\u865f\uff0c\u4e26\u78ba\u5b9apostmaster\u555f\u52d5\u6642\u4f7f\u7528\u4e86-i\u53c3\u6578\u958b\u555fTCP/IP\u7db2\u8def\u529f\u80fd\u3002
-postgresql.con.scm:\u9a45\u52d5\u7a0b\u5f0f\u4e0d\u652f\u63f4SCM\u8a8d\u8b49\u3002
-postgresql.con.setup:\u901a\u8a0a\u5354\u5b9a\u932f\u8aa4\uff0cSession\u521d\u59cb\u5316\u5931\u6557\u3002
-postgresql.con.sslfail:\u9032\u884cSSL\u9023\u7dda\u6642\u767c\u751f\u932f\u8aa4\u3002
-postgresql.con.sslnotsupported:\u4f3a\u670d\u5668\u4e0d\u652f\u63f4SSL\u9023\u7dda\u3002
-postgresql.con.strobj:\u7121\u6cd5\u5132\u5b58\u7269\u4ef6\uff0c\u8acb\u78ba\u5b9a\u5df2\u7d93\u5728\u8cc7\u6599\u5eab\u4e2d\u5efa\u7acb\u8981\u4f7f\u7528\u7684\u8cc7\u6599\u8868\u3002
-postgresql.con.strobjex:\u5132\u5b58\u7269\u4ef6\u5931\u6557 - {0}
-postgresql.con.toolong:SQL \u6558\u8ff0\u904e\u9577 - {0}
-postgresql.con.isolevel:\u4e0d\u652f\u63f4\u4ea4\u6613\u9694\u7d55\u7b49\u7d1a{0}\u3002
-postgresql.con.tuple:Tuple\u5728MetaData\u4e4b\u524d\u50b3\u56de\u3002
-postgresql.con.type:\u4e0d\u660e\u7684\u56de\u61c9\u985e\u578b{0}
-postgresql.con.user:\u6c92\u6709user\u5c6c\u6027\uff0c\u9019\u9805\u5c6c\u6027\u662f\u5fc5\u9700\u7684\u3002
-postgresql.error.detail:Detail: {0}
-postgresql.error.hint:Hint: {0}
-postgresql.error.position:Position: {0}
-postgresql.error.where:Where: {0}
-postgresql.error.location:Location: {0}
-postgresql.fp.error:FastPath\u547c\u53eb\u50b3\u56de{0}
-postgresql.fp.expint:Fastpath\u547c\u53eb{0} - \u6c92\u6709\u50b3\u56de\u503c\uff0c\u61c9\u8a72\u50b3\u56de\u4e00\u500b\u6574\u6578\u3002
-postgresql.fp.protocol:FastPath\u5354\u5b9a\u932f\u8aa4\uff1a{0}
-postgresql.fp.send:\u50b3\u9001fastpath\u547c\u53eb{0} {1}\u5931\u6557
-postgresql.fp.unknown:\u4e0d\u660e\u7684fastpath\u51fd\u5f0f{0}\u3002
-postgresql.geo.box:\u8f49\u63dbbox\u5931\u6557 - {0}
-postgresql.geo.circle:\u8f49\u63dbcircle\u5931\u6557 - {0}
-postgresql.geo.line:\u8f49\u63dbline\u5931\u6557 - {0}
-postgresql.geo.lseg:\u8f49\u63dblseg\u5931\u6557 - {0}
-postgresql.geo.path:\u7121\u6cd5\u5f97\u77e5path\u662f\u95dc\u9589\u6216\u958b\u555f\u3002
-postgresql.geo.point:\u8f49\u63dbpoint\u5931\u6557 - {0}
-postgresql.jvm.version:\u5728postgresql.jar\u4e2d\u627e\u4e0d\u5230\u6b63\u78ba\u7684JDBC\u985e\u5225\u4f9bJVM\u4f7f\u7528\uff0c\u8acb\u91cd\u65b0\u7de8\u8b6f\uff0c\u5982\u679c\u4ecd\u7136\u767c\u751f\u932f\u8aa4\uff0c\u8acb\u5728\u57f7\u884c\u6642\u7528-Djava.version=1.1\u6216-Djava.version=1.2\u5f37\u5236\u6307\u5b9a\u7248\u672c\n\u7522\u751f\u7684\u4f8b\u5916\u662f{0}
-postgresql.lo.init:\u521d\u59cb\u5316LargeObject API\u5931\u6557\u3002
-postgresql.metadata.unavailable:\u7121\u6cd5\u53d6\u5f97Metadata\u3002
-postgresql.money:\u8f49\u63dbmoney\u5931\u6557 - {0}\u3002
-postgresql.noupdate:\u67e5\u8a62\u7d50\u679c\u4e0d\u53ef\u66f4\u65b0\u3002
-postgresql.notsensitive:\u67e5\u8a62\u7d50\u679c\u4e0d\u80fd\u5373\u6642\u53cd\u6620\u8b8a\u52d5\u7684\u8cc7\u6599\u3002
-postgresql.psqlnotimp:\u5f8c\u7aef\u76ee\u524d\u4e0d\u652f\u63f4\u9019\u9805\u529f\u80fd\u3002
-postgresql.prep.is:\u4e0d\u652f\u63f4\u4ee5InputStream\u505a\u70ba\u53c3\u6578\u3002
-postgresql.prep.param:\u672a\u8a2d\u5b9a\u53c3\u6578{0}\u7684\u5167\u5bb9\u3002
-postgresql.prep.range:\u53c3\u6578\u7d22\u5f15\u8d85\u904e\u8a31\u53ef\u7bc4\u570d\u3002
-postgresql.prep.type:\u4e0d\u660e\u7684\u578b\u5225\u3002
-postgresql.res.badbigdec:\u932f\u8aa4\u7684BigDecimal {0}
-postgresql.res.badbyte:\u932f\u8aa4\u7684Byte {0}
-postgresql.res.baddate:\u932f\u8aa4\u7684Date\u683c\u5f0f {1} \u65bc {0}
-postgresql.res.baddouble:\u932f\u8aa4\u7684Double {0}
-postgresql.res.badfloat:\u932f\u8aa4\u7684Float {0}
-postgresql.res.badint:\u932f\u8aa4\u7684Integer {0}
-postgresql.res.badlong:\u932f\u8aa4\u7684Long {0}
-postgresql.res.badshort:\u932f\u8aa4\u7684Short {0}
-postgresql.res.badtime:\u932f\u8aa4\u7684Time {0}
-postgresql.res.badtimestamp:\u932f\u8aa4\u7684Timestamp\u683c\u5f0f{1}\u65bc{0}
-postgresql.res.closed:ResultSet\u5df2\u7d93\u95dc\u9589\uff0c\u4e0d\u5141\u8a31\u5176\u5b83\u64cd\u4f5c\u3002
-postgresql.res.colname:\u627e\u4e0d\u5230\u6b04\u4f4d\u540d\u7a31{0}\u3002
-postgresql.res.colrange:\u6b04\u4f4d\u7d22\u5f15\u8d85\u904e\u8a31\u53ef\u7bc4\u570d\u3002
-postgresql.res.nextrequired:\u67e5\u8a62\u7d50\u679c\u6307\u6a19\u4f4d\u7f6e\u4e0d\u6b63\u78ba\uff0c\u60a8\u4e5f\u8a31\u9700\u8981\u547c\u53ebResultSet\u7684next()\u65b9\u6cd5\u3002
-postgresql.serial.interface:\u4e0d\u5141\u8a31\u5c07\u4ecb\u9762\u5e8f\u5217\u5316\u3002
-postgresql.serial.namelength:\u985e\u5225\u548c\u5305\u88dd\u7684\u540d\u7a31\uff0c\u9577\u5ea6\u4e0d\u80fd\u8d85\u904e32\u5b57\u5143\uff0c{0}\u7684\u9577\u5ea6\u662f{1}\u5b57\u5143\u3002
-postgresql.serial.noclass:\u627e\u4e0d\u5230\u985e\u5225{0}\u3002
-postgresql.serial.table:\u8655\u7406{0}\u6642\u627e\u4e0d\u5230\u8cc7\u6599\u8868\uff0c\u8cc7\u6599\u5eab\u72c0\u614b\u4e0d\u6b63\u5e38\uff0c\u8acb\u806f\u7d61DBA\u8655\u7406\u3002
-postgresql.serial.underscore:\u985e\u5225\u540d\u7a31\u4e0d\u80fd\u4f7f\u7528_\u5b57\u5143\uff0c\u60a8\u6240\u7528\u7684\u540d\u7a31\u662f{0}\u3002
-postgresql.stat.batch.error:\u6279\u6b21\u8655\u7406\u5ffd\u7565{0} {1}\u3002
-postgresql.stat.noresult:\u6c92\u6709\u50b3\u56de\u4efb\u4f55\u67e5\u8a62\u7d50\u679c\u3002
-postgresql.stat.result:\u50b3\u56de\u9810\u671f\u5916\u7684\u7d50\u679c\u3002
-postgresql.stream.eof:\u5f8c\u7aef\u7d50\u675f\u9023\u7dda\uff0c\u4e5f\u8a31\u662f\u56e0\u70ba\u60a8\u6240\u57f7\u884c\u7684\u52d5\u4f5c\u5c0e\u81f4\u9023\u7dda\u4e2d\u65b7\u3002
-postgresql.stream.flush:\u9001\u51fa\u8cc7\u6599\u6642\u767c\u751fI/O\u932f\u8aa4 - {0}
-postgresql.stream.ioerror:\u5f9e\u5f8c\u7aef\u8b80\u53d6\u8cc7\u6599\u6642\u767c\u751fI/O\u932f\u8aa4 - {0}
-postgresql.stream.toomuch:\u63a5\u6536\u904e\u591a\u8cc7\u6599\u3002
-postgresql.unusual:\u4e0d\u660e\u7684\u539f\u56e0\u5c0e\u81f4\u9a45\u52d5\u7a0b\u5f0f\u767c\u751f\u932f\u8aa4\uff0c\u8acb\u56de\u5831\u9019\u500b\u4f8b\u5916\uff1a{0}
-postgresql.unimplemented:\u9019\u500b\u65b9\u6cd5\u5c1a\u672a\u5be6\u4f5c\u3002
-postgresql.unexpected:\u50b3\u56de\u975e\u9810\u671f\u7684\u67e5\u8a62\u7d50\u679c\u3002
-postgresql.updateable.notupdateable:\u4e0d\u53ef\u66f4\u65b0\u7684ResultSet\u3002\u7528\u4f86\u7522\u751f\u9019\u500bResultSet\u7684SQL\u6307\u4ee4\u53ea\u80fd\u64cd\u4f5c\u4e00\u500b\u8cc7\u6599\u8868\uff0c\u4e26\u4e14\u5fc5\u9700\u9078\u64c7\u4e3b\u9375\u6b04\u4f4d\uff0c\u8acb\u53c3\u95b1JDBC 2.1 API\u898f\u683c\u66f85.6\u7bc0\u3002
-postgresql.updateable.oninsertrow:\u6b63\u5728\u65b0\u589e\u4e00\u7b46\u8cc7\u6599\u6642\u4e0d\u884c\u547c\u53ebdeleteRow()\u65b9\u6cd5\u3002
-postgresql.updateable.emptydelete:\u4e0d\u884c\u5728\u7a7a\u7684ResultSet\u4f7f\u7528deleteRow()\u65b9\u6cd5\u3002
-postgresql.updateable.beforestartdelete:\u4e0d\u884c\u5728ResultSet\u7684\u7b2c\u4e00\u7b46\u8cc7\u6599\u4e4b\u524d\u547c\u53ebdeleteRow()\u65b9\u6cd5\u3002
-postgresql.updateable.afterlastdelete:\u4e0d\u884c\u5728ResultSet\u7684\u6700\u5f8c\u4e00\u7b46\u8cc7\u6599\u4e4b\u5f8c\u547c\u53ebdeleteRow()\u65b9\u6cd5\u3002
-postgresql.updateable.notoninsertrow:\u4e0d\u5728\u65b0\u589e\u7684\u8cc7\u6599\u5217\u4e0a\u3002
-postgresql.updateable.inputstream:InputStream\u662fnull\u3002
-postgresql.updateable.ioerror:InputStream\u932f\u8aa4\u3002
-postgresql.call.noreturntype:\u5df2\u7d93\u5ba3\u544aCallableStatement\u51fd\u5f0f\uff0c\u4f46\u662f\u5c1a\u672a\u547c\u53eb'registerOutParameter (1, <some_type>)'\u3002
-postgresql.call.noinout:PostgreSQL\u53ea\u652f\u63f4\u50b3\u56de\u503c\u70ba[@ 1]\u7684\u51fd\u5f0f(\u6c92\u6709OUT\u6216INPUT\u5f15\u6578)\u3002
-postgresql.call.procasfunc:\u6558\u8ff0[{0}]\u5b9a\u7fa9\u4e86\u4e00\u500b\u9810\u5132\u7a0b\u5e8f(\u547c\u53eb\u51fd\u5f0f\u9700\u8981\u4f7f\u7528?= call <stmt>\u683c\u5f0f)\u3002
-postgresql.call.malformed:\u932f\u8aa4\u7684\u6558\u8ff0[{0}]\u7528\u6cd5\uff1a{1}
-postgresql.call.funcover:\u7121\u6cd5\u57f7\u884c\u67e5\u8a62\uff0c\u547c\u53eb\u4e86setXXX(1, ..)\uff0c\u4f46\u662f\u7b2c\u4e00\u500b\u5f15\u6578\u662f\u51fd\u5f0f\u7684\u50b3\u56de\u503c\u3002
-postgresql.call.wrongget:\u5df2\u8a3b\u518a\u53c3\u6578\u578b\u5225{0}\uff0c\u4f46\u662f\u53c8\u547c\u53eb\u4e86get{1}(sqltype={2})\u3002
-postgresql.call.noreturnval:CallableStatement\u57f7\u884c\u51fd\u5f0f\u5f8c\u6c92\u6709\u50b3\u56de\u503c\u3002
-postgresql.call.wrongrtntype:CallableStatement\u57f7\u884c\u51fd\u5f0f\u5f8c\u50b3\u56de\u503c\u7684\u578b\u5225\u662f{0}\uff0c\u4f46\u662f\u8a3b\u518a\u7684\u578b\u5225\u662f{1}\u3002
-postgresql.input.fetch.gt0:\u8cc7\u6599\u8b80\u53d6\u7b46\u6578(fetch size)\u5fc5\u9808\u5927\u65bc\u6216\u7b49\u65bc0\u3002
-postgresql.input.query.gt0:\u67e5\u8a62\u903e\u6642\u7b49\u5019\u6642\u9593\u5fc5\u9808\u5927\u65bc\u6216\u7b49\u65bc0\u3002
-postgresql.input.rows.gt0:\u6700\u5927\u8cc7\u6599\u8b80\u53d6\u7b46\u6578\u5fc5\u9808\u5927\u65bc\u6216\u7b49\u65bc0\u3002
-postgresql.format.baddate:\u50b3\u5165\u7684\u65e5\u671f{0}\u8207\u8981\u6c42\u7684\u683c\u5f0f{1}\u4e0d\u7b26\u3002
-postgresql.format.badtime:\u50b3\u5165\u7684\u6642\u9593{0}\u8207\u8981\u6c42\u7684\u683c\u5f0f{1}\u4e0d\u7b26\u3002
-postgresql.format.badtimestamp:\u50b3\u5165\u7684\u6642\u9593\u6233\u8a18{0}\u8207\u8981\u6c42\u7684\u683c\u5f0f{1}\u4e0d\u7b26\u3002
-postgresql.input.field.gt0:\u6700\u5927\u6b04\u4f4d\u5bb9\u91cf\u5fc5\u9808\u5927\u65bc\u6216\u7b49\u65bc0\u3002
diff --git a/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java b/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java
deleted file mode 100644 (file)
index e883615..0000000
+++ /dev/null
@@ -1,430 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * Fastpath.java
- *     This class implements the Fastpath api.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java,v 1.20 2003/12/18 03:27:14 davec 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 org.postgresql.core.BaseConnection;
-import org.postgresql.core.PGStream;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-/*
- * 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>It is based around the file src/interfaces/libpq/fe-exec.c
- *
- */
-public class Fastpath
-{
-       // This maps the functions names to their id's (possible unique just
-       // to a connection).
-       protected Hashtable func = new Hashtable();
-
-       protected BaseConnection conn;          // our connection
-       protected PGStream stream;      // the network stream
-
-       /*
-        * Initialises the fastpath system
-        *
-        * @param conn BaseConnection to attach to
-        * @param stream The network stream to the backend
-        */
-       public Fastpath(BaseConnection conn, PGStream stream)
-       {
-               this.conn = conn;
-               this.stream = stream;
-       }
-
-       /*
-        * Send a function call to the PostgreSQL backend
-        *
-        * @param fnid Function id
-        * @param resulttype True if the result is an integer, false for other results
-        * @param args FastpathArguments to pass to fastpath
-        * @return null if no data, Integer if an integer result, or byte[] otherwise
-        * @exception SQLException if a database-access error occurs.
-        */
-       public Object fastpath(int fnid, boolean resulttype, FastpathArg[] args) throws SQLException
-       {
-               if (conn.getPGProtocolVersionMajor() == 3) {
-                       return fastpathV3(fnid, resulttype, args);
-               } else {
-                       return fastpathV2(fnid, resulttype, args);
-               }
-       }
-
-       private Object fastpathV3(int fnid, boolean resulttype, FastpathArg[] args) throws SQLException
-       {
-               // added Oct 7 1998 to give us thread safety
-               synchronized (stream)
-               {
-                       // send the function call
-                       try
-                       {
-                               int l_msgLen = 0;
-                               l_msgLen += 16;
-                               for (int i=0;i < args.length;i++)
-                                       l_msgLen += args[i].sendSize();
-                                       
-                               stream.SendChar('F');
-                               stream.SendInteger(l_msgLen,4);
-                               stream.SendInteger(fnid, 4);
-                               stream.SendInteger(1,2);
-                               stream.SendInteger(1,2);
-                               stream.SendInteger(args.length,2);
-
-                               for (int i = 0;i < args.length;i++)
-                                       args[i].send(stream);
-                               
-                               stream.SendInteger(1,2);
-       
-                               // This is needed, otherwise data can be lost
-                               stream.flush();
-
-                       }
-                       catch (IOException ioe)
-                       {
-                               throw new PSQLException("postgresql.fp.send", PSQLState.COMMUNICATION_ERROR, new Integer(fnid), ioe);
-                       }
-
-                       // Now handle the result
-
-                       // Now loop, reading the results
-                       Object result = null; // our result
-                       PSQLException error = null;
-                       int c;
-                       boolean l_endQuery = false;
-                       while (!l_endQuery)
-                       {
-                               c = stream.ReceiveChar();
-
-                               switch (c)
-                               {
-                                       case 'A':       // Asynchronous Notify
-                                               int pid = stream.ReceiveInteger(4);
-                                               String msg = stream.ReceiveString(conn.getEncoding());
-                                               conn.addNotification(new org.postgresql.core.Notification(msg, pid));
-                                               break;
-                                               //------------------------------
-                                               // Error message returned
-                                       case 'E':
-                                               int l_elen = stream.ReceiveIntegerR(4);
-                                               String totalMessage = conn.getEncoding().decode(stream.Receive(l_elen-4));
-                                               PSQLException l_error = PSQLException.parseServerError(totalMessage);
-
-                                               if (error != null) {
-                                                       error.setNextException(l_error);
-                                               } else {
-                                                       error = l_error;
-                                               }
-
-                                               break;
-                                               //------------------------------
-                                               // Notice from backend
-                                       case 'N':
-                                               int l_nlen = stream.ReceiveIntegerR(4);
-                                               conn.addWarning(conn.getEncoding().decode(stream.Receive(l_nlen-4)));
-                                               break;
-
-                                       case 'V':
-                                               int l_msgLen = stream.ReceiveIntegerR(4);
-                                               int l_valueLen = stream.ReceiveIntegerR(4);
-                                               
-                                               if (l_valueLen == -1) 
-                                               {
-                                                       //null value
-                                               }
-                                               else if (l_valueLen == 0)
-                                               {
-                                                       result = new byte[0];
-                                               }
-                                               else 
-                                               {
-                                                       // Return an Integer if
-                                                       if (resulttype)
-                                                               result = new Integer(stream.ReceiveIntegerR(l_valueLen));
-                                                       else
-                                                       {
-                                                               byte buf[] = new byte[l_valueLen];
-                                                               stream.Receive(buf, 0, l_valueLen);
-                                                               result = buf;
-                                                       }
-                                               }
-                                               break;
-
-                                       case 'Z':
-                                               //TODO: use size better
-                                               if (stream.ReceiveIntegerR(4) != 5) throw new PSQLException("postgresql.con.setup", PSQLState.CONNECTION_UNABLE_TO_CONNECT); 
-                                               //TODO: handle transaction status
-                                               char l_tStatus = (char)stream.ReceiveChar();
-                                               l_endQuery = true;
-                                               break;
-
-                                       default:
-                                               throw new PSQLException("postgresql.fp.protocol", PSQLState.COMMUNICATION_ERROR, new Character((char)c));
-                               }
-                       }
-
-                       if ( error != null )
-                               throw error;
-
-                       return result;
-               }
-       }
-
-       private Object fastpathV2(int fnid, boolean resulttype, FastpathArg[] args) throws SQLException
-       {
-               // added Oct 7 1998 to give us thread safety
-               synchronized (stream)
-               {
-                       // send the function call
-                       try
-                       {
-                               // 70 is 'F' in ASCII. Note: don't use SendChar() here as it adds padding
-                               // that confuses the backend. The 0 terminates the command line.
-                               stream.SendInteger(70, 1);
-                               stream.SendInteger(0, 1);
-
-                               stream.SendInteger(fnid, 4);
-                               stream.SendInteger(args.length, 4);
-
-                               for (int i = 0;i < args.length;i++)
-                                       args[i].send(stream);
-
-                               // This is needed, otherwise data can be lost
-                               stream.flush();
-
-                       }
-                       catch (IOException ioe)
-                       {
-                               //Should be sending exception as second arg.
-                               throw new PSQLException("postgresql.fp.send", PSQLState.COMMUNICATION_ERROR, new Integer(fnid), ioe);
-                       }
-
-                       // Now handle the result
-
-                       // Now loop, reading the results
-                       Object result = null; // our result
-                       StringBuffer errorMessage = null;
-                       int c;
-                       boolean l_endQuery = false;
-                       while (!l_endQuery)
-                       {
-                               c = stream.ReceiveChar();
-
-                               switch (c)
-                               {
-                                       case 'A':       // Asynchronous Notify
-                                               //TODO: do something with this
-                                               int pid = stream.ReceiveInteger(4);
-                                               String msg = stream.ReceiveString(conn.getEncoding());
-                                               break;
-
-                                               //------------------------------
-                                               // Error message returned
-                                       case 'E':
-                                               if ( errorMessage == null )
-                                                       errorMessage = new StringBuffer();
-                                               errorMessage.append(stream.ReceiveString(conn.getEncoding()));
-                                               break;
-
-                                               //------------------------------
-                                               // Notice from backend
-                                       case 'N':
-                                               conn.addWarning(stream.ReceiveString(conn.getEncoding()));
-                                               break;
-
-                                       case 'V':
-                                               int l_nextChar = stream.ReceiveChar();
-                                               if (l_nextChar == 'G')
-                                               {
-                                                       int sz = stream.ReceiveIntegerR(4);
-                                                       // Return an Integer if
-                                                       if (resulttype)
-                                                               result = new Integer(stream.ReceiveIntegerR(sz));
-                                                       else
-                                                       {
-                                                               byte buf[] = new byte[sz];
-                                                               stream.Receive(buf, 0, sz);
-                                                               result = buf;
-                                                       }
-                                                       //There should be a trailing '0'
-                                                       int l_endChar = stream.ReceiveChar();
-                                               }
-                                               else
-                                               {
-                                                       //it must have been a '0', thus no results
-                                               }
-                                               break;
-
-                                       case 'Z':
-                                               l_endQuery = true;
-                                               break;
-
-                                       default:
-                                               throw new PSQLException("postgresql.fp.protocol", PSQLState.COMMUNICATION_ERROR, new Character((char)c));
-                               }
-                       }
-
-                       if ( errorMessage != null )
-                               throw new PSQLException("postgresql.fp.error", PSQLState.COMMUNICATION_ERROR, errorMessage.toString());
-
-                       return result;
-               }
-       }
-
-       /*
-        * Send a function call to the PostgreSQL backend by name.
-        *
-        * Note: the mapping for the procedure name to function id needs to exist,
-        * usually to an earlier call to addfunction().
-        *
-        * 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.LargeObject
-        *
-        * @param name Function name
-        * @param resulttype True if the result is an integer, false for other
-        * results
-        * @param args FastpathArguments to pass to 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.LargeObject
-        */
-       public Object fastpath(String name, boolean resulttype, FastpathArg[] args) throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("Fastpath: calling " + name);
-               return fastpath(getID(name), resulttype, args);
-       }
-
-       /*
-        * This convenience method assumes that the return value is an Integer
-        * @param name Function name
-        * @param args Function arguments
-        * @return integer result
-        * @exception SQLException if a database-access error occurs or no result
-        */
-       public int getInteger(String name, FastpathArg[] args) throws SQLException
-       {
-               Integer i = (Integer)fastpath(name, true, args);
-               if (i == null)
-                       throw new PSQLException("postgresql.fp.expint", name);
-               return i.intValue();
-       }
-
-       /*
-        * This convenience method assumes that the return value is an Integer
-        * @param name Function name
-        * @param args Function arguments
-        * @return byte[] array containing result
-        * @exception SQLException if a database-access error occurs or no result
-        */
-       public byte[] getData(String name, FastpathArg[] args) throws SQLException
-       {
-               return (byte[])fastpath(name, false, args);
-       }
-
-       /*
-        * This adds a function to our lookup table.
-        *
-        * <p>User code should use the addFunctions method, which is based upon a
-        * query, rather than hard coding the oid. The oid for a function is not
-        * guaranteed to remain static, even on different servers of the same
-        * version.
-        *
-        * @param name Function name
-        * @param fnid Function id
-        */
-       public void addFunction(String name, int fnid)
-       {
-               func.put(name, new Integer(fnid));
-       }
-
-       /*
-        * This takes a ResultSet containing two columns. Column 1 contains the
-        * function name, Column 2 the oid.
-        *
-        * <p>It reads the entire ResultSet, loading the values into the function
-        * table.
-        *
-        * <p><b>REMEMBER</b> to close() the resultset after calling this!!
-        *
-        * <p><b><em>Implementation note about function name lookups:</em></b>
-        *
-        * <p>PostgreSQL stores the function id's and their corresponding names in
-        * the pg_proc table. To speed things up locally, instead of querying each
-        * function from that table when required, a Hashtable is used. Also, only
-        * the function's required are entered into this table, keeping connection
-        * times as fast as possible.
-        *
-        * <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
-        * name.
-        *
-        * <p>Dont think that manually converting them to the oid's will work. Ok,
-        * they will for now, but they can change during development (there was some
-        * discussion about this for V7.0), so this is implemented to prevent any
-        * unwarranted headaches in the future.
-        *
-        * @param rs ResultSet
-        * @exception SQLException if a database-access error occurs.
-        * @see org.postgresql.largeobject.LargeObjectManager
-        */
-       public void addFunctions(ResultSet rs) throws SQLException
-       {
-               while (rs.next())
-               {
-                       func.put(rs.getString(1), new Integer(rs.getInt(2)));
-               }
-       }
-
-       /*
-        * This returns the function id associated by its name
-        *
-        * <p>If addFunction() or addFunctions() have not been called for this name,
-        * then an SQLException is thrown.
-        *
-        * @param name Function name to lookup
-        * @return Function ID for fastpath call
-        * @exception SQLException is function is unknown.
-        */
-       public int getID(String name) throws SQLException
-       {
-               Integer id = (Integer)func.get(name);
-
-               // may be we could add a lookup to the database here, and store the result
-               // in our lookup table, throwing the exception if that fails.
-               // We must, however, ensure that if we do, any existing ResultSet is
-               // unaffected, otherwise we could break user code.
-               //
-               // so, until we know we can do this (needs testing, on the TODO list)
-               // for now, we throw the exception and do no lookups.
-               if (id == null)
-                       throw new PSQLException("postgresql.fp.unknown", PSQLState.UNEXPECTED_ERROR, name);
-
-               return id.intValue();
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/fastpath/FastpathArg.java b/src/interfaces/jdbc/org/postgresql/fastpath/FastpathArg.java
deleted file mode 100644 (file)
index 248abca..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * FastpathArg.java
- *     Each fastpath call requires an array of arguments, the number and type
- *     dependent on the function being called.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/fastpath/FastpathArg.java,v 1.6 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.fastpath;
-
-import java.io.IOException;
-
-public class FastpathArg
-{
-       /*
-        * Type of argument, true=integer, false=byte[]
-        */
-       public boolean type;
-
-       /*
-        * Integer value if type=true
-        */
-       public int value;
-
-       /*
-        * Byte value if type=false;
-        */
-       public byte[] bytes;
-
-       /*
-        * Constructs an argument that consists of an integer value
-        * @param value int value to set
-        */
-       public FastpathArg(int value)
-       {
-               type = true;
-               this.value = value;
-       }
-
-       /*
-        * Constructs an argument that consists of an array of bytes
-        * @param bytes array to store
-        */
-       public FastpathArg(byte bytes[])
-       {
-               type = false;
-               this.bytes = bytes;
-       }
-
-       /*
-        * Constructs an argument that consists of part of a byte array
-        * @param buf source array
-        * @param off offset within array
-        * @param len length of data to include
-        */
-       public FastpathArg(byte buf[], int off, int len)
-       {
-               type = false;
-               bytes = new byte[len];
-               System.arraycopy(buf, off, bytes, 0, len);
-       }
-
-       /*
-        * Constructs an argument that consists of a String.
-        * @param s String to store
-        */
-       public FastpathArg(String s)
-       {
-               this(s.getBytes());
-       }
-
-       /*
-        * This sends this argument down the network stream.
-        *
-        * <p>The stream sent consists of the length.int4 then the contents.
-        *
-        * <p><b>Note:</b> This is called from Fastpath, and cannot be called from
-        * client code.
-        *
-        * @param s output stream
-        * @exception IOException if something failed on the network stream
-        */
-       protected void send(org.postgresql.core.PGStream s) throws IOException
-       {
-               if (type)
-               {
-                       // argument is an integer
-                       s.SendInteger(4, 4);    // size of an integer
-                       s.SendInteger(value, 4);        // integer value of argument
-               }
-               else
-               {
-                       // argument is a byte array
-                       s.SendInteger(bytes.length, 4); // size of array
-                       s.Send(bytes);
-               }
-       }
-
-       protected int sendSize()
-       {
-               if (type)
-               {
-                       return 8;
-               }
-               else
-               {
-                       return 4+bytes.length;
-               }
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGbox.java b/src/interfaces/jdbc/org/postgresql/geometric/PGbox.java
deleted file mode 100644 (file)
index 1913d37..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGbox.java
- *     This represents the box datatype within org.postgresql.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/geometric/PGbox.java,v 1.6 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.geometric;
-
-import org.postgresql.util.PGobject;
-import org.postgresql.util.PGtokenizer;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-import java.io.Serializable;
-import java.sql.SQLException;
-
-public class PGbox extends PGobject implements Serializable, Cloneable
-{
-       /*
-        * These are the two points.
-        */
-       public PGpoint point[] = new PGpoint[2];
-
-       /*
-        * @param x1 first x coordinate
-        * @param y1 first y coordinate
-        * @param x2 second x coordinate
-        * @param y2 second y coordinate
-        */
-       public PGbox(double x1, double y1, double x2, double y2)
-       {
-               this();
-               this.point[0] = new PGpoint(x1, y1);
-               this.point[1] = new PGpoint(x2, y2);
-       }
-
-       /*
-        * @param p1 first point
-        * @param p2 second point
-        */
-       public PGbox(PGpoint p1, PGpoint p2)
-       {
-               this();
-               this.point[0] = p1;
-               this.point[1] = p2;
-       }
-
-       /*
-        * @param s Box definition in PostgreSQL syntax
-        * @exception SQLException if definition is invalid
-        */
-       public PGbox(String s) throws SQLException
-       {
-               this();
-               setValue(s);
-       }
-
-       /*
-        * Required constructor
-        */
-       public PGbox()
-       {
-               setType("box");
-       }
-
-       /*
-        * This method sets the value of this object. It should be overidden,
-        * but still called by subclasses.
-        *
-        * @param value a string representation of the value of the object
-        * @exception SQLException thrown if value is invalid for this type
-        */
-       public void setValue(String value) throws SQLException
-       {
-               PGtokenizer t = new PGtokenizer(value, ',');
-               if (t.getSize() != 2)
-                       throw new PSQLException("postgresql.geo.box", PSQLState.DATA_TYPE_MISMATCH, value);
-
-               point[0] = new PGpoint(t.getToken(0));
-               point[1] = new PGpoint(t.getToken(1));
-       }
-
-       /*
-        * @param obj Object to compare with
-        * @return true if the two boxes are identical
-        */
-       public boolean equals(Object obj)
-       {
-               if (obj instanceof PGbox)
-               {
-                       PGbox p = (PGbox)obj;
-                       return (p.point[0].equals(point[0]) && p.point[1].equals(point[1])) ||
-                                  (p.point[0].equals(point[1]) && p.point[1].equals(point[0]));
-               }
-               return false;
-       }
-
-       /*
-        * This must be overidden to allow the object to be cloned
-        */
-       public Object clone()
-       {
-               return new PGbox((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
-       }
-
-       /*
-        * @return the PGbox in the syntax expected by org.postgresql
-        */
-       public String getValue()
-       {
-               return point[0].toString() + "," + point[1].toString();
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java b/src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java
deleted file mode 100644 (file)
index e559b3d..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGcircle.java
- *     This represents org.postgresql's circle datatype, consisting of a point
- *     and a radius
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java,v 1.7 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.geometric;
-
-import org.postgresql.util.PGobject;
-import org.postgresql.util.PGtokenizer;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-import java.io.Serializable;
-import java.sql.SQLException;
-
-public class PGcircle extends PGobject implements Serializable, Cloneable
-{
-       /*
-        * This is the centre point
-        */
-       public PGpoint center;
-
-       /*
-        * This is the radius
-        */
-       double radius;
-
-       /*
-        * @param x coordinate of centre
-        * @param y coordinate of centre
-        * @param r radius of circle
-        */
-       public PGcircle(double x, double y, double r)
-       {
-               this(new PGpoint(x, y), r);
-       }
-
-       /*
-        * @param c PGpoint describing the circle's centre
-        * @param r radius of circle
-        */
-       public PGcircle(PGpoint c, double r)
-       {
-               this();
-               this.center = c;
-               this.radius = r;
-       }
-
-       /*
-        * @param s definition of the circle in PostgreSQL's syntax.
-        * @exception SQLException on conversion failure
-        */
-       public PGcircle(String s) throws SQLException
-       {
-               this();
-               setValue(s);
-       }
-
-       /*
-        * This constructor is used by the driver.
-        */
-       public PGcircle()
-       {
-               setType("circle");
-       }
-
-       /*
-        * @param s definition of the circle in PostgreSQL's syntax.
-        * @exception SQLException on conversion failure
-        */
-       public void setValue(String s) throws SQLException
-       {
-               PGtokenizer t = new PGtokenizer(PGtokenizer.removeAngle(s), ',');
-               if (t.getSize() != 2)
-                       throw new PSQLException("postgresql.geo.circle", PSQLState.DATA_TYPE_MISMATCH, s);
-
-               try
-               {
-                       center = new PGpoint(t.getToken(0));
-                       radius = Double.valueOf(t.getToken(1)).doubleValue();
-               }
-               catch (NumberFormatException e)
-               {
-                       throw new PSQLException("postgresql.geo.circle", PSQLState.DATA_TYPE_MISMATCH, e);
-               }
-       }
-
-       /*
-        * @param obj Object to compare with
-        * @return true if the two boxes are identical
-        */
-       public boolean equals(Object obj)
-       {
-               if (obj instanceof PGcircle)
-               {
-                       PGcircle p = (PGcircle)obj;
-                       return p.center.equals(center) && p.radius == radius;
-               }
-               return false;
-       }
-
-       /*
-        * This must be overidden to allow the object to be cloned
-        */
-       public Object clone()
-       {
-               return new PGcircle((PGpoint)center.clone(), radius);
-       }
-
-       /*
-        * @return the PGcircle in the syntax expected by org.postgresql
-        */
-       public String getValue()
-       {
-               return "<" + center + "," + radius + ">";
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGline.java b/src/interfaces/jdbc/org/postgresql/geometric/PGline.java
deleted file mode 100644 (file)
index 7fd48de..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGline.java
- *     This implements a line consisting of two points.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/geometric/PGline.java,v 1.6 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.geometric;
-
-import org.postgresql.util.PGobject;
-import org.postgresql.util.PGtokenizer;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-import java.io.Serializable;
-import java.sql.SQLException;
-
-/*
- * Currently line is not yet implemented in the backend, but this class
- * ensures that when it's done were ready for it.
- */
-public class PGline extends PGobject implements Serializable, Cloneable
-{
-       /*
-        * These are the two points.
-        */
-       public PGpoint point[] = new PGpoint[2];
-
-       /*
-        * @param x1 coordinate for first point
-        * @param y1 coordinate for first point
-        * @param x2 coordinate for second point
-        * @param y2 coordinate for second point
-        */
-       public PGline(double x1, double y1, double x2, double y2)
-       {
-               this(new PGpoint(x1, y1), new PGpoint(x2, y2));
-       }
-
-       /*
-        * @param p1 first point
-        * @param p2 second point
-        */
-       public PGline(PGpoint p1, PGpoint p2)
-       {
-               this();
-               this.point[0] = p1;
-               this.point[1] = p2;
-       }
-
-       /*
-        * @param s definition of the circle in PostgreSQL's syntax.
-        * @exception SQLException on conversion failure
-        */
-       public PGline(String s) throws SQLException
-       {
-               this();
-               setValue(s);
-       }
-
-       /*
-        * reuired by the driver
-        */
-       public PGline()
-       {
-               setType("line");
-       }
-
-       /*
-        * @param s Definition of the line segment in PostgreSQL's syntax
-        * @exception SQLException on conversion failure
-        */
-       public void setValue(String s) throws SQLException
-       {
-               PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ',');
-               if (t.getSize() != 2)
-                       throw new PSQLException("postgresql.geo.line", PSQLState.DATA_TYPE_MISMATCH, s);
-
-               point[0] = new PGpoint(t.getToken(0));
-               point[1] = new PGpoint(t.getToken(1));
-       }
-
-       /*
-        * @param obj Object to compare with
-        * @return true if the two boxes are identical
-        */
-       public boolean equals(Object obj)
-       {
-               if (obj instanceof PGline)
-               {
-                       PGline p = (PGline)obj;
-                       return (p.point[0].equals(point[0]) && p.point[1].equals(point[1])) ||
-                                  (p.point[0].equals(point[1]) && p.point[1].equals(point[0]));
-               }
-               return false;
-       }
-
-       /*
-        * This must be overidden to allow the object to be cloned
-        */
-       public Object clone()
-       {
-               return new PGline((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
-       }
-
-       /*
-        * @return the PGline in the syntax expected by org.postgresql
-        */
-       public String getValue()
-       {
-               return "[" + point[0] + "," + point[1] + "]";
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java b/src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java
deleted file mode 100644 (file)
index 9663621..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGlseg.java
- *     This implements a lseg (line segment) consisting of two points
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java,v 1.6 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.geometric;
-
-import org.postgresql.util.PGobject;
-import org.postgresql.util.PGtokenizer;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-import java.io.Serializable;
-import java.sql.SQLException;
-
-public class PGlseg extends PGobject implements Serializable, Cloneable
-{
-       /*
-        * These are the two points.
-        */
-       public PGpoint point[] = new PGpoint[2];
-
-       /*
-        * @param x1 coordinate for first point
-        * @param y1 coordinate for first point
-        * @param x2 coordinate for second point
-        * @param y2 coordinate for second point
-        */
-       public PGlseg(double x1, double y1, double x2, double y2)
-       {
-               this(new PGpoint(x1, y1), new PGpoint(x2, y2));
-       }
-
-       /*
-        * @param p1 first point
-        * @param p2 second point
-        */
-       public PGlseg(PGpoint p1, PGpoint p2)
-       {
-               this();
-               this.point[0] = p1;
-               this.point[1] = p2;
-       }
-
-       /*
-        * @param s definition of the circle in PostgreSQL's syntax.
-        * @exception SQLException on conversion failure
-        */
-       public PGlseg(String s) throws SQLException
-       {
-               this();
-               setValue(s);
-       }
-
-       /*
-        * reuired by the driver
-        */
-       public PGlseg()
-       {
-               setType("lseg");
-       }
-
-       /*
-        * @param s Definition of the line segment in PostgreSQL's syntax
-        * @exception SQLException on conversion failure
-        */
-       public void setValue(String s) throws SQLException
-       {
-               PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ',');
-               if (t.getSize() != 2)
-                       throw new PSQLException("postgresql.geo.lseg", PSQLState.DATA_TYPE_MISMATCH);
-
-               point[0] = new PGpoint(t.getToken(0));
-               point[1] = new PGpoint(t.getToken(1));
-       }
-
-       /*
-        * @param obj Object to compare with
-        * @return true if the two boxes are identical
-        */
-       public boolean equals(Object obj)
-       {
-               if (obj instanceof PGlseg)
-               {
-                       PGlseg p = (PGlseg)obj;
-                       return (p.point[0].equals(point[0]) && p.point[1].equals(point[1])) ||
-                                  (p.point[0].equals(point[1]) && p.point[1].equals(point[0]));
-               }
-               return false;
-       }
-
-       /*
-        * This must be overidden to allow the object to be cloned
-        */
-       public Object clone()
-       {
-               return new PGlseg((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
-       }
-
-       /*
-        * @return the PGlseg in the syntax expected by org.postgresql
-        */
-       public String getValue()
-       {
-               return "[" + point[0] + "," + point[1] + "]";
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGpath.java b/src/interfaces/jdbc/org/postgresql/geometric/PGpath.java
deleted file mode 100644 (file)
index 3c667e2..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGpath.java
- *     This implements a path (a multiple segmented line, which may be closed)
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/geometric/PGpath.java,v 1.7 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.geometric;
-
-import org.postgresql.util.PGobject;
-import org.postgresql.util.PGtokenizer;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-import java.io.Serializable;
-import java.sql.SQLException;
-
-public class PGpath extends PGobject implements Serializable, Cloneable
-{
-       /*
-        * True if the path is open, false if closed
-        */
-       public boolean open;
-
-       /*
-        * The points defining this path
-        */
-       public PGpoint points[];
-
-       /*
-        * @param points the PGpoints that define the path
-        * @param open True if the path is open, false if closed
-        */
-       public PGpath(PGpoint[] points, boolean open)
-       {
-               this();
-               this.points = points;
-               this.open = open;
-       }
-
-       /*
-        * Required by the driver
-        */
-       public PGpath()
-       {
-               setType("path");
-       }
-
-       /*
-        * @param s definition of the circle in PostgreSQL's syntax.
-        * @exception SQLException on conversion failure
-        */
-       public PGpath(String s) throws SQLException
-       {
-               this();
-               setValue(s);
-       }
-
-       /*
-        * @param s Definition of the path in PostgreSQL's syntax
-        * @exception SQLException on conversion failure
-        */
-       public void setValue(String s) throws SQLException
-       {
-               // First test to see if were open
-               if (s.startsWith("[") && s.endsWith("]"))
-               {
-                       open = true;
-                       s = PGtokenizer.removeBox(s);
-               }
-               else if (s.startsWith("(") && s.endsWith(")"))
-               {
-                       open = false;
-                       s = PGtokenizer.removePara(s);
-               }
-               else
-                       throw new PSQLException("postgresql.geo.path", PSQLState.DATA_TYPE_MISMATCH);
-
-               PGtokenizer t = new PGtokenizer(s, ',');
-               int npoints = t.getSize();
-               points = new PGpoint[npoints];
-               for (int p = 0;p < npoints;p++)
-                       points[p] = new PGpoint(t.getToken(p));
-       }
-
-       /*
-        * @param obj Object to compare with
-        * @return true if the two boxes are identical
-        */
-       public boolean equals(Object obj)
-       {
-               if (obj instanceof PGpath)
-               {
-                       PGpath p = (PGpath)obj;
-
-                       if (p.points.length != points.length)
-                               return false;
-
-                       if (p.open != open)
-                               return false;
-
-                       for (int i = 0;i < points.length;i++)
-                               if (!points[i].equals(p.points[i]))
-                                       return false;
-
-                       return true;
-               }
-               return false;
-       }
-
-       /*
-        * This must be overidden to allow the object to be cloned
-        */
-       public Object clone()
-       {
-               PGpoint ary[] = new PGpoint[points.length];
-               for (int i = 0;i < points.length;i++)
-                       ary[i] = (PGpoint)points[i].clone();
-               return new PGpath(ary, open);
-       }
-
-       /*
-        * This returns the polygon in the syntax expected by org.postgresql
-        */
-       public String getValue()
-       {
-               StringBuffer b = new StringBuffer(open ? "[" : "(");
-
-               for (int p = 0;p < points.length;p++)
-               {
-                       if (p > 0)
-                               b.append(",");
-                       b.append(points[p].toString());
-               }
-               b.append(open ? "]" : ")");
-
-               return b.toString();
-       }
-
-       public boolean isOpen()
-       {
-               return open;
-       }
-
-       public boolean isClosed()
-       {
-               return !open;
-       }
-
-       public void closePath()
-       {
-               open = false;
-       }
-
-       public void openPath()
-       {
-               open = true;
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java b/src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java
deleted file mode 100644 (file)
index cff9cde..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGline.java
- *     It maps to the point datatype in org.postgresql.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java,v 1.7 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.geometric;
-
-import org.postgresql.util.PGobject;
-import org.postgresql.util.PGtokenizer;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-import java.awt.Point;
-import java.io.Serializable;
-import java.sql.SQLException;
-
-/*
- * This implements a version of java.awt.Point, except it uses double
- * to represent the coordinates.
- */
-public class PGpoint extends PGobject implements Serializable, Cloneable
-{
-       /*
-        * The X coordinate of the point
-        */
-       public double x;
-
-       /*
-        * The Y coordinate of the point
-        */
-       public double y;
-
-       /*
-        * @param x coordinate
-        * @param y coordinate
-        */
-       public PGpoint(double x, double y)
-       {
-               this();
-               this.x = x;
-               this.y = y;
-       }
-
-       /*
-        * 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 PGpoint(String value) throws SQLException
-       {
-               this();
-               setValue(value);
-       }
-
-       /*
-        * Required by the driver
-        */
-       public PGpoint()
-       {
-               setType("point");
-       }
-
-       /*
-        * @param s Definition of this point in PostgreSQL's syntax
-        * @exception SQLException on conversion failure
-        */
-       public void setValue(String s) throws SQLException
-       {
-               PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s), ',');
-               try
-               {
-                       x = Double.valueOf(t.getToken(0)).doubleValue();
-                       y = Double.valueOf(t.getToken(1)).doubleValue();
-               }
-               catch (NumberFormatException e)
-               {
-                       throw new PSQLException("postgresql.geo.point", PSQLState.DATA_TYPE_MISMATCH, e.toString());
-               }
-       }
-
-       /*
-        * @param obj Object to compare with
-        * @return true if the two boxes are identical
-        */
-       public boolean equals(Object obj)
-       {
-               if (obj instanceof PGpoint)
-               {
-                       PGpoint p = (PGpoint)obj;
-                       return x == p.x && y == p.y;
-               }
-               return false;
-       }
-
-       /*
-        * This must be overidden to allow the object to be cloned
-        */
-       public Object clone()
-       {
-               return new PGpoint(x, y);
-       }
-
-       /*
-        * @return the PGpoint in the syntax expected by org.postgresql
-        */
-       public String getValue()
-       {
-               return "(" + x + "," + y + ")";
-       }
-
-       /*
-        * Translate the point with the supplied amount.
-        * @param x integer amount to add on the x axis
-        * @param y integer amount to add on the y axis
-        */
-       public void translate(int x, int y)
-       {
-               translate((double)x, (double)y);
-       }
-
-       /*
-        * Translate the point with the supplied amount.
-        * @param x double amount to add on the x axis
-        * @param y double amount to add on the y axis
-        */
-       public void translate(double x, double y)
-       {
-               this.x += x;
-               this.y += y;
-       }
-
-       /*
-        * Moves the point to the supplied coordinates.
-        * @param x integer coordinate
-        * @param y integer coordinate
-        */
-       public void move(int x, int y)
-       {
-               setLocation(x, y);
-       }
-
-       /*
-        * Moves the point to the supplied coordinates.
-        * @param x double coordinate
-        * @param y double coordinate
-        */
-       public void move(double x, double y)
-       {
-               this.x = x;
-               this.y = y;
-       }
-
-       /*
-        * Moves the point to the supplied coordinates.
-        * refer to java.awt.Point for description of this
-        * @param x integer coordinate
-        * @param y integer coordinate
-        * @see java.awt.Point
-        */
-       public void setLocation(int x, int y)
-       {
-               move((double)x, (double)y);
-       }
-
-       /*
-        * Moves the point to the supplied java.awt.Point
-        * refer to java.awt.Point for description of this
-        * @param p Point to move to
-        * @see java.awt.Point
-        */
-       public void setLocation(Point p)
-       {
-               setLocation(p.x, p.y);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGpolygon.java b/src/interfaces/jdbc/org/postgresql/geometric/PGpolygon.java
deleted file mode 100644 (file)
index ec3b23e..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGline.java
- *     This implements the polygon datatype within PostgreSQL.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/geometric/PGpolygon.java,v 1.6 2003/11/29 19:52:09 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.geometric;
-
-import org.postgresql.util.PGobject;
-import org.postgresql.util.PGtokenizer;
-import java.io.Serializable;
-import java.sql.SQLException;
-
-public class PGpolygon extends PGobject implements Serializable, Cloneable
-{
-       /*
-        * The points defining the polygon
-        */
-       public PGpoint points[];
-
-       /*
-        * Creates a polygon using an array of PGpoints
-        *
-        * @param points the points defining the polygon
-        */
-       public PGpolygon(PGpoint[] points)
-       {
-               this();
-               this.points = points;
-       }
-
-       /*
-        * @param s definition of the circle in PostgreSQL's syntax.
-        * @exception SQLException on conversion failure
-        */
-       public PGpolygon(String s) throws SQLException
-       {
-               this();
-               setValue(s);
-       }
-
-       /*
-        * Required by the driver
-        */
-       public PGpolygon()
-       {
-               setType("polygon");
-       }
-
-       /*
-        * @param s Definition of the polygon in PostgreSQL's syntax
-        * @exception SQLException on conversion failure
-        */
-       public void setValue(String s) throws SQLException
-       {
-               PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s), ',');
-               int npoints = t.getSize();
-               points = new PGpoint[npoints];
-               for (int p = 0;p < npoints;p++)
-                       points[p] = new PGpoint(t.getToken(p));
-       }
-
-       /*
-        * @param obj Object to compare with
-        * @return true if the two boxes are identical
-        */
-       public boolean equals(Object obj)
-       {
-               if (obj instanceof PGpolygon)
-               {
-                       PGpolygon p = (PGpolygon)obj;
-
-                       if (p.points.length != points.length)
-                               return false;
-
-                       for (int i = 0;i < points.length;i++)
-                               if (!points[i].equals(p.points[i]))
-                                       return false;
-
-                       return true;
-               }
-               return false;
-       }
-
-       /*
-        * This must be overidden to allow the object to be cloned
-        */
-       public Object clone()
-       {
-               PGpoint ary[] = new PGpoint[points.length];
-               for (int i = 0;i < points.length;i++)
-                       ary[i] = (PGpoint)points[i].clone();
-               return new PGpolygon(ary);
-       }
-
-       /*
-        * @return the PGpolygon in the syntax expected by org.postgresql
-        */
-       public String getValue()
-       {
-               StringBuffer b = new StringBuffer();
-               b.append("(");
-               for (int p = 0;p < points.length;p++)
-               {
-                       if (p > 0)
-                               b.append(",");
-                       b.append(points[p].toString());
-               }
-               b.append(")");
-               return b.toString();
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
deleted file mode 100644 (file)
index ddf6eb4..0000000
+++ /dev/null
@@ -1,1843 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * AbstractJdbc1Connection.java
- *     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
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java,v 1.29 2003/12/18 03:27:15 davec Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.jdbc1;
-
-
-import java.io.IOException;
-import java.net.ConnectException;
-import java.sql.*;
-import java.util.*;
-import org.postgresql.Driver;
-import org.postgresql.PGNotification;
-import org.postgresql.core.BaseConnection;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Encoding;
-import org.postgresql.core.PGStream;
-import org.postgresql.core.QueryExecutor;
-import org.postgresql.core.StartupPacket;
-import org.postgresql.fastpath.Fastpath;
-import org.postgresql.largeobject.LargeObjectManager;
-import org.postgresql.util.MD5Digest;
-import org.postgresql.util.PGobject;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-import org.postgresql.util.UnixCrypt;
-
-public abstract class AbstractJdbc1Connection implements BaseConnection
-{
-       // This is the network stream associated with this connection
-       private PGStream pgStream;
-
-       public PGStream getPGStream() {
-               return pgStream;
-       }
-  
-       protected String PG_HOST;
-       protected int PG_PORT;
-       protected String PG_USER;
-       protected String PG_DATABASE;
-       protected boolean PG_STATUS;
-       protected String compatible;
-       protected boolean useSSL;
-
-       // The PID an cancellation key we get from the backend process
-       protected int pid;
-       protected int ckey;
-
-       private Vector m_notifications;
-
-       /*
-        The encoding to use for this connection.
-        */
-       private Encoding encoding = Encoding.defaultEncoding();
-
-       private String dbVersionNumber;
-
-       public boolean CONNECTION_OK = true;
-       public boolean CONNECTION_BAD = false;
-
-       public boolean autoCommit = true;
-       public boolean readOnly = false;
-
-       public Driver this_driver;
-       private String this_url;
-       private String cursor = null;   // The positioned update cursor name
-
-       private int PGProtocolVersionMajor = 2;
-       private int PGProtocolVersionMinor = 0;
-       public int getPGProtocolVersionMajor() { return PGProtocolVersionMajor; }
-       public int getPGProtocolVersionMinor() { return PGProtocolVersionMinor; }
-
-       private static final int AUTH_REQ_OK = 0;
-       private static final int AUTH_REQ_KRB4 = 1;
-       private static final int AUTH_REQ_KRB5 = 2;
-       private static final int AUTH_REQ_PASSWORD = 3;
-       private static final int AUTH_REQ_CRYPT = 4;
-       private static final int AUTH_REQ_MD5 = 5;
-       private static final int AUTH_REQ_SCM = 6;
-
-
-       // These are used to cache oids, PGTypes and SQLTypes
-       private static Hashtable sqlTypeCache = new Hashtable();  // oid -> SQLType
-       private static Hashtable pgTypeCache = new Hashtable();  // oid -> PGType
-       private static Hashtable typeOidCache = new Hashtable();  //PGType -> oid
-
-       // Now handle notices as warnings, so things like "show" now work
-       public SQLWarning firstWarning = null;
-
-       /*
-        * Cache of the current isolation level
-        */
-       private int isolationLevel = Connection.TRANSACTION_READ_COMMITTED;
-
-
-       public abstract Statement createStatement() throws SQLException;
-       public abstract DatabaseMetaData getMetaData() throws SQLException;
-
-       /*
-        * This method actually opens the connection. It is called by Driver.
-        *
-        * @param host the hostname of the database back end
-        * @param port the port number of the postmaster process
-        * @param info a Properties[] thing of the user and password
-        * @param database the database to connect to
-        * @param url the URL of the connection
-        * @param d the Driver instantation of the connection
-        * @exception SQLException if a database access error occurs
-        */
-       public void openConnection(String host, int port, Properties info, String database, String url, Driver d) throws SQLException
-         {
-               firstWarning = null;
-
-               // Throw an exception if the user or password properties are missing
-               // This occasionally occurs when the client uses the properties version
-               // of getConnection(), and is a common question on the email lists
-               if (info.getProperty("user") == null)
-                       throw new PSQLException("postgresql.con.user", PSQLState.CONNECTION_REJECTED);
-
-               this_driver = (Driver)d;
-               this_url = url;
-
-               PG_DATABASE = database;
-               PG_USER = info.getProperty("user");
-
-               String password = info.getProperty("password", "");
-               PG_PORT = port;
-
-               PG_HOST = host;
-               PG_STATUS = CONNECTION_BAD;
-
-               if (info.getProperty("ssl") != null && Driver.sslEnabled())
-               {
-                       useSSL = true;
-               }
-               else
-               {
-                       useSSL = false;
-               }
-
-               if (info.getProperty("compatible") == null)
-               {
-                       compatible = d.getMajorVersion() + "." + d.getMinorVersion();
-               }
-               else
-               {
-                       compatible = info.getProperty("compatible");
-               }
-
-               //Read loglevel arg and set the loglevel based on this value
-               //in addition to setting the log level enable output to
-               //standard out if no other printwriter is set
-               String l_logLevelProp = info.getProperty("loglevel", "0");
-               int l_logLevel = 0;
-               try
-               {
-                       l_logLevel = Integer.parseInt(l_logLevelProp);
-                       if (l_logLevel > Driver.DEBUG || l_logLevel < Driver.INFO)
-                       {
-                               l_logLevel = 0;
-                       }
-               }
-               catch (Exception l_e)
-               {
-                       //invalid value for loglevel ignore
-               }
-               if (l_logLevel > 0)
-               {
-                       Driver.setLogLevel(l_logLevel);
-                       enableDriverManagerLogging();
-               }
-
-               //Print out the driver version number
-               if (Driver.logInfo)
-                       Driver.info(Driver.getVersion());
-               if (Driver.logDebug) {
-                       Driver.debug("    ssl = " + useSSL);
-                       Driver.debug("    compatible = " + compatible);
-                       Driver.debug("    loglevel = " + l_logLevel);
-               }
-
-               // Now make the initial connection
-               try
-               {
-                       pgStream = new PGStream(host, 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", PSQLState.CONNECTION_REJECTED);
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException ("postgresql.con.failed", PSQLState.CONNECTION_UNABLE_TO_CONNECT, e);
-               }
-
-           //Now do the protocol work
-               if (haveMinimumCompatibleVersion("7.4")) {
-                       openConnectionV3(host,port,info,database,url,d,password);
-               } else {
-                       openConnectionV2(host,port,info,database,url,d,password);
-               }
-         }
-
-       private void openConnectionV3(String p_host, int p_port, Properties p_info, String p_database, String p_url, Driver p_d, String p_password) throws SQLException
-         {
-               PGProtocolVersionMajor = 3;
-               if (Driver.logDebug)
-                       Driver.debug("Using Protocol Version3");
-
-               // Now we need to construct and send an ssl startup packet
-               try
-               {
-                       if (useSSL) {
-                               if (Driver.logDebug)
-                                       Driver.debug("Asking server if it supports ssl");
-                               pgStream.SendInteger(8,4);
-                               pgStream.SendInteger(80877103,4);
-
-                               // now flush the ssl packets to the backend
-                               pgStream.flush();
-
-                               // Now get the response from the backend, either an error message
-                               // or an authentication request
-                               int beresp = pgStream.ReceiveChar();
-                               if (Driver.logDebug)
-                                       Driver.debug("Server response was (S=Yes,N=No): "+(char)beresp);
-                               switch (beresp)
-                                       {
-                                       case 'E':
-                                               // An error occured, so pass the error message to the
-                                               // user.
-                                               //
-                                               // The most common one to be thrown here is:
-                                               // "User authentication failed"
-                                               //
-                                               throw new PSQLException("postgresql.con.misc", PSQLState.CONNECTION_REJECTED, pgStream.ReceiveString(encoding));
-                                               
-                                       case 'N':
-                                               // Server does not support ssl
-                                               throw new PSQLException("postgresql.con.sslnotsupported", PSQLState.CONNECTION_FAILURE);
-                                               
-                                       case 'S':
-                                               // Server supports ssl
-                                               if (Driver.logDebug)
-                                                       Driver.debug("server does support ssl");
-                                               Driver.makeSSL(pgStream);
-                                               break;
-
-                                       default:
-                                               throw new PSQLException("postgresql.con.sslfail", PSQLState.CONNECTION_FAILURE);
-                                       }
-                       }
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.con.failed", PSQLState.CONNECTION_UNABLE_TO_CONNECT, e);
-               }
-
-
-               // Now we need to construct and send a startup packet
-               try
-               {
-                       new StartupPacket(PGProtocolVersionMajor,
-                                                         PGProtocolVersionMinor,
-                                                         PG_USER,
-                                                         p_database).writeTo(pgStream);
-
-                       // now flush the startup packets to the backend
-                       pgStream.flush();
-
-                       // Now get the response from the backend, either an error message
-                       // or an authentication request
-                       int areq = -1; // must have a value here
-                       do
-                       {
-                               int beresp = pgStream.ReceiveChar();
-                               String salt = null;
-                               byte [] md5Salt = new byte[4];
-                               switch (beresp)
-                               {
-                                       case 'E':
-                                               // An error occured, so pass the error message to the
-                                               // user.
-                                               //
-                                               // The most common one to be thrown here is:
-                                               // "User authentication failed"
-                                               //
-                                               int l_elen = pgStream.ReceiveIntegerR(4);
-                                               if (l_elen > 30000) {
-                                                       //if the error length is > than 30000 we assume this is really a v2 protocol 
-                                                       //server so try again with a v2 connection
-                                                       //need to create a new connection and try again
-                                                       try
-                                                       {
-                                                               pgStream = new PGStream(p_host, p_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", PSQLState.CONNECTION_REJECTED);
-                                                       }
-                                                       catch (IOException e)
-                                                       {
-                                                               throw new PSQLException ("postgresql.con.failed", PSQLState.CONNECTION_UNABLE_TO_CONNECT, e);
-                                                       }
-                                                       openConnectionV2(p_host, p_port, p_info, p_database, p_url, p_d, p_password);
-                                                       return;
-                                               }
-                                               throw new PSQLException("postgresql.con.misc", PSQLState.CONNECTION_REJECTED, PSQLException.parseServerError(encoding.decode(pgStream.Receive(l_elen-4))));
-
-                                       case 'R':
-                                               // Get the message length
-                                               int l_msgLen = pgStream.ReceiveIntegerR(4);
-                                               // Get the type of request
-                                               areq = pgStream.ReceiveIntegerR(4);
-                                               // Get the crypt password salt if there is one
-                                               if (areq == AUTH_REQ_CRYPT)
-                                               {
-                                                       byte[] rst = new byte[2];
-                                                       rst[0] = (byte)pgStream.ReceiveChar();
-                                                       rst[1] = (byte)pgStream.ReceiveChar();
-                                                       salt = new String(rst, 0, 2);
-                                                       if (Driver.logDebug)
-                                                               Driver.debug("Crypt salt=" + salt);
-                                               }
-
-                                               // Or get the md5 password salt if there is one
-                                               if (areq == AUTH_REQ_MD5)
-                                               {
-
-                                                       md5Salt[0] = (byte)pgStream.ReceiveChar();
-                                                       md5Salt[1] = (byte)pgStream.ReceiveChar();
-                                                       md5Salt[2] = (byte)pgStream.ReceiveChar();
-                                                       md5Salt[3] = (byte)pgStream.ReceiveChar();
-                                                       salt = new String(md5Salt, 0, 4);
-                                                       if (Driver.logDebug)
-                                                               Driver.debug("MD5 salt=" + salt);
-                                               }
-
-                                               // now send the auth packet
-                                               switch (areq)
-                                               {
-                                                       case AUTH_REQ_OK:
-                                                               break;
-
-                                                       case AUTH_REQ_KRB4:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: KRB4");
-                                                               throw new PSQLException("postgresql.con.kerb4", PSQLState.CONNECTION_REJECTED);
-
-                                                       case AUTH_REQ_KRB5:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: KRB5");
-                                                               throw new PSQLException("postgresql.con.kerb5", PSQLState.CONNECTION_REJECTED);
-
-                                                       case AUTH_REQ_SCM:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: SCM");
-                                                               throw new PSQLException("postgresql.con.scm", PSQLState.CONNECTION_REJECTED);
-
-
-                                                       case AUTH_REQ_PASSWORD:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: PASSWORD");
-                                                               pgStream.SendChar('p');
-                                                               pgStream.SendInteger(5 + p_password.length(), 4);
-                                                               pgStream.Send(p_password.getBytes());
-                                                               pgStream.SendChar(0);
-                                                               pgStream.flush();
-                                                               break;
-
-                                                       case AUTH_REQ_CRYPT:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: CRYPT");
-                                                               String crypted = UnixCrypt.crypt(salt, p_password);
-                                                               pgStream.SendChar('p');
-                                                               pgStream.SendInteger(5 + crypted.length(), 4);
-                                                               pgStream.Send(crypted.getBytes());
-                                                               pgStream.SendChar(0);
-                                                               pgStream.flush();
-                                                               break;
-
-                                                       case AUTH_REQ_MD5:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: MD5");
-                                                               byte[] digest = MD5Digest.encode(PG_USER, p_password, md5Salt);
-                                                               pgStream.SendChar('p');
-                                                               pgStream.SendInteger(5 + digest.length, 4);
-                                                               pgStream.Send(digest);
-                                                               pgStream.SendChar(0);
-                                                               pgStream.flush();
-                                                               break;
-
-                                                       default:
-                                                               throw new PSQLException("postgresql.con.auth", PSQLState.CONNECTION_REJECTED, new Integer(areq));
-                                               }
-                                               break;
-
-                                       default:
-                                               throw new PSQLException("postgresql.con.authfail", PSQLState.CONNECTION_REJECTED);
-                               }
-                       }
-                       while (areq != AUTH_REQ_OK);
-
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.con.failed", PSQLState.CONNECTION_UNABLE_TO_CONNECT, e);
-               }
-
-               int beresp;
-               do
-               {
-                       beresp = pgStream.ReceiveChar();
-                       switch (beresp)
-                       {
-                           case 'Z':
-                                       //ready for query
-                                       break;
-                               case 'K':
-                                       int l_msgLen = pgStream.ReceiveIntegerR(4);
-                                       if (l_msgLen != 12) throw new PSQLException("postgresql.con.setup", PSQLState.CONNECTION_UNABLE_TO_CONNECT);
-                                       pid = pgStream.ReceiveIntegerR(4);
-                                       ckey = pgStream.ReceiveIntegerR(4);
-                                       break;
-                               case 'E':
-                                       int l_elen = pgStream.ReceiveIntegerR(4);
-                                       throw new PSQLException("postgresql.con.backend", PSQLState.CONNECTION_UNABLE_TO_CONNECT, PSQLException.parseServerError(encoding.decode(pgStream.Receive(l_elen-4))));
-                               case 'N':
-                                       int l_nlen = pgStream.ReceiveIntegerR(4);
-                                       addWarning(encoding.decode(pgStream.Receive(l_nlen-4)));
-                                       break;
-                           case 'S':
-                                       //TODO: handle parameter status messages
-                                       int l_len = pgStream.ReceiveIntegerR(4);
-                                       String l_pStatus = encoding.decode(pgStream.Receive(l_len-4));
-                                       if (Driver.logDebug)
-                                               Driver.debug("ParameterStatus="+ l_pStatus);
-                                       break;
-                               default:
-                                       if (Driver.logDebug)
-                                               Driver.debug("invalid state="+ (char)beresp);
-                                       throw new PSQLException("postgresql.con.setup", PSQLState.CONNECTION_UNABLE_TO_CONNECT);
-                       }
-               }
-               while (beresp != 'Z');
-               // read ReadyForQuery
-               if (pgStream.ReceiveIntegerR(4) != 5) throw new PSQLException("postgresql.con.setup", PSQLState.CONNECTION_UNABLE_TO_CONNECT); 
-               //TODO: handle transaction status
-               char l_tStatus = (char)pgStream.ReceiveChar();
-
-               // "pg_encoding_to_char(1)" will return 'EUC_JP' for a backend compiled with multibyte,
-               // otherwise it's hardcoded to 'SQL_ASCII'.
-               // If the backend doesn't know about multibyte we can't assume anything about the encoding
-               // used, so we denote this with 'UNKNOWN'.
-               //Note: begining with 7.2 we should be using pg_client_encoding() which
-               //is new in 7.2.  However it isn't easy to conditionally call this new
-               //function, since we don't yet have the information as to what server
-               //version we are talking to.  Thus we will continue to call
-               //getdatabaseencoding() until we drop support for 7.1 and older versions
-               //or until someone comes up with a conditional way to run one or
-               //the other function depending on server version that doesn't require
-               //two round trips to the server per connection
-
-               final String encodingQuery =
-                       "case when pg_encoding_to_char(1) = 'SQL_ASCII' then 'UNKNOWN' else getdatabaseencoding() end";
-
-               // Set datestyle and fetch db encoding in a single call, to avoid making
-               // more than one round trip to the backend during connection startup.
-
-
-               BaseResultSet resultSet
-                       = execSQL("set datestyle to 'ISO'; select version(), " + encodingQuery + ";");
-               
-               if (! resultSet.next())
-               {
-                       throw new PSQLException("postgresql.con.failed.bad.encoding", PSQLState.CONNECTION_UNABLE_TO_CONNECT);
-               }
-               String version = resultSet.getString(1);
-               dbVersionNumber = extractVersionNumber(version);
-
-               String dbEncoding = resultSet.getString(2);
-               encoding = Encoding.getEncoding(dbEncoding, p_info.getProperty("charSet"));
-               //In 7.3 we are forced to do a second roundtrip to handle the case 
-               //where a database may not be running in autocommit mode
-               //jdbc by default assumes autocommit is on until setAutoCommit(false)
-               //is called.  Therefore we need to ensure a new connection is 
-               //initialized to autocommit on.
-               //We also set the client encoding so that the driver only needs 
-               //to deal with utf8.  We can only do this in 7.3 because multibyte 
-               //support is now always included
-               if (haveMinimumServerVersion("7.3")) 
-               {
-                       BaseResultSet acRset =
-                       //TODO: if protocol V3 we can set the client encoding in startup
-                       execSQL("set client_encoding = 'UNICODE'");
-                       //set encoding to be unicode
-                       encoding = Encoding.getEncoding("UNICODE", null);
-
-               }
-
-               // Initialise object handling
-               initObjectTypes();
-
-               // Mark the connection as ok, and cleanup
-               PG_STATUS = CONNECTION_OK;
-       }
-
-       private void openConnectionV2(String host, int port, Properties info, String database, String url, Driver d, String password) throws SQLException
-         {
-               PGProtocolVersionMajor = 2;
-               if (Driver.logDebug)
-                       Driver.debug("Using Protocol Version2");
-
-               // Now we need to construct and send an ssl startup packet
-               try
-               {
-                       if (useSSL) {
-                               if (Driver.logDebug)
-                                       Driver.debug("Asking server if it supports ssl");
-                               pgStream.SendInteger(8,4);
-                               pgStream.SendInteger(80877103,4);
-
-                               // now flush the ssl packets to the backend
-                               pgStream.flush();
-
-                               // Now get the response from the backend, either an error message
-                               // or an authentication request
-                               int beresp = pgStream.ReceiveChar();
-                               if (Driver.logDebug)
-                                       Driver.debug("Server response was (S=Yes,N=No): "+(char)beresp);
-                               switch (beresp)
-                                       {
-                                       case 'E':
-                                               // An error occured, so pass the error message to the
-                                               // user.
-                                               //
-                                               // The most common one to be thrown here is:
-                                               // "User authentication failed"
-                                               //
-                                               throw new PSQLException("postgresql.con.misc", PSQLState.CONNECTION_REJECTED, pgStream.ReceiveString(encoding));
-                                               
-                                       case 'N':
-                                               // Server does not support ssl
-                                               throw new PSQLException("postgresql.con.sslnotsupported", PSQLState.CONNECTION_FAILURE);
-                                               
-                                       case 'S':
-                                               // Server supports ssl
-                                               if (Driver.logDebug)
-                                                       Driver.debug("server does support ssl");
-                                               Driver.makeSSL(pgStream);
-                                               break;
-
-                                       default:
-                                               throw new PSQLException("postgresql.con.sslfail", PSQLState.CONNECTION_FAILURE);
-                                       }
-                       }
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException("postgresql.con.failed", PSQLState.CONNECTION_UNABLE_TO_CONNECT, e);
-               }
-
-
-               // Now we need to construct and send a startup packet
-               try
-               {
-                       new StartupPacket(PGProtocolVersionMajor,
-                                                         PGProtocolVersionMinor,
-                                                         PG_USER,
-                                                         database).writeTo(pgStream);
-
-                       // now flush the startup packets to the backend
-                       pgStream.flush();
-
-                       // Now get the response from the backend, either an error message
-                       // or an authentication request
-                       int areq = -1; // must have a value here
-                       do
-                       {
-                               int beresp = pgStream.ReceiveChar();
-                               String salt = null;
-                               byte [] md5Salt = new byte[4];
-                               switch (beresp)
-                               {
-                                       case 'E':
-                                               // An error occured, so pass the error message to the
-                                               // user.
-                                               //
-                                               // The most common one to be thrown here is:
-                                               // "User authentication failed"
-                                               //
-                                               throw new PSQLException("postgresql.con.misc", PSQLState.CONNECTION_REJECTED, pgStream.ReceiveString(encoding));
-
-                                       case 'R':
-                                               // Get the type of request
-                                               areq = pgStream.ReceiveIntegerR(4);
-                                               // Get the crypt password salt if there is one
-                                               if (areq == AUTH_REQ_CRYPT)
-                                               {
-                                                       byte[] rst = new byte[2];
-                                                       rst[0] = (byte)pgStream.ReceiveChar();
-                                                       rst[1] = (byte)pgStream.ReceiveChar();
-                                                       salt = new String(rst, 0, 2);
-                                                       if (Driver.logDebug)
-                                                               Driver.debug("Crypt salt=" + salt);
-                                               }
-
-                                               // Or get the md5 password salt if there is one
-                                               if (areq == AUTH_REQ_MD5)
-                                               {
-
-                                                       md5Salt[0] = (byte)pgStream.ReceiveChar();
-                                                       md5Salt[1] = (byte)pgStream.ReceiveChar();
-                                                       md5Salt[2] = (byte)pgStream.ReceiveChar();
-                                                       md5Salt[3] = (byte)pgStream.ReceiveChar();
-                                                       salt = new String(md5Salt, 0, 4);
-                                                       if (Driver.logDebug)
-                                                               Driver.debug("MD5 salt=" + salt);
-                                               }
-
-                                               // now send the auth packet
-                                               switch (areq)
-                                               {
-                                                       case AUTH_REQ_OK:
-                                                               break;
-
-                                                       case AUTH_REQ_KRB4:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: KRB4");
-                                                               throw new PSQLException("postgresql.con.kerb4", PSQLState.CONNECTION_REJECTED);
-
-                                                       case AUTH_REQ_KRB5:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: KRB5");
-                                                               throw new PSQLException("postgresql.con.kerb5", PSQLState.CONNECTION_REJECTED);
-
-                                                       case AUTH_REQ_PASSWORD:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: PASSWORD");
-                                                               pgStream.SendInteger(5 + password.length(), 4);
-                                                               pgStream.Send(password.getBytes());
-                                                               pgStream.SendInteger(0, 1);
-                                                               pgStream.flush();
-                                                               break;
-
-                                                       case AUTH_REQ_CRYPT:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: CRYPT");
-                                                               String crypted = UnixCrypt.crypt(salt, password);
-                                                               pgStream.SendInteger(5 + crypted.length(), 4);
-                                                               pgStream.Send(crypted.getBytes());
-                                                               pgStream.SendInteger(0, 1);
-                                                               pgStream.flush();
-                                                               break;
-
-                                                       case AUTH_REQ_MD5:
-                                                               if (Driver.logDebug)
-                                                                       Driver.debug("postgresql: MD5");
-                                                               byte[] digest = MD5Digest.encode(PG_USER, password, md5Salt);
-                                                               pgStream.SendInteger(5 + digest.length, 4);
-                                                               pgStream.Send(digest);
-                                                               pgStream.SendInteger(0, 1);
-                                                               pgStream.flush();
-                                                               break;
-
-                                                       default:
-                                                               throw new PSQLException("postgresql.con.auth", PSQLState.CONNECTION_REJECTED, new Integer(areq));
-                                               }
-                                               break;
-
-                                       default:
-                                               throw new PSQLException("postgresql.con.authfail", PSQLState.CONNECTION_REJECTED);
-                               }
-                       }
-                       while (areq != AUTH_REQ_OK);
-
-               }
-               catch (IOException e)
-               {
-                       //Should be passing exception as arg.
-                       throw new PSQLException("postgresql.con.failed", PSQLState.CONNECTION_UNABLE_TO_CONNECT, e);
-               }
-
-
-               // As of protocol version 2.0, we should now receive the cancellation key and the pid
-               int beresp;
-               do
-               {
-                       beresp = pgStream.ReceiveChar();
-                       switch (beresp)
-                       {
-                               case 'K':
-                                       pid = pgStream.ReceiveIntegerR(4);
-                                       ckey = pgStream.ReceiveIntegerR(4);
-                                       break;
-                               case 'E':
-                                       throw new PSQLException("postgresql.con.backend", PSQLState.CONNECTION_UNABLE_TO_CONNECT, pgStream.ReceiveString(encoding));
-                               case 'N':
-                                       addWarning(pgStream.ReceiveString(encoding));
-                                       break;
-                               default:
-                                       throw new PSQLException("postgresql.con.setup", PSQLState.CONNECTION_UNABLE_TO_CONNECT);
-                       }
-               }
-               while (beresp == 'N');
-
-               // Expect ReadyForQuery packet
-               do
-               {
-                       beresp = pgStream.ReceiveChar();
-                       switch (beresp)
-                       {
-                               case 'Z':
-                                       break;
-                               case 'N':
-                                       addWarning(pgStream.ReceiveString(encoding));
-                                       break;
-                               case 'E':
-                                       throw new PSQLException("postgresql.con.backend", PSQLState.CONNECTION_UNABLE_TO_CONNECT, pgStream.ReceiveString(encoding));
-                               default:
-                                       throw new PSQLException("postgresql.con.setup", PSQLState.CONNECTION_UNABLE_TO_CONNECT);
-                       }
-               }
-               while (beresp == 'N');
-               // "pg_encoding_to_char(1)" will return 'EUC_JP' for a backend compiled with multibyte,
-               // otherwise it's hardcoded to 'SQL_ASCII'.
-               // If the backend doesn't know about multibyte we can't assume anything about the encoding
-               // used, so we denote this with 'UNKNOWN'.
-               //Note: begining with 7.2 we should be using pg_client_encoding() which
-               //is new in 7.2.  However it isn't easy to conditionally call this new
-               //function, since we don't yet have the information as to what server
-               //version we are talking to.  Thus we will continue to call
-               //getdatabaseencoding() until we drop support for 7.1 and older versions
-               //or until someone comes up with a conditional way to run one or
-               //the other function depending on server version that doesn't require
-               //two round trips to the server per connection
-
-               final String encodingQuery =
-                       "case when pg_encoding_to_char(1) = 'SQL_ASCII' then 'UNKNOWN' else getdatabaseencoding() end";
-
-               // Set datestyle and fetch db encoding in a single call, to avoid making
-               // more than one round trip to the backend during connection startup.
-
-
-               BaseResultSet resultSet
-                       = execSQL("set datestyle to 'ISO'; select version(), " + encodingQuery + ";");
-               
-               if (! resultSet.next())
-               {
-                       throw new PSQLException("postgresql.con.failed.bad.encoding", PSQLState.CONNECTION_UNABLE_TO_CONNECT);
-               }
-               String version = resultSet.getString(1);
-               dbVersionNumber = extractVersionNumber(version);
-
-               String dbEncoding = resultSet.getString(2);
-               encoding = Encoding.getEncoding(dbEncoding, info.getProperty("charSet"));
-               
-               //TODO: remove this once the set is done as part of V3protocol connection initiation
-               if (haveMinimumServerVersion("7.4")) 
-               {
-                       BaseResultSet acRset =
-                               execSQL("set client_encoding = 'UNICODE'");
-
-                       //set encoding to be unicode
-                       encoding = Encoding.getEncoding("UNICODE", null);
-               }
-
-               //In 7.3 we are forced to do a second roundtrip to handle the case 
-               //where a database may not be running in autocommit mode
-               //jdbc by default assumes autocommit is on until setAutoCommit(false)
-               //is called.  Therefore we need to ensure a new connection is 
-               //initialized to autocommit on.
-               //We also set the client encoding so that the driver only needs 
-               //to deal with utf8.  We can only do this in 7.3+ because multibyte 
-               //support is now always included
-               if (haveMinimumServerVersion("7.3")  && !haveMinimumServerVersion("7.4")) 
-               {
-                       BaseResultSet acRset =
-                               execSQL("set client_encoding = 'UNICODE'; show autocommit");
-
-                       //set encoding to be unicode
-                       encoding = Encoding.getEncoding("UNICODE", null);
-
-                       if (!acRset.next())
-                       {
-                               throw new PSQLException("postgresql.con.failed.bad.autocommit", PSQLState.CONNECTION_UNABLE_TO_CONNECT);
-                       }
-                       //if autocommit is currently off we need to turn it on
-                       //note that we will be in a transaction because the select above
-                       //will have initiated the transaction so we need a commit
-                       //to make the setting permanent
-                       if (acRset.getString(1).equals("off"))
-                       {
-                               execSQL("set autocommit = on; commit;");
-                       }
-               }
-
-               // Initialise object handling
-               initObjectTypes();
-
-               // Mark the connection as ok, and cleanup
-               PG_STATUS = CONNECTION_OK;
-       }
-
-       /*
-        * Return the instance of org.postgresql.Driver
-        * that created this connection
-        */
-       public Driver getDriver()
-       {
-               return this_driver;
-       }
-
-
-       /*
-        * This adds a warning to the warning chain.
-        * @param msg message to add
-        */
-       public void addWarning(String msg)
-       {
-               // Add the warning to the chain
-               if (firstWarning != null)
-                       firstWarning.setNextWarning(new SQLWarning(msg));
-               else
-                       firstWarning = new SQLWarning(msg);
-
-               // Now check for some specific messages
-
-               // This is obsolete in 6.5, but I've left it in here so if we need to use this
-               // technique again, we'll know where to place it.
-               //
-               // This is generated by the SQL "show datestyle"
-               //if (msg.startsWith("NOTICE:") && msg.indexOf("DateStyle")>0) {
-               //// 13 is the length off "DateStyle is "
-               //msg = msg.substring(msg.indexOf("DateStyle is ")+13);
-               //
-               //for(int i=0;i<dateStyles.length;i+=2)
-               //if (msg.startsWith(dateStyles[i]))
-               //currentDateStyle=i+1; // this is the index of the format
-               //}
-       }
-
-       /** Simple query execution.
-        */
-       public BaseResultSet execSQL (String s) throws SQLException
-       {
-               final Object[] nullarr = new Object[0];
-               BaseStatement stat = (BaseStatement) createStatement();
-               return QueryExecutor.execute(new String[] { s }, 
-                                                                        nullarr, 
-                                                                        stat);
-       }
-
-       /*
-        * In SQL, a result table can be retrieved through a cursor that
-        * is named.  The current row of a result can be updated or deleted
-        * using a positioned update/delete statement that references the
-        * cursor name.
-        *
-        * We support one cursor per connection.
-        *
-        * setCursorName sets the cursor name.
-        *
-        * @param cursor the cursor name
-        * @exception SQLException if a database access error occurs
-        */
-       public void setCursorName(String cursor) throws SQLException
-       {
-               this.cursor = cursor;
-       }
-
-       /*
-        * getCursorName gets the cursor name.
-        *
-        * @return the current cursor name
-        * @exception SQLException if a database access error occurs
-        */
-       public String getCursorName() throws SQLException
-       {
-               return cursor;
-       }
-
-       /*
-        * We are required to bring back certain information by
-        * the DatabaseMetaData class.  These functions do that.
-        *
-        * Method getURL() brings back the URL (good job we saved it)
-        *
-        * @return the url
-        * @exception SQLException just in case...
-        */
-       public String getURL() throws SQLException
-       {
-               return this_url;
-       }
-
-       /*
-        * Method getUserName() brings back the User Name (again, we
-        * saved it)
-        *
-        * @return the user name
-        * @exception SQLException just in case...
-        */
-       int lastMessage = 0;
-       public String getUserName() throws SQLException
-       {
-               return PG_USER;
-       }
-
-       /*
-        * Get the character encoding to use for this connection.
-        */
-       public Encoding getEncoding() throws SQLException
-       {
-               return encoding;
-       }
-
-       /*
-        * This returns the Fastpath API for the current connection.
-        *
-        * <p><b>NOTE:</b> This is not part of JDBC, but allows access to
-        * functions on the org.postgresql backend itself.
-        *
-        * <p>It is primarily used by the LargeObject API
-        *
-        * <p>The best way to use this is as follows:
-        *
-        * <p><pre>
-        * import org.postgresql.fastpath.*;
-        * ...
-        * Fastpath fp = ((org.postgresql.Connection)myconn).getFastpathAPI();
-        * </pre>
-        *
-        * <p>where myconn is an open Connection to org.postgresql.
-        *
-        * @return Fastpath object allowing access to functions on the org.postgresql
-        * backend.
-        * @exception SQLException by Fastpath when initialising for first time
-        */
-       public Fastpath getFastpathAPI() throws SQLException
-       {
-               if (fastpath == null)
-                       fastpath = new Fastpath(this, pgStream);
-               return fastpath;
-       }
-
-       // This holds a reference to the Fastpath API if already open
-       private Fastpath fastpath = null;
-
-       /*
-        * This returns the LargeObject API for the current connection.
-        *
-        * <p><b>NOTE:</b> This is not part of JDBC, but allows access to
-        * functions on the org.postgresql backend itself.
-        *
-        * <p>The best way to use this is as follows:
-        *
-        * <p><pre>
-        * import org.postgresql.largeobject.*;
-        * ...
-        * LargeObjectManager lo = ((org.postgresql.Connection)myconn).getLargeObjectAPI();
-        * </pre>
-        *
-        * <p>where myconn is an open Connection to org.postgresql.
-        *
-        * @return LargeObject object that implements the API
-        * @exception SQLException by LargeObject when initialising for first time
-        */
-       public LargeObjectManager getLargeObjectAPI() throws SQLException
-       {
-               if (largeobject == null)
-                       largeobject = new LargeObjectManager(this);
-               return largeobject;
-       }
-
-       // This holds a reference to the LargeObject API if already open
-       private LargeObjectManager largeobject = null;
-
-       /*
-        * 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
-        */
-       public Object getObject(String type, String value) throws SQLException
-       {
-               try
-               {
-                       Object o = objectTypes.get(type);
-
-                       // If o is null, then the type is unknown.
-                       // If o is not null, and it is a String, then its a class name that
-                       // extends PGobject.
-                       //
-                       // This is used to implement the org.postgresql unique types (like lseg,
-                       // point, etc).
-                       if (o != null && o instanceof String)
-                       {
-                               // 6.3 style extending PG_Object
-                               PGobject obj = null;
-                               obj = (PGobject)(Class.forName((String)o).newInstance());
-                               obj.setType(type);
-                               obj.setValue(value);
-                               return (Object)obj;
-                       }
-               }
-               catch (SQLException sx)
-               {
-                       // rethrow the exception. Done because we capture any others next
-                       sx.fillInStackTrace();
-                       throw sx;
-               }
-               catch (Exception ex)
-               {
-                       throw new PSQLException("postgresql.con.creobj", PSQLState.CONNECTION_FAILURE, type, ex);
-               }
-
-               // should never be reached
-               return null;
-       }
-
-       /*
-        * This allows client code to add a handler for one of org.postgresql's
-        * more unique data types.
-        *
-        * <p><b>NOTE:</b> This is not part of JDBC, but an extension.
-        *
-        * <p>The best way to use this is as follows:
-        *
-        * <p><pre>
-        * ...
-        * ((org.postgresql.Connection)myconn).addDataType("mytype","my.class.name");
-        * ...
-        * </pre>
-        *
-        * <p>where myconn is an open Connection to org.postgresql.
-        *
-        * <p>The handling class must extend org.postgresql.util.PGobject
-        *
-        * @see org.postgresql.util.PGobject
-        */
-       public void addDataType(String type, String name)
-       {
-               objectTypes.put(type, name);
-       }
-
-       // This holds the available types
-       private Hashtable objectTypes = new Hashtable();
-
-       // This array contains the types that are supported as standard.
-       //
-       // The first entry is the types name on the database, the second
-       // the full class name of the handling class.
-       //
-       private static final String defaultObjectTypes[][] = {
-                               {"box", "org.postgresql.geometric.PGbox"},
-                               {"circle", "org.postgresql.geometric.PGcircle"},
-                               {"line", "org.postgresql.geometric.PGline"},
-                               {"lseg", "org.postgresql.geometric.PGlseg"},
-                               {"path", "org.postgresql.geometric.PGpath"},
-                               {"point", "org.postgresql.geometric.PGpoint"},
-                               {"polygon", "org.postgresql.geometric.PGpolygon"},
-                               {"money", "org.postgresql.util.PGmoney"}
-                       };
-
-       // This initialises the objectTypes hashtable
-       private void initObjectTypes()
-       {
-               for (int i = 0;i < defaultObjectTypes.length;i++)
-                       objectTypes.put(defaultObjectTypes[i][0], defaultObjectTypes[i][1]);
-       }
-
-       /*
-        * In some cases, it is desirable to immediately release a Connection's
-        * database and JDBC resources instead of waiting for them to be
-        * automatically released (cant think why off the top of my head)
-        *
-        * <B>Note:</B> A Connection is automatically closed when it is
-        * garbage collected.  Certain fatal errors also result in a closed
-        * connection.
-        *
-        * @exception SQLException if a database access error occurs
-        */
-       public void close() throws SQLException
-       {
-               if (getPGProtocolVersionMajor() == 3) {
-                       closeV3();
-               } else {
-                       closeV2();
-               }
-       }
-
-       public void closeV3() throws SQLException
-       {
-               if (pgStream != null)
-               {
-                       try
-                       {
-                               pgStream.SendChar('X');
-                               pgStream.SendInteger(4,4);
-                               pgStream.flush();
-                               pgStream.close();
-                       }
-                       catch (IOException e)
-                       {}
-                       finally
-                       {
-                               pgStream = null;
-                       }
-               }
-       }
-
-       public void closeV2() throws SQLException
-       {
-               if (pgStream != null)
-               {
-                       try
-                       {
-                               pgStream.SendChar('X');
-                               pgStream.flush();
-                               pgStream.close();
-                       }
-                       catch (IOException e)
-                       {}
-                       finally
-                       {
-                               pgStream = null;
-                       }
-               }
-       }
-
-       /*
-        * A driver may convert the JDBC sql grammar into its system's
-        * native SQL grammar prior to sending it; nativeSQL returns the
-        * native form of the statement that the driver would have sent.
-        *
-        * @param sql a SQL statement that may contain one or more '?'
-        *      parameter placeholders
-        * @return the native form of this statement
-        * @exception SQLException if a database access error occurs
-        */
-       public String nativeSQL(String sql) throws SQLException
-       {
-               return sql;
-       }
-
-       /*
-        * The first warning reported by calls on this Connection is
-        * returned.
-        *
-        * <B>Note:</B> Sebsequent warnings will be changed to this
-        * SQLWarning
-        *
-        * @return the first SQLWarning or null
-        * @exception SQLException if a database access error occurs
-        */
-       public SQLWarning getWarnings() throws SQLException
-       {
-               return firstWarning;
-       }
-
-       /*
-        * After this call, getWarnings returns null until a new warning
-        * is reported for this connection.
-        *
-        * @exception SQLException if a database access error occurs
-        */
-       public void clearWarnings() throws SQLException
-       {
-               firstWarning = null;
-       }
-
-
-       /*
-        * You can put a connection in read-only mode as a hunt to enable
-        * database optimizations
-        *
-        * <B>Note:</B> setReadOnly cannot be called while in the middle
-        * of a transaction
-        *
-        * @param readOnly - true enables read-only mode; false disables it
-        * @exception SQLException if a database access error occurs
-        */
-       public void setReadOnly(boolean readOnly) throws SQLException
-       {
-               this.readOnly = readOnly;
-       }
-
-       /*
-        * Tests to see if the connection is in Read Only Mode.  Note that
-        * we cannot really put the database in read only mode, but we pretend
-        * we can by returning the value of the readOnly flag
-        *
-        * @return true if the connection is read only
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isReadOnly() throws SQLException
-       {
-               return readOnly;
-       }
-
-       /*
-        * If a connection is in auto-commit mode, than all its SQL
-        * statements will be executed and committed as individual
-        * transactions.  Otherwise, its SQL statements are grouped
-        * into transactions that are terminated by either commit()
-        * or rollback().  By default, new connections are in auto-
-        * commit mode.  The commit occurs when the statement completes
-        * or the next execute occurs, whichever comes first.  In the
-        * case of statements returning a ResultSet, the statement
-        * completes when the last row of the ResultSet has been retrieved
-        * or the ResultSet has been closed.  In advanced cases, a single
-        * statement may return multiple results as well as output parameter
-        * values.      Here the commit occurs when all results and output param
-        * values have been retrieved.
-        *
-        * @param autoCommit - true enables auto-commit; false disables it
-        * @exception SQLException if a database access error occurs
-        */
-       public void setAutoCommit(boolean autoCommit) throws SQLException
-       {
-               if (this.autoCommit == autoCommit)
-                       return ;
-               if (autoCommit)
-               {
-                               execSQL("end");                         
-               }
-               else
-               {
-                       if (haveMinimumServerVersion("7.1"))
-                       {
-                               execSQL("begin;" + getIsolationLevelSQL());
-                       }
-                       else
-                       {
-                               execSQL("begin");
-                               execSQL(getIsolationLevelSQL());
-                       }
-               }
-               this.autoCommit = autoCommit;
-       }
-
-       /*
-        * gets the current auto-commit state
-        *
-        * @return Current state of the auto-commit mode
-        * @see setAutoCommit
-        */
-       public boolean getAutoCommit()
-       {
-               return this.autoCommit;
-       }
-
-       /*
-        * The method commit() makes all changes made since the previous
-        * commit/rollback permanent and releases any database locks currently
-        * held by the Connection.      This method should only be used when
-        * auto-commit has been disabled.  (If autoCommit == true, then we
-        * just return anyhow)
-        *
-        * @exception SQLException if a database access error occurs
-        * @see setAutoCommit
-        */
-       public void commit() throws SQLException
-       {
-               if (autoCommit)
-                       return ;
-               //TODO: delay starting new transaction until first command
-               if (haveMinimumServerVersion("7.1"))
-               {
-                       execSQL("commit;begin;" + getIsolationLevelSQL());
-               }
-               else
-               {
-                       execSQL("commit");
-                       execSQL("begin");
-                       execSQL(getIsolationLevelSQL());
-               }
-       }
-
-       /*
-        * The method rollback() drops all changes made since the previous
-        * commit/rollback and releases any database locks currently held by
-        * the Connection.
-        *
-        * @exception SQLException if a database access error occurs
-        * @see commit
-        */
-       public void rollback() throws SQLException
-       {
-               if (autoCommit)
-                       return ;
-               //TODO: delay starting transaction until first command
-               if (haveMinimumServerVersion("7.1"))
-               {
-                       execSQL("rollback; begin;" + getIsolationLevelSQL());
-               }
-               else
-               {
-                       execSQL("rollback");
-                       execSQL("begin");
-                       execSQL(getIsolationLevelSQL());
-               }
-       }
-
-       /*
-        * Get this Connection's current transaction isolation mode.
-        *
-        * @return the current TRANSACTION_* mode value
-        * @exception SQLException if a database access error occurs
-        */
-       public int getTransactionIsolation() throws SQLException
-       {
-               String sql = "show transaction isolation level";
-               String level = null;
-               if (haveMinimumServerVersion("7.3")) {
-                       BaseResultSet rs = execSQL(sql);
-                       if (rs.next()) {
-                               level = rs.getString(1);
-                       }
-                       rs.close();
-               } else {
-                       BaseResultSet l_rs = execSQL(sql);
-                       BaseStatement l_stat = l_rs.getPGStatement();
-                       SQLWarning warning = l_stat.getWarnings();
-                       if (warning != null)
-                       {
-                               level = warning.getMessage();
-                       }
-                       l_rs.close();
-                       l_stat.close();
-               }
-               if (level != null) {
-                       level = level.toUpperCase();
-                       if (level.indexOf("READ COMMITTED") != -1)
-                               return Connection.TRANSACTION_READ_COMMITTED;
-                       else if (level.indexOf("READ UNCOMMITTED") != -1)
-                               return Connection.TRANSACTION_READ_UNCOMMITTED;
-                       else if (level.indexOf("REPEATABLE READ") != -1)
-                               return Connection.TRANSACTION_REPEATABLE_READ;
-                       else if (level.indexOf("SERIALIZABLE") != -1)
-                               return Connection.TRANSACTION_SERIALIZABLE;
-               }
-               return Connection.TRANSACTION_READ_COMMITTED;
-       }
-
-       /*
-        * You can call this method to try to change the transaction
-        * isolation level using one of the TRANSACTION_* values.
-        *
-        * <B>Note:</B> setTransactionIsolation cannot be called while
-        * in the middle of a transaction
-        *
-        * @param level one of the TRANSACTION_* isolation values with
-        *      the exception of TRANSACTION_NONE; some databases may
-        *      not support other values
-        * @exception SQLException if a database access error occurs
-        * @see java.sql.DatabaseMetaData#supportsTransactionIsolationLevel
-        */
-       public void setTransactionIsolation(int level) throws SQLException
-       {
-               //In 7.1 and later versions of the server it is possible using
-               //the "set session" command to set this once for all future txns
-               //however in 7.0 and prior versions it is necessary to set it in
-               //each transaction, thus adding complexity below.
-               //When we decide to drop support for servers older than 7.1
-               //this can be simplified
-               isolationLevel = level;
-               String isolationLevelSQL;
-
-               if (!haveMinimumServerVersion("7.1"))
-               {
-                       isolationLevelSQL = getIsolationLevelSQL();
-               }
-               else
-               {
-                       isolationLevelSQL = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL ";
-                       switch (isolationLevel)
-                       {
-                               case Connection.TRANSACTION_READ_COMMITTED:
-                                       isolationLevelSQL += "READ COMMITTED";
-                                       break;
-                               case Connection.TRANSACTION_SERIALIZABLE:
-                                       isolationLevelSQL += "SERIALIZABLE";
-                                       break;
-                               default:
-                                       throw new PSQLException("postgresql.con.isolevel", PSQLState.TRANSACTION_STATE_INVALID,
-                                                                                       new Integer(isolationLevel));
-                       }
-               }
-               execSQL(isolationLevelSQL);
-       }
-
-       /*
-        * Helper method used by setTransactionIsolation(), commit(), rollback()
-        * and setAutoCommit(). This returns the SQL string needed to
-        * set the isolation level for a transaction.  In 7.1 and later it
-        * is possible to set a default isolation level that applies to all
-        * future transactions, this method is only necesary for 7.0 and older
-        * servers, and should be removed when support for these older
-        * servers are dropped
-        */
-       protected String getIsolationLevelSQL() throws SQLException
-       {
-               //7.1 and higher servers have a default specified so
-               //no additional SQL is required to set the isolation level
-               if (haveMinimumServerVersion("7.1"))
-               {
-                       return "";
-               }
-               StringBuffer sb = new StringBuffer("SET TRANSACTION ISOLATION LEVEL");
-
-               switch (isolationLevel)
-               {
-                       case Connection.TRANSACTION_READ_COMMITTED:
-                               sb.append(" READ COMMITTED");
-                               break;
-
-                       case Connection.TRANSACTION_SERIALIZABLE:
-                               sb.append(" SERIALIZABLE");
-                               break;
-
-                       default:
-                               throw new PSQLException("postgresql.con.isolevel", PSQLState.TRANSACTION_STATE_INVALID, new Integer(isolationLevel));
-               }
-               return sb.toString();
-       }
-
-       /*
-        * A sub-space of this Connection's database may be selected by
-        * setting a catalog name.      If the driver does not support catalogs,
-        * it will silently ignore this request
-        *
-        * @exception SQLException if a database access error occurs
-        */
-       public void setCatalog(String catalog) throws SQLException
-       {
-               //no-op
-       }
-
-       /*
-        * Return the connections current catalog name, or null if no
-        * catalog name is set, or we dont support catalogs.
-        *
-        * @return the current catalog name or null
-        * @exception SQLException if a database access error occurs
-        */
-       public String getCatalog() throws SQLException
-       {
-               return PG_DATABASE;
-       }
-
-       /*
-        * Overides finalize(). If called, it closes the connection.
-        *
-        * This was done at the request of Rachel Greenham
-        * <rachel@enlarion.demon.co.uk> who hit a problem where multiple
-        * clients didn't close the connection, and once a fortnight enough
-        * clients were open to kill the org.postgres server.
-        */
-       public void finalize() throws Throwable
-       {
-               close();
-       }
-
-       private static String extractVersionNumber(String fullVersionString)
-       {
-               StringTokenizer versionParts = new StringTokenizer(fullVersionString);
-               versionParts.nextToken(); /* "PostgreSQL" */
-               return versionParts.nextToken(); /* "X.Y.Z" */
-       }
-
-       /*
-        * Get server version number
-        */
-       public String getDBVersionNumber()
-       {
-               return dbVersionNumber;
-       }
-
-       // Parse a "dirty" integer surrounded by non-numeric characters
-       private static int integerPart(String dirtyString)
-       {
-               int start, end;
-
-               for (start = 0; start < dirtyString.length() && !Character.isDigit(dirtyString.charAt(start)); ++start)
-                       ;
-               
-               for (end = start; end < dirtyString.length() && Character.isDigit(dirtyString.charAt(end)); ++end)
-                       ;
-
-               if (start == end)
-                       return 0;
-
-               return Integer.parseInt(dirtyString.substring(start, end));
-       }
-
-       /*
-        * Get server major version
-        */
-       public int getServerMajorVersion()
-       {        
-               try
-               {
-                       StringTokenizer versionTokens = new StringTokenizer(dbVersionNumber, ".");  // aaXbb.ccYdd       
-                       return integerPart(versionTokens.nextToken()); // return X
-               }
-               catch (NoSuchElementException e)
-               {
-                       return 0;
-               }
-       }
-
-       /*
-        * Get server minor version
-        */
-       public int getServerMinorVersion()
-       {        
-               try
-               {
-                       StringTokenizer versionTokens = new StringTokenizer(dbVersionNumber, ".");  // aaXbb.ccYdd
-                       versionTokens.nextToken(); // Skip aaXbb
-                       return integerPart(versionTokens.nextToken()); // return Y
-               }
-               catch (NoSuchElementException e)
-               {
-                       return 0;
-               }
-       }
-       
-       /**
-        * Is the server we are connected to running at least this version?
-        * This comparison method will fail whenever a major or minor version
-        * goes to two digits (10.3.0) or (7.10.1).
-        */
-       public boolean haveMinimumServerVersion(String ver) throws SQLException
-       {
-               return (getDBVersionNumber().compareTo(ver) >= 0);
-       }
-
-       /*
-        * This method returns true if the compatible level set in the connection
-        * (which can be passed into the connection or specified in the URL)
-        * is at least the value passed to this method.  This is used to toggle
-        * between different functionality as it changes across different releases
-        * of the jdbc driver code.  The values here are versions of the jdbc client
-        * and not server versions.  For example in 7.1 get/setBytes worked on
-        * LargeObject values, in 7.2 these methods were changed to work on bytea
-        * values.      This change in functionality could be disabled by setting the
-        * "compatible" level to be 7.1, in which case the driver will revert to
-        * the 7.1 functionality.
-        */
-       public boolean haveMinimumCompatibleVersion(String ver) throws SQLException
-       {
-               return (compatible.compareTo(ver) >= 0);
-       }
-
-
-       /*
-        * This returns the java.sql.Types type for a PG type oid
-        *
-        * @param oid PostgreSQL type oid
-        * @return the java.sql.Types type
-        * @exception SQLException if a database access error occurs
-        */
-       public int getSQLType(int oid) throws SQLException
-       {
-               Integer sqlType = (Integer)sqlTypeCache.get(new Integer(oid));
-
-               // it's not in the cache, so perform a query, and add the result to the cache
-               if (sqlType == null)
-               {
-                       String pgType;
-                       // The opaque type does not exist in the system catalogs.
-                       if (oid == 0) {
-                               pgType = "opaque";
-                       } else {
-                               String sql;
-                               if (haveMinimumServerVersion("7.3")) {
-                                       sql = "SELECT typname FROM pg_catalog.pg_type WHERE oid = " +oid;
-                               } else {
-                                       sql = "SELECT typname FROM pg_type WHERE oid = " +oid;
-                               }
-                               BaseResultSet result = execSQL(sql);
-                               if (result.getColumnCount() != 1 || result.getTupleCount() != 1) {
-                                       throw new PSQLException("postgresql.unexpected", PSQLState.UNEXPECTED_ERROR);
-                               }
-                               result.next();
-                               pgType = result.getString(1);
-                               result.close();
-                       }
-                       Integer iOid = new Integer(oid);
-                       sqlType = new Integer(getSQLType(pgType));
-                       sqlTypeCache.put(iOid, sqlType);
-                       pgTypeCache.put(iOid, pgType);
-               }
-
-               return sqlType.intValue();
-       }
-
-       /*
-        * This returns the oid for a given PG data type
-        * @param typeName PostgreSQL type name
-        * @return PostgreSQL oid value for a field of this type
-        */
-       public int getPGType(String typeName) throws SQLException
-       {
-               int oid = -1;
-               if (typeName != null)
-               {
-                       Integer oidValue = (Integer) typeOidCache.get(typeName);
-                       if (oidValue != null)
-                       {
-                               oid = oidValue.intValue();
-                       }
-                       else
-                       {
-                               // it's not in the cache, so perform a query, and add the result to the cache
-                               String sql;
-                               if (haveMinimumServerVersion("7.3")) {
-                                       sql = "SELECT oid FROM pg_catalog.pg_type WHERE typname='" + typeName + "'";
-                               } else {
-                                       sql = "SELECT oid FROM pg_type WHERE typname='" + typeName + "'";
-                               }
-                               BaseResultSet result = execSQL(sql);
-                               if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
-                                       throw new PSQLException("postgresql.unexpected", PSQLState.UNEXPECTED_ERROR);
-                               result.next();
-                               oid = Integer.parseInt(result.getString(1));
-                               typeOidCache.put(typeName, new Integer(oid));
-                               result.close();
-                       }
-               }
-               return oid;
-       }
-
-       /*
-        * We also need to get the PG type name as returned by the back end.
-        *
-        * @return the String representation of the type of this field
-        * @exception SQLException if a database access error occurs
-        */
-       public String getPGType(int oid) throws SQLException
-       {
-               String pgType = (String) pgTypeCache.get(new Integer(oid));
-               if (pgType == null)
-               {
-                       getSQLType(oid);
-                       pgType = (String) pgTypeCache.get(new Integer(oid));
-               }
-               return pgType;
-       }
-
-       //Because the get/setLogStream methods are deprecated in JDBC2
-       //we use them for JDBC1 here and override this method in the jdbc2
-       //version of this class
-       protected void enableDriverManagerLogging()
-       {
-               if (DriverManager.getLogStream() == null)
-               {
-                       DriverManager.setLogStream(System.out);
-               }
-       }
-
-       // This is a cache of the DatabaseMetaData instance for this connection
-       protected java.sql.DatabaseMetaData metadata;
-
-
-       /*
-        * Tests to see if a Connection is closed
-        *
-        * @return the status of the connection
-        * @exception SQLException (why?)
-        */
-       public boolean isClosed() throws SQLException
-       {
-               return (pgStream == null);
-       }
-
-       /*
-        * This implemetation uses the jdbc1Types array to support the jdbc1
-        * datatypes.  Basically jdbc1 and jdbc2 are the same, except that
-        * jdbc2 adds the Array types.
-        */
-       public int getSQLType(String pgTypeName)
-       {
-               int sqlType = Types.OTHER; // default value
-               for (int i = 0;i < jdbc1Types.length;i++)
-               {
-                       if (pgTypeName.equals(jdbc1Types[i]))
-                       {
-                               sqlType = jdbc1Typei[i];
-                               break;
-                       }
-               }
-               return sqlType;
-       }
-
-       /*
-        * This table holds the org.postgresql names for the types supported.
-        * Any types that map to Types.OTHER (eg POINT) don't go into this table.
-        * They default automatically to Types.OTHER
-        *
-        * Note: This must be in the same order as below.
-        *
-        * Tip: keep these grouped together by the Types. value
-        */
-       private static final String jdbc1Types[] = {
-                               "int2",
-                               "int4", "oid",
-                               "int8",
-                               "cash", "money",
-                               "numeric",
-                               "float4",
-                               "float8",
-                               "bpchar", "char", "char2", "char4", "char8", "char16",
-                               "varchar", "text", "name", "filename",
-                               "bytea",
-                               "bool",
-                               "bit",
-                               "date",
-                               "time",
-                               "abstime", "timestamp", "timestamptz"
-                       };
-
-       /*
-        * This table holds the JDBC type for each entry above.
-        *
-        * Note: This must be in the same order as above
-        *
-        * Tip: keep these grouped together by the Types. value
-        */
-       private static final int jdbc1Typei[] = {
-               Types.SMALLINT,
-               Types.INTEGER, Types.INTEGER,
-               Types.BIGINT,
-               Types.DOUBLE, Types.DOUBLE,
-               Types.NUMERIC,
-               Types.REAL,
-               Types.DOUBLE,
-               Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR,
-               Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
-               Types.BINARY,
-               Types.BIT,
-               Types.BIT,
-               Types.DATE,
-               Types.TIME,
-               Types.TIMESTAMP, Types.TIMESTAMP, Types.TIMESTAMP
-       };
-
-       public void cancelQuery() throws SQLException
-       {
-               org.postgresql.core.PGStream cancelStream = null;
-               try
-               {
-                       cancelStream = new org.postgresql.core.PGStream(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", PSQLState.CONNECTION_REJECTED);
-               }
-               catch (IOException e)
-               {
-                       throw new PSQLException ("postgresql.con.failed", PSQLState.CONNECTION_UNABLE_TO_CONNECT, 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", PSQLState.CONNECTION_UNABLE_TO_CONNECT, e);
-               }
-               finally
-               {
-                       try
-                       {
-                               if (cancelStream != null)
-                                       cancelStream.close();
-                       }
-                       catch (IOException e)
-                       {} // Ignore
-               }
-       }
-
-
-       //Methods to support postgres notifications
-       public void addNotification(org.postgresql.PGNotification p_notification)
-       {
-               if (m_notifications == null)
-                       m_notifications = new Vector();
-               m_notifications.addElement(p_notification);
-       }
-
-       public PGNotification[] getNotifications()
-       {
-               PGNotification[] l_return = null;
-               if (m_notifications != null)
-               {
-                       l_return = new PGNotification[m_notifications.size()];
-                       m_notifications.copyInto(l_return);
-               }
-               m_notifications = null;
-               return l_return;
-       }
-}
-
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
deleted file mode 100644 (file)
index d716193..0000000
+++ /dev/null
@@ -1,3660 +0,0 @@
-package org.postgresql.jdbc1;
-
-
-import java.sql.*;
-import java.util.*;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-import org.postgresql.core.Encoding;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-import org.postgresql.Driver;
-
-public abstract class AbstractJdbc1DatabaseMetaData
-{
-
-       private static final String keywords = "abort,acl,add,aggregate,append,archive," +
-                                                                                  "arch_store,backward,binary,boolean,change,cluster," +
-                                                                                  "copy,database,delimiter,delimiters,do,extend," +
-                                                                                  "explain,forward,heavy,index,inherits,isnull," +
-                                                                                  "light,listen,load,merge,nothing,notify," +
-                                                                                  "notnull,oids,purge,rename,replace,retrieve," +
-                                                                                  "returns,rule,recipe,setof,stdin,stdout,store," +
-                                                                                  "vacuum,verbose,version";
-
-       protected AbstractJdbc1Connection connection; // The connection association
-       protected Encoding encoding;
-
-       // These define various OID's. Hopefully they will stay constant.
-       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
-
-       private int NAMEDATALEN = 0;    // length for name datatype
-       private int INDEX_MAX_KEYS = 0; // maximum number of keys in an index.
-
-       protected int getMaxIndexKeys() throws SQLException {
-               if (INDEX_MAX_KEYS == 0) {
-                       String from;
-                       if (connection.haveMinimumServerVersion("7.3")) {
-                               from = "pg_catalog.pg_namespace n, pg_catalog.pg_type t1, pg_catalog.pg_type t2 WHERE t1.typnamespace=n.oid AND n.nspname='pg_catalog' AND ";
-                       } else {
-                               from = "pg_type t1, pg_type t2 WHERE ";
-                       }
-                       String sql = "SELECT t1.typlen/t2.typlen FROM "+from+" t1.typelem=t2.oid AND t1.typname='oidvector'";
-                       ResultSet rs = connection.createStatement().executeQuery(sql);
-                       if (!rs.next()) {
-                               throw new PSQLException("postgresql.unexpected", PSQLState.UNEXPECTED_ERROR);
-                       }
-                       INDEX_MAX_KEYS = rs.getInt(1);
-                       rs.close();
-               }
-               return INDEX_MAX_KEYS;
-       }
-
-       protected int getMaxNameLength() throws SQLException {
-               if (NAMEDATALEN == 0) {
-                       String sql;
-                       if (connection.haveMinimumServerVersion("7.3")) {
-                               sql = "SELECT t.typlen FROM pg_catalog.pg_type t, pg_catalog.pg_namespace n WHERE t.typnamespace=n.oid AND t.typname='name' AND n.nspname='pg_catalog'";
-                       } else {
-                               sql = "SELECT typlen FROM pg_type WHERE typname='name'";
-                       }
-                       ResultSet rs = connection.createStatement().executeQuery(sql);
-                       if (!rs.next()) {
-                               throw new PSQLException("postgresql.unexpected", PSQLState.UNEXPECTED_ERROR);
-                       }
-                       NAMEDATALEN = rs.getInt("typlen");
-                       rs.close();
-               }
-               return NAMEDATALEN - 1;
-       }
-
-       public AbstractJdbc1DatabaseMetaData(AbstractJdbc1Connection conn)
-       {
-               this.connection = conn;
-               try {
-                       this.encoding = conn.getEncoding();
-               }
-               catch (SQLException sqle) {
-                       this.encoding = Encoding.defaultEncoding();
-               }
-
-       }
-
-       /*
-        * Can all the procedures returned by getProcedures be called
-        * by the current user?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean allProceduresAreCallable() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("allProceduresAreCallable");
-               return true;            // For now...
-       }
-
-       /*
-        * Can all the tables returned by getTable be SELECTed by
-        * the current user?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean allTablesAreSelectable() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("allTablesAreSelectable");
-               return true;            // For now...
-       }
-
-       /*
-        * What is the URL for this database?
-        *
-        * @return the url or null if it cannott be generated
-        * @exception SQLException if a database access error occurs
-        */
-       public String getURL() throws SQLException
-       {
-               String url = connection.getURL();
-               if (Driver.logDebug)
-                       Driver.debug("getURL " + url);
-               return url;
-       }
-
-       /*
-        * What is our user name as known to the database?
-        *
-        * @return our database user name
-        * @exception SQLException if a database access error occurs
-        */
-       public String getUserName() throws SQLException
-       {
-               String userName = connection.getUserName();
-               if (Driver.logDebug)
-                       Driver.debug("getUserName " + userName);
-               return userName;
-       }
-
-       /*
-        * Is the database in read-only mode?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isReadOnly() throws SQLException
-       {
-               boolean isReadOnly = connection.isReadOnly();
-               if (Driver.logDebug)
-                       Driver.debug("isReadOnly " + isReadOnly);
-               return isReadOnly;
-       }
-
-       /*
-        * Are NULL values sorted high?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean nullsAreSortedHigh() throws SQLException
-       {
-               boolean nullSortedHigh = connection.haveMinimumServerVersion("7.2");
-               if (Driver.logDebug)
-                       Driver.debug("nullsAreSortedHigh " + nullSortedHigh);
-               return nullSortedHigh;
-       }
-
-       /*
-        * Are NULL values sorted low?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean nullsAreSortedLow() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("nullsAreSortedLow false");
-               return false;
-       }
-
-       /*
-        * Are NULL values sorted at the start regardless of sort order?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean nullsAreSortedAtStart() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("nullsAreSortedAtStart false");
-               return false;
-       }
-
-       /*
-        * Are NULL values sorted at the end regardless of sort order?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean nullsAreSortedAtEnd() throws SQLException
-       {
-               boolean nullsAreSortedAtEnd = ! connection.haveMinimumServerVersion("7.2");
-               if (Driver.logDebug)
-                       Driver.debug("nullsAreSortedAtEnd " + nullsAreSortedAtEnd);
-               return nullsAreSortedAtEnd;
-       }
-
-       /*
-        * What is the name of this database product - we hope that it is
-        * PostgreSQL, so we return that explicitly.
-        *
-        * @return the database product name
-        * @exception SQLException if a database access error occurs
-        */
-       public String getDatabaseProductName() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getDatabaseProductName PostgresSQL");
-               return "PostgreSQL";
-       }
-
-       /*
-        * What is the version of this database product.
-        *
-        * @return the database version
-        * @exception SQLException if a database access error occurs
-        */
-       public String getDatabaseProductVersion() throws SQLException
-       {
-               String versionNumber = connection.getDBVersionNumber();
-               if (Driver.logDebug)
-                       Driver.debug("getDatabaseProductVersion " + versionNumber);
-               return versionNumber;
-       }
-
-       /*
-        * What is the name of this JDBC driver?  If we don't know this
-        * we are doing something wrong!
-        *
-        * @return the JDBC driver name
-        * @exception SQLException why?
-        */
-       public String getDriverName() throws SQLException
-       {
-               String driverName = "PostgreSQL Native Driver";
-               if (Driver.logDebug)
-                       Driver.debug("getDriverName" + driverName);
-               return driverName;
-       }
-
-       /*
-        * What is the version string of this JDBC driver?      Again, this is
-        * static.
-        *
-        * @return the JDBC driver name.
-        * @exception SQLException why?
-        */
-       public String getDriverVersion() throws SQLException
-       {
-               String driverVersion = Driver.getVersion();
-               if (Driver.logDebug)
-                       Driver.debug("getDriverVersion " + driverVersion);
-               return driverVersion;
-       }
-
-       /*
-        * What is this JDBC driver's major version number?
-        *
-        * @return the JDBC driver major version
-        */
-       public int getDriverMajorVersion()
-       {
-               int majorVersion = connection.this_driver.getMajorVersion();
-               if (Driver.logDebug)
-                       Driver.debug("getMajorVersion " + majorVersion);
-               return majorVersion;
-       }
-
-       /*
-        * What is this JDBC driver's minor version number?
-        *
-        * @return the JDBC driver minor version
-        */
-       public int getDriverMinorVersion()
-       {
-               int minorVersion = connection.this_driver.getMinorVersion();
-               if (Driver.logDebug)
-                       Driver.debug("getMinorVersion " + minorVersion);
-               return minorVersion;
-       }
-
-       /*
-        * Does the database store tables in a local file?      No - it
-        * stores them in a file on the server.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean usesLocalFiles() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("usesLocalFiles " + false);
-               return false;
-       }
-
-       /*
-        * Does the database use a file for each table?  Well, not really,
-        * since it doesnt use local files.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean usesLocalFilePerTable() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("usesLocalFilePerTable " + false);
-               return false;
-       }
-
-       /*
-        * Does the database treat mixed case unquoted SQL identifiers
-        * as case sensitive and as a result store them in mixed case?
-        * A JDBC-Compliant driver will always return false.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsMixedCaseIdentifiers() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsMixedCaseIdentifiers " + false);
-               return false;
-       }
-
-       /*
-        * Does the database treat mixed case unquoted SQL identifiers as
-        * case insensitive and store them in upper case?
-        *
-        * @return true if so
-        */
-       public boolean storesUpperCaseIdentifiers() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("storesUpperCaseIdentifiers " + false);
-               return false;
-       }
-
-       /*
-        * Does the database treat mixed case unquoted SQL identifiers as
-        * case insensitive and store them in lower case?
-        *
-        * @return true if so
-        */
-       public boolean storesLowerCaseIdentifiers() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("storesLowerCaseIdentifiers " + true);
-               return true;
-       }
-
-       /*
-        * Does the database treat mixed case unquoted SQL identifiers as
-        * case insensitive and store them in mixed case?
-        *
-        * @return true if so
-        */
-       public boolean storesMixedCaseIdentifiers() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("storesMixedCaseIdentifiers " + false);
-               return false;
-       }
-
-       /*
-        * Does the database treat mixed case quoted SQL identifiers as
-        * case sensitive and as a result store them in mixed case?  A
-        * JDBC compliant driver will always return true.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsMixedCaseQuotedIdentifiers " + true);
-               return true;
-       }
-
-       /*
-        * Does the database treat mixed case quoted SQL identifiers as
-        * case insensitive and store them in upper case?
-        *
-        * @return true if so
-        */
-       public boolean storesUpperCaseQuotedIdentifiers() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("storesUpperCaseQuotedIdentifiers " + false);
-               return false;
-       }
-
-       /*
-        * Does the database treat mixed case quoted SQL identifiers as case
-        * insensitive and store them in lower case?
-        *
-        * @return true if so
-        */
-       public boolean storesLowerCaseQuotedIdentifiers() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("storesLowerCaseQuotedIdentifiers " + false);
-               return false;
-       }
-
-       /*
-        * Does the database treat mixed case quoted SQL identifiers as case
-        * insensitive and store them in mixed case?
-        *
-        * @return true if so
-        */
-       public boolean storesMixedCaseQuotedIdentifiers() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("storesMixedCaseQuotedIdentifiers " + false);
-               return false;
-       }
-
-       /*
-        * What is the string used to quote SQL identifiers?  This returns
-        * a space if identifier quoting isn't supported.  A JDBC Compliant
-        * driver will always use a double quote character.
-        *
-        * @return the quoting string
-        * @exception SQLException if a database access error occurs
-        */
-       public String getIdentifierQuoteString() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getIdentifierQuoteString \"" );
-               return "\"";
-       }
-
-       /*
-        * Get a comma separated list of all a database's SQL keywords that
-        * are NOT also SQL92 keywords.
-        *
-        * <p>Within PostgreSQL, the keywords are found in
-        *      src/backend/parser/keywords.c
-        *
-        * <p>For SQL Keywords, I took the list provided at
-        *      <a href="http://web.dementia.org/~shadow/sql/sql3bnf.sep93.txt">
-        * http://web.dementia.org/~shadow/sql/sql3bnf.sep93.txt</a>
-        * which is for SQL3, not SQL-92, but it is close enough for
-        * this purpose.
-        *
-        * @return a comma separated list of keywords we use
-        * @exception SQLException if a database access error occurs
-        */
-       public String getSQLKeywords() throws SQLException
-       {
-               return keywords;
-       }
-
-       public String getNumericFunctions() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getNumericFunctions");
-               return "";
-       }
-
-       public String getStringFunctions() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getStringFunctions");
-               return "";
-       }
-
-       public String getSystemFunctions() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getSystemFunctions");
-               return "";
-       }
-
-       public String getTimeDateFunctions() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getTimeDateFunctions");
-               return "";
-       }
-
-       /*
-        * This is the string that can be used to escape '_' and '%' in
-        * a search string pattern style catalog search parameters
-        *
-        * @return the string used to escape wildcard characters
-        * @exception SQLException if a database access error occurs
-        */
-       public String getSearchStringEscape() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getSearchStringEscape");
-               return "\\";
-       }
-
-       /*
-        * Get all the "extra" characters that can be used in unquoted
-        * identifier names (those beyond a-zA-Z0-9 and _)
-        *
-        * <p>From the file src/backend/parser/scan.l, an identifier is
-        * {letter}{letter_or_digit} which makes it just those listed
-        * above.
-        *
-        * @return a string containing the extra characters
-        * @exception SQLException if a database access error occurs
-        */
-       public String getExtraNameCharacters() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getExtraNameCharacters");
-               return "";
-       }
-
-       /*
-        * Is "ALTER TABLE" with an add column supported?
-        * Yes for PostgreSQL 6.1
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsAlterTableWithAddColumn() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsAlterTableWithAddColumn " + true);
-               return true;
-       }
-
-       /*
-        * Is "ALTER TABLE" with a drop column supported?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsAlterTableWithDropColumn() throws SQLException
-       {
-               boolean dropColumn = connection.haveMinimumServerVersion("7.3");
-               if (Driver.logDebug)
-                       Driver.debug("supportsAlterTableWithDropColumn " + dropColumn);
-               return dropColumn;
-       }
-
-       /*
-        * Is column aliasing supported?
-        *
-        * <p>If so, the SQL AS clause can be used to provide names for
-        * computed columns or to provide alias names for columns as
-        * required.  A JDBC Compliant driver always returns true.
-        *
-        * <p>e.g.
-        *
-        * <br><pre>
-        * select count(C) as C_COUNT from T group by C;
-        *
-        * </pre><br>
-        * should return a column named as C_COUNT instead of count(C)
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsColumnAliasing() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsColumnAliasing " + true);
-               return true;
-       }
-
-       /*
-        * Are concatenations between NULL and non-NULL values NULL?  A
-        * JDBC Compliant driver always returns true
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean nullPlusNonNullIsNull() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("nullPlusNonNullIsNull " + true);
-               return true;
-       }
-
-       public boolean supportsConvert() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsConvert " + false);
-               return false;
-       }
-
-       public boolean supportsConvert(int fromType, int toType) throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsConvert " + false);
-               return false;
-       }
-
-       /*
-        * Are table correlation names supported? A JDBC Compliant
-        * driver always returns true.
-        *
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsTableCorrelationNames() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsTableCorrelationNames " + true);
-               return true;
-       }
-
-       /*
-        * If table correlation names are supported, are they restricted to
-        * be different from the names of the tables?
-        *
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsDifferentTableCorrelationNames() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsDifferentTableCorrelationNames " + false);
-               return false;
-       }
-
-       /*
-        * Are expressions in "ORDER BY" lists supported?
-        *
-        * <br>e.g. select * from t order by a + b;
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsExpressionsInOrderBy() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsExpressionsInOrderBy " + true);
-               return true;
-       }
-
-       /*
-        * Can an "ORDER BY" clause use columns not in the SELECT?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsOrderByUnrelated() throws SQLException
-       {
-               boolean supportsOrderByUnrelated = connection.haveMinimumServerVersion("6.4");
-               if (Driver.logDebug)
-                       Driver.debug("supportsOrderByUnrelated " + supportsOrderByUnrelated);
-               return supportsOrderByUnrelated;
-       }
-
-       /*
-        * Is some form of "GROUP BY" clause supported?
-        * I checked it, and yes it is.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsGroupBy() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsGroupBy " + true);
-               return true;
-       }
-
-       /*
-        * Can a "GROUP BY" clause use columns not in the SELECT?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsGroupByUnrelated() throws SQLException
-       {
-               boolean supportsGroupByUnrelated = connection.haveMinimumServerVersion("6.4");
-               if (Driver.logDebug)
-                       Driver.debug("supportsGroupByUnrelated " + supportsGroupByUnrelated);
-               return supportsGroupByUnrelated;
-       }
-
-       /*
-        * Can a "GROUP BY" clause add columns not in the SELECT provided
-        * it specifies all the columns in the SELECT?  Does anyone actually
-        * understand what they mean here?
-        *
-        * (I think this is a subset of the previous function. -- petere)
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsGroupByBeyondSelect() throws SQLException
-       {
-               boolean supportsGroupByBeyondSelect = connection.haveMinimumServerVersion("6.4");
-               if (Driver.logDebug)
-                       Driver.debug("supportsGroupByUnrelated " + supportsGroupByBeyondSelect);
-               return supportsGroupByBeyondSelect;
-       }
-
-       /*
-        * Is the escape character in "LIKE" clauses supported?  A
-        * JDBC compliant driver always returns true.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsLikeEscapeClause() throws SQLException
-       {
-               boolean supportsLikeEscapeClause = connection.haveMinimumServerVersion("7.1");
-               if (Driver.logDebug)
-                       Driver.debug("supportsLikeEscapeClause " + supportsLikeEscapeClause);
-               return supportsLikeEscapeClause;
-       }
-
-       /*
-        * Are multiple ResultSets from a single execute supported?
-        * Well, I implemented it, but I dont think this is possible from
-        * the back ends point of view.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsMultipleResultSets() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsMultipleResultSets " + false);
-               return false;
-       }
-
-       /*
-        * Can we have multiple transactions open at once (on different
-        * connections?)
-        * I guess we can have, since Im relying on it.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsMultipleTransactions() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsMultipleTransactions " + true);
-               return true;
-       }
-
-       /*
-        * Can columns be defined as non-nullable.      A JDBC Compliant driver
-        * always returns true.
-        *
-        * <p>This changed from false to true in v6.2 of the driver, as this
-        * support was added to the backend.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsNonNullableColumns() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsNonNullableColumns true");
-               return true;
-       }
-
-       /*
-        * Does this driver support the minimum ODBC SQL grammar.  This
-        * grammar is defined at:
-        *
-        * <p><a href="http://www.microsoft.com/msdn/sdk/platforms/doc/odbc/src/intropr.htm">http://www.microsoft.com/msdn/sdk/platforms/doc/odbc/src/intropr.htm</a>
-        *
-        * <p>In Appendix C.  From this description, we seem to support the
-        * ODBC minimal (Level 0) grammar.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsMinimumSQLGrammar() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsMinimumSQLGrammar TRUE");
-               return true;
-       }
-
-       /*
-        * Does this driver support the Core ODBC SQL grammar.  We need
-        * SQL-92 conformance for this.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsCoreSQLGrammar() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsCoreSQLGrammar FALSE ");
-               return false;
-       }
-
-       /*
-        * Does this driver support the Extended (Level 2) ODBC SQL
-        * grammar.  We don't conform to the Core (Level 1), so we can't
-        * conform to the Extended SQL Grammar.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsExtendedSQLGrammar() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsExtendedSQLGrammar FALSE");
-               return false;
-       }
-
-       /*
-        * Does this driver support the ANSI-92 entry level SQL grammar?
-        * All JDBC Compliant drivers must return true. We currently
-        * report false until 'schema' support is added.  Then this
-        * should be changed to return true, since we will be mostly
-        * compliant (probably more compliant than many other databases)
-        * And since this is a requirement for all JDBC drivers we
-        * need to get to the point where we can return true.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsANSI92EntryLevelSQL() throws SQLException
-       {
-               boolean schemas = connection.haveMinimumServerVersion("7.3");
-               if (Driver.logDebug)
-                       Driver.debug("supportsANSI92EntryLevelSQL " + schemas);
-               return schemas;
-       }
-
-       /*
-        * Does this driver support the ANSI-92 intermediate level SQL
-        * grammar?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsANSI92IntermediateSQL() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsANSI92IntermediateSQL false ");
-               return false;
-       }
-
-       /*
-        * Does this driver support the ANSI-92 full SQL grammar?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsANSI92FullSQL() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsANSI92FullSQL false ");
-               return false;
-       }
-
-       /*
-        * Is the SQL Integrity Enhancement Facility supported?
-        * Our best guess is that this means support for constraints
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsIntegrityEnhancementFacility() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsIntegrityEnhancementFacility true ");
-               return true;
-       }
-
-       /*
-        * Is some form of outer join supported?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsOuterJoins() throws SQLException
-       {
-               boolean supportsOuterJoins = connection.haveMinimumServerVersion("7.1");
-               if (Driver.logDebug)
-                       Driver.debug("supportsOuterJoins " + supportsOuterJoins);
-               return supportsOuterJoins;
-       }
-
-       /*
-        * Are full nexted outer joins supported?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsFullOuterJoins() throws SQLException
-       {
-               boolean supportsFullOuterJoins = connection.haveMinimumServerVersion("7.1");
-               if (Driver.logDebug)
-                       Driver.debug("supportsFullOuterJoins " + supportsFullOuterJoins);
-               return supportsFullOuterJoins;
-       }
-
-       /*
-        * Is there limited support for outer joins?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsLimitedOuterJoins() throws SQLException
-       {
-               boolean supportsLimitedOuterJoins = connection.haveMinimumServerVersion("7.1");
-               if (Driver.logDebug)
-                       Driver.debug("supportsFullOuterJoins " + supportsLimitedOuterJoins);
-               return supportsLimitedOuterJoins;
-       }
-
-       /*
-        * What is the database vendor's preferred term for "schema"?
-        * PostgreSQL doesn't have schemas, but when it does, we'll use the
-        * term "schema".
-        *
-        * @return the vendor term
-        * @exception SQLException if a database access error occurs
-        */
-       public String getSchemaTerm() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getSchemaTerm schema");
-               return "schema";
-       }
-
-       /*
-        * What is the database vendor's preferred term for "procedure"?
-        * Traditionally, "function" has been used.
-        *
-        * @return the vendor term
-        * @exception SQLException if a database access error occurs
-        */
-       public String getProcedureTerm() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getProcedureTerm function ");
-               return "function";
-       }
-
-       /*
-        * What is the database vendor's preferred term for "catalog"?
-        *
-        * @return the vendor term
-        * @exception SQLException if a database access error occurs
-        */
-       public String getCatalogTerm() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("getCatalogTerm database ");
-               return "database";
-       }
-
-       /*
-        * Does a catalog appear at the start of a qualified table name?
-        * (Otherwise it appears at the end).
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isCatalogAtStart() throws SQLException
-       {
-               // return true here; we return false for every other catalog function
-               // so it won't matter what we return here D.C.
-               if (Driver.logDebug)
-                       Driver.debug("isCatalogAtStart not implemented");
-               return true;
-       }
-
-       /*
-        * What is the Catalog separator.
-        *
-        * @return the catalog separator string
-        * @exception SQLException if a database access error occurs
-        */
-       public String getCatalogSeparator() throws SQLException
-       {
-               // Give them something to work with here
-               // everything else returns false so it won't matter what we return here D.C.
-               if (Driver.logDebug)
-                       Driver.debug("getCatalogSeparator not implemented ");
-               return ".";
-       }
-
-       /*
-        * Can a schema name be used in a data manipulation statement?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsSchemasInDataManipulation() throws SQLException
-       {
-               boolean schemas = connection.haveMinimumServerVersion("7.3");
-               if (Driver.logDebug)
-                       Driver.debug("supportsSchemasInDataManipulation "+schemas);
-               return schemas;
-       }
-
-       /*
-        * Can a schema name be used in a procedure call statement?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsSchemasInProcedureCalls() throws SQLException
-       {
-               boolean schemas = connection.haveMinimumServerVersion("7.3");
-               if (Driver.logDebug)
-                       Driver.debug("supportsSchemasInProcedureCalls "+schemas);
-               return schemas;
-       }
-
-       /*
-        * Can a schema be used in a table definition statement?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsSchemasInTableDefinitions() throws SQLException
-       {
-               boolean schemas = connection.haveMinimumServerVersion("7.3");
-
-               if (Driver.logDebug)
-                       Driver.debug("supportsSchemasInTableDefinitions " + schemas);
-               return schemas;
-       }
-
-       /*
-        * Can a schema name be used in an index definition statement?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsSchemasInIndexDefinitions() throws SQLException
-       {
-               boolean schemas = connection.haveMinimumServerVersion("7.3");
-               if (Driver.logDebug)
-                       Driver.debug("supportsSchemasInIndexDefinitions "+schemas);
-               return schemas;
-       }
-
-       /*
-        * Can a schema name be used in a privilege definition statement?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException
-       {
-               boolean schemas = connection.haveMinimumServerVersion("7.3");
-               if (Driver.logDebug)
-                       Driver.debug("supportsSchemasInPrivilegeDefinitions "+schemas);
-               return schemas;
-       }
-
-       /*
-        * Can a catalog name be used in a data manipulation statement?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsCatalogsInDataManipulation() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsCatalogsInDataManipulation false");
-               return false;
-       }
-
-       /*
-        * Can a catalog name be used in a procedure call statement?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsCatalogsInProcedureCalls() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsCatalogsInDataManipulation false");
-               return false;
-       }
-
-       /*
-        * Can a catalog name be used in a table definition statement?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsCatalogsInTableDefinitions() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsCatalogsInTableDefinitions false");
-               return false;
-       }
-
-       /*
-        * Can a catalog name be used in an index definition?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsCatalogsInIndexDefinitions() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsCatalogsInIndexDefinitions false");
-               return false;
-       }
-
-       /*
-        * Can a catalog name be used in a privilege definition statement?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsCatalogsInPrivilegeDefinitions false");
-               return false;
-       }
-
-       /*
-        * We support cursors for gets only it seems.  I dont see a method
-        * to get a positioned delete.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsPositionedDelete() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsPositionedDelete false");
-               return false;                   // For now...
-       }
-
-       /*
-        * Is positioned UPDATE supported?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsPositionedUpdate() throws SQLException
-       {
-               if (Driver.logDebug)
-                       Driver.debug("supportsPositionedUpdate false");
-               return false;                   // For now...
-       }
-
-       /*
-        * Is SELECT for UPDATE supported?
-        *
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsSelectForUpdate() throws SQLException
-       {
-               return connection.haveMinimumServerVersion("6.5");
-       }
-
-       /*
-        * Are stored procedure calls using the stored procedure escape
-        * syntax supported?
-        *
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsStoredProcedures() throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * Are subqueries in comparison expressions supported? A JDBC
-        * Compliant driver always returns true.
-        *
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsSubqueriesInComparisons() throws SQLException
-       {
-               return true;
-       }
-
-       /*
-        * Are subqueries in 'exists' expressions supported? A JDBC
-        * Compliant driver always returns true.
-        *
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsSubqueriesInExists() throws SQLException
-       {
-               return true;
-       }
-
-       /*
-        * Are subqueries in 'in' statements supported? A JDBC
-        * Compliant driver always returns true.
-        *
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsSubqueriesInIns() throws SQLException
-       {
-               return true;
-       }
-
-       /*
-        * Are subqueries in quantified expressions supported? A JDBC
-        * Compliant driver always returns true.
-        *
-        * (No idea what this is, but we support a good deal of
-        * subquerying.)
-        *
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsSubqueriesInQuantifieds() throws SQLException
-       {
-               return true;
-       }
-
-       /*
-        * Are correlated subqueries supported? A JDBC Compliant driver
-        * always returns true.
-        *
-        * (a.k.a. subselect in from?)
-        *
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsCorrelatedSubqueries() throws SQLException
-       {
-               return connection.haveMinimumServerVersion("7.1");
-       }
-
-       /*
-        * Is SQL UNION supported?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsUnion() throws SQLException
-       {
-               return true; // since 6.3
-       }
-
-       /*
-        * Is SQL UNION ALL supported?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsUnionAll() throws SQLException
-       {
-               return connection.haveMinimumServerVersion("7.1");
-       }
-
-       /*
-        * In PostgreSQL, Cursors are only open within transactions.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsOpenCursorsAcrossCommit() throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * Do we support open cursors across multiple transactions?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsOpenCursorsAcrossRollback() throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * Can statements remain open across commits?  They may, but
-        * this driver cannot guarentee that.  In further reflection.
-        * we are talking a Statement object here, so the answer is
-        * yes, since the Statement is only a vehicle to ExecSQL()
-        *
-        * @return true if they always remain open; false otherwise
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsOpenStatementsAcrossCommit() throws SQLException
-       {
-               return true;
-       }
-
-       /*
-        * Can statements remain open across rollbacks?  They may, but
-        * this driver cannot guarentee that.  In further contemplation,
-        * we are talking a Statement object here, so the answer is yes,
-        * since the Statement is only a vehicle to ExecSQL() in Connection
-        *
-        * @return true if they always remain open; false otherwise
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsOpenStatementsAcrossRollback() throws SQLException
-       {
-               return true;
-       }
-
-       /*
-        * How many hex characters can you have in an inline binary literal
-        *
-        * @return the max literal length
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxBinaryLiteralLength() throws SQLException
-       {
-               return 0; // no limit
-       }
-
-       /*
-        * What is the maximum length for a character literal
-        * I suppose it is 8190 (8192 - 2 for the quotes)
-        *
-        * @return the max literal length
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxCharLiteralLength() throws SQLException
-       {
-               return 0; // no limit
-       }
-
-       /*
-        * Whats the limit on column name length.
-        *
-        * @return the maximum column name length
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxColumnNameLength() throws SQLException
-       {
-               return getMaxNameLength();
-       }
-
-       /*
-        * What is the maximum number of columns in a "GROUP BY" clause?
-        *
-        * @return the max number of columns
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxColumnsInGroupBy() throws SQLException
-       {
-               return 0; // no limit
-       }
-
-       /*
-        * What's the maximum number of columns allowed in an index?
-        *
-        * @return max number of columns
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxColumnsInIndex() throws SQLException
-       {
-               return getMaxIndexKeys();
-       }
-
-       /*
-        * What's the maximum number of columns in an "ORDER BY clause?
-        *
-        * @return the max columns
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxColumnsInOrderBy() throws SQLException
-       {
-               return 0; // no limit
-       }
-
-       /*
-        * What is the maximum number of columns in a "SELECT" list?
-        *
-        * @return the max columns
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxColumnsInSelect() throws SQLException
-       {
-               return 0; // no limit
-       }
-
-       /*
-        * What is the maximum number of columns in a table? From the
-        * CREATE TABLE reference page...
-        *
-        * <p>"The new class is created as a heap with no initial data.  A
-        * class can have no more than 1600 attributes (realistically,
-        * this is limited by the fact that tuple sizes must be less than
-        * 8192 bytes)..."
-        *
-        * @return the max columns
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxColumnsInTable() throws SQLException
-       {
-               return 1600;
-       }
-
-       /*
-        * How many active connection can we have at a time to this
-        * database?  Well, since it depends on postmaster, which just
-        * does a listen() followed by an accept() and fork(), its
-        * basically very high.  Unless the system runs out of processes,
-        * it can be 65535 (the number of aux. ports on a TCP/IP system).
-        * I will return 8192 since that is what even the largest system
-        * can realistically handle,
-        *
-        * @return the maximum number of connections
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxConnections() throws SQLException
-       {
-               return 8192;
-       }
-
-       /*
-        * What is the maximum cursor name length
-        *
-        * @return max cursor name length in bytes
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxCursorNameLength() throws SQLException
-       {
-               return getMaxNameLength();
-       }
-
-       /*
-        * Retrieves the maximum number of bytes for an index, including all
-        * of the parts of the index.
-        *
-        * @return max index length in bytes, which includes the composite
-        * of all the constituent parts of the index; a result of zero means
-        * that there is no limit or the limit is not known
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxIndexLength() throws SQLException
-       {
-               return 0; // no limit (larger than an int anyway)
-       }
-
-       public int getMaxSchemaNameLength() throws SQLException
-       {
-               return getMaxNameLength();
-       }
-
-       /*
-        * What is the maximum length of a procedure name
-        *
-        * @return the max name length in bytes
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxProcedureNameLength() throws SQLException
-       {
-               return getMaxNameLength();
-       }
-
-       public int getMaxCatalogNameLength() throws SQLException
-       {
-               return getMaxNameLength();
-       }
-
-       /*
-        * What is the maximum length of a single row?
-        *
-        * @return max row size in bytes
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxRowSize() throws SQLException
-       {
-               if (connection.haveMinimumServerVersion("7.1"))
-                       return 1073741824;      // 1 GB
-               else
-                       return 8192;            // XXX could be altered
-       }
-
-       /*
-        * Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY
-        * blobs?  We don't handle blobs yet
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean doesMaxRowSizeIncludeBlobs() throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * What is the maximum length of a SQL statement?
-        *
-        * @return max length in bytes
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxStatementLength() throws SQLException
-       {
-               if (connection.haveMinimumServerVersion("7.0"))
-                       return 0;               // actually whatever fits in size_t
-               else
-                       return 16384;
-       }
-
-       /*
-        * How many active statements can we have open at one time to
-        * this database?  Basically, since each Statement downloads
-        * the results as the query is executed, we can have many.      However,
-        * we can only really have one statement per connection going
-        * at once (since they are executed serially) - so we return
-        * one.
-        *
-        * @return the maximum
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxStatements() throws SQLException
-       {
-               return 1;
-       }
-
-       /*
-        * What is the maximum length of a table name
-        *
-        * @return max name length in bytes
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxTableNameLength() throws SQLException
-       {
-               return getMaxNameLength();
-       }
-
-       /*
-        * What is the maximum number of tables that can be specified
-        * in a SELECT?
-        *
-        * @return the maximum
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxTablesInSelect() throws SQLException
-       {
-               return 0; // no limit
-       }
-
-       /*
-        * What is the maximum length of a user name
-        *
-        * @return the max name length in bytes
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxUserNameLength() throws SQLException
-       {
-               return getMaxNameLength();
-       }
-
-
-       /*
-        * What is the database's default transaction isolation level?  We
-        * do not support this, so all transactions are SERIALIZABLE.
-        *
-        * @return the default isolation level
-        * @exception SQLException if a database access error occurs
-        * @see Connection
-        */
-       public int getDefaultTransactionIsolation() throws SQLException
-       {
-               return Connection.TRANSACTION_READ_COMMITTED;
-       }
-
-       /*
-        * Are transactions supported?  If not, commit and rollback are noops
-        * and the isolation level is TRANSACTION_NONE.  We do support
-        * transactions.
-        *
-        * @return true if transactions are supported
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsTransactions() throws SQLException
-       {
-               return true;
-       }
-
-       /*
-        * Does the database support the given transaction isolation level?
-        * We only support TRANSACTION_SERIALIZABLE and TRANSACTION_READ_COMMITTED
-        *
-        * @param level the values are defined in java.sql.Connection
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        * @see Connection
-        */
-       public boolean supportsTransactionIsolationLevel(int level) throws SQLException
-       {
-               if (level == Connection.TRANSACTION_SERIALIZABLE ||
-                               level == Connection.TRANSACTION_READ_COMMITTED)
-                       return true;
-               else
-                       return false;
-       }
-
-       /*
-        * Are both data definition and data manipulation transactions
-        * supported?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException
-       {
-               return true;
-       }
-
-       /*
-        * Are only data manipulation statements withing a transaction
-        * supported?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean supportsDataManipulationTransactionsOnly() throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * Does a data definition statement within a transaction force
-        * the transaction to commit?  I think this means something like:
-        *
-        * <p><pre>
-        * CREATE TABLE T (A INT);
-        * INSERT INTO T (A) VALUES (2);
-        * BEGIN;
-        * UPDATE T SET A = A + 1;
-        * CREATE TABLE X (A INT);
-        * SELECT A FROM T INTO X;
-        * COMMIT;
-        * </pre><p>
-        *
-        * does the CREATE TABLE call cause a commit?  The answer is no.
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean dataDefinitionCausesTransactionCommit() throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * Is a data definition statement within a transaction ignored?
-        *
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean dataDefinitionIgnoredInTransactions() throws SQLException
-       {
-               return false;
-       }
-
-       /**
-        * Escape single quotes with another single quote.
-        */
-       protected static String escapeQuotes(String s) {
-               StringBuffer sb = new StringBuffer();
-               int length = s.length();
-               char prevChar = ' ';
-               char prevPrevChar = ' ';
-               for (int i=0; i<length; i++) {
-                       char c = s.charAt(i);
-                       sb.append(c);
-                       if (c == '\'' && (prevChar != '\\' || (prevChar == '\\' && prevPrevChar == '\\'))) {
-                               sb.append("'");
-                       }
-                       prevPrevChar = prevChar;
-                       prevChar = c;
-               }
-               return sb.toString();
-       }
-
-       /*
-        * Get a description of stored procedures available in a catalog
-        *
-        * <p>Only procedure descriptions matching the schema and procedure
-        * name criteria are returned.  They are ordered by PROCEDURE_SCHEM
-        * and PROCEDURE_NAME
-        *
-        * <p>Each procedure description has the following columns:
-        * <ol>
-        * <li><b>PROCEDURE_CAT</b> String => procedure catalog (may be null)
-        * <li><b>PROCEDURE_SCHEM</b> String => procedure schema (may be null)
-        * <li><b>PROCEDURE_NAME</b> String => procedure name
-        * <li><b>Field 4</b> reserved (make it null)
-        * <li><b>Field 5</b> reserved (make it null)
-        * <li><b>Field 6</b> reserved (make it null)
-        * <li><b>REMARKS</b> String => explanatory comment on the procedure
-        * <li><b>PROCEDURE_TYPE</b> short => kind of procedure
-        *      <ul>
-        *        <li> procedureResultUnknown - May return a result
-        *      <li> procedureNoResult - Does not return a result
-        *      <li> procedureReturnsResult - Returns a result
-        *        </ul>
-        * </ol>
-        *
-        * @param catalog - a catalog name; "" retrieves those without a
-        *      catalog; null means drop catalog name from criteria
-        * @param schemaParrern - a schema name pattern; "" retrieves those
-        *      without a schema - we ignore this parameter
-        * @param procedureNamePattern - a procedure name pattern
-        * @return ResultSet - each row is a procedure description
-        * @exception SQLException if a database access error occurs
-        */
-       public java.sql.ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException
-       {
-               String sql;
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       sql = "SELECT NULL AS PROCEDURE_CAT, n.nspname AS PROCEDURE_SCHEM, p.proname AS PROCEDURE_NAME, NULL, NULL, NULL, d.description AS REMARKS, "+java.sql.DatabaseMetaData.procedureReturnsResult+" AS PROCEDURE_TYPE "+
-                               " FROM pg_catalog.pg_namespace n, pg_catalog.pg_proc p "+
-                               " LEFT JOIN pg_catalog.pg_description d ON (p.oid=d.objoid) "+
-                               " LEFT JOIN pg_catalog.pg_class c ON (d.classoid=c.oid AND c.relname='pg_proc') "+
-                               " LEFT JOIN pg_catalog.pg_namespace pn ON (c.relnamespace=pn.oid AND pn.nspname='pg_catalog') "+
-                               " WHERE p.pronamespace=n.oid ";
-                               if (schemaPattern != null && !"".equals(schemaPattern)) {
-                                       sql += " AND n.nspname LIKE '"+escapeQuotes(schemaPattern)+"' ";
-                               }
-                               if (procedureNamePattern != null) {
-                                       sql += " AND p.proname LIKE '"+escapeQuotes(procedureNamePattern)+"' ";
-                               }
-                               sql += " ORDER BY PROCEDURE_SCHEM, PROCEDURE_NAME ";
-               } else if (connection.haveMinimumServerVersion("7.1")) {
-                       sql = "SELECT NULL AS PROCEDURE_CAT, NULL AS PROCEDURE_SCHEM, p.proname AS PROCEDURE_NAME, NULL, NULL, NULL, d.description AS REMARKS, "+java.sql.DatabaseMetaData.procedureReturnsResult+" AS PROCEDURE_TYPE "+
-                               " FROM pg_proc p "+
-                               " LEFT JOIN pg_description d ON (p.oid=d.objoid) ";
-                       if (connection.haveMinimumServerVersion("7.2")) {
-                               sql += " LEFT JOIN pg_class c ON (d.classoid=c.oid AND c.relname='pg_proc') ";
-                       }
-                       if (procedureNamePattern != null) {
-                               sql += " WHERE p.proname LIKE '"+escapeQuotes(procedureNamePattern)+"' ";
-                       }
-                       sql += " ORDER BY PROCEDURE_NAME ";
-               } else {
-                       sql = "SELECT NULL AS PROCEDURE_CAT, NULL AS PROCEDURE_SCHEM, p.proname AS PROCEDURE_NAME, NULL, NULL, NULL, NULL AS REMARKS, "+java.sql.DatabaseMetaData.procedureReturnsResult+" AS PROCEDURE_TYPE "+
-                               " FROM pg_proc p ";
-                               if (procedureNamePattern != null) {
-                                       sql += " WHERE p.proname LIKE '"+escapeQuotes(procedureNamePattern)+"' ";
-                               }
-                               sql += " ORDER BY PROCEDURE_NAME ";
-               }
-               return connection.createStatement().executeQuery(sql);
-       }
-
-       /*
-        * Get a description of a catalog's stored procedure parameters
-        * and result columns.
-        *
-        * <p>Only descriptions matching the schema, procedure and parameter
-        * name criteria are returned. They are ordered by PROCEDURE_SCHEM
-        * and PROCEDURE_NAME. Within this, the return value, if any, is
-        * first. Next are the parameter descriptions in call order. The
-        * column descriptions follow in column number order.
-        *
-        * <p>Each row in the ResultSet is a parameter description or column
-        * description with the following fields:
-        * <ol>
-        * <li><b>PROCEDURE_CAT</b> String => procedure catalog (may be null)
-        * <li><b>PROCEDURE_SCHE</b>M String => procedure schema (may be null)
-        * <li><b>PROCEDURE_NAME</b> String => procedure name
-        * <li><b>COLUMN_NAME</b> String => column/parameter name
-        * <li><b>COLUMN_TYPE</b> Short => kind of column/parameter:
-        * <ul><li>procedureColumnUnknown - nobody knows
-        * <li>procedureColumnIn - IN parameter
-        * <li>procedureColumnInOut - INOUT parameter
-        * <li>procedureColumnOut - OUT parameter
-        * <li>procedureColumnReturn - procedure return value
-        * <li>procedureColumnResult - result column in ResultSet
-        * </ul>
-        * <li><b>DATA_TYPE</b> short => SQL type from java.sql.Types
-        * <li><b>TYPE_NAME</b> String => Data source specific type name
-        * <li><b>PRECISION</b> int => precision
-        * <li><b>LENGTH</b> int => length in bytes of data
-        * <li><b>SCALE</b> short => scale
-        * <li><b>RADIX</b> short => radix
-        * <li><b>NULLABLE</b> short => can it contain NULL?
-        * <ul><li>procedureNoNulls - does not allow NULL values
-        * <li>procedureNullable - allows NULL values
-        * <li>procedureNullableUnknown - nullability unknown
-        * <li><b>REMARKS</b> String => comment describing parameter/column
-        * </ol>
-        * @param catalog This is ignored in org.postgresql, advise this is set to null
-        * @param schemaPattern
-        * @param procedureNamePattern a procedure name pattern
-        * @param columnNamePattern a column name pattern, this is currently ignored because postgresql does not name procedure parameters.
-        * @return each row is a stored procedure parameter or column description
-        * @exception SQLException if a database-access error occurs
-        * @see #getSearchStringEscape
-        */
-       // Implementation note: This is required for Borland's JBuilder to work
-       public java.sql.ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException
-       {
-               Field f[] = new Field[13];
-               Vector v = new Vector();                // The new ResultSet tuple stuff
-
-               f[0] = new Field(connection, "PROCEDURE_CAT", iVarcharOid, getMaxNameLength());
-               f[1] = new Field(connection, "PROCEDURE_SCHEM", iVarcharOid, getMaxNameLength());
-               f[2] = new Field(connection, "PROCEDURE_NAME", iVarcharOid, getMaxNameLength());
-               f[3] = new Field(connection, "COLUMN_NAME", iVarcharOid, getMaxNameLength());
-               f[4] = new Field(connection, "COLUMN_TYPE", iInt2Oid, 2);
-               f[5] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
-               f[6] = new Field(connection, "TYPE_NAME", iVarcharOid, getMaxNameLength());
-               f[7] = new Field(connection, "PRECISION", iInt4Oid, 4);
-               f[8] = new Field(connection, "LENGTH", iInt4Oid, 4);
-               f[9] = new Field(connection, "SCALE", iInt2Oid, 2);
-               f[10] = new Field(connection, "RADIX", iInt2Oid, 2);
-               f[11] = new Field(connection, "NULLABLE", iInt2Oid, 2);
-               f[12] = new Field(connection, "REMARKS", iVarcharOid, getMaxNameLength());
-
-               String sql;
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       sql = "SELECT n.nspname,p.proname,p.prorettype,p.proargtypes, t.typtype,t.typrelid "+
-                               " FROM pg_catalog.pg_proc p,pg_catalog.pg_namespace n, pg_catalog.pg_type t "+
-                               " WHERE p.pronamespace=n.oid AND p.prorettype=t.oid ";
-                       if (schemaPattern != null && !"".equals(schemaPattern)) {
-                               sql += " AND n.nspname LIKE '"+escapeQuotes(schemaPattern)+"' ";
-                       }
-                       if (procedureNamePattern != null) {
-                               sql += " AND p.proname LIKE '"+escapeQuotes(procedureNamePattern)+"' ";
-                       }
-                       sql += " ORDER BY n.nspname, p.proname ";
-               } else {
-                       sql = "SELECT NULL AS nspname,p.proname,p.prorettype,p.proargtypes, t.typtype,t.typrelid "+
-                               " FROM pg_proc p,pg_type t "+
-                               " WHERE p.prorettype=t.oid ";
-                       if (procedureNamePattern != null) {
-                               sql += " AND p.proname LIKE '"+escapeQuotes(procedureNamePattern)+"' ";
-                       }
-                       sql += " ORDER BY p.proname ";
-               }
-
-               ResultSet rs = connection.createStatement().executeQuery(sql);
-               while (rs.next()) {
-                       byte schema[] = rs.getBytes("nspname");
-                       byte procedureName[] = rs.getBytes("proname");
-                       int returnType = rs.getInt("prorettype");
-                       String returnTypeType = rs.getString("typtype");
-                       int returnTypeRelid = rs.getInt("typrelid");
-                       String strArgTypes = rs.getString("proargtypes");
-                       StringTokenizer st = new StringTokenizer(strArgTypes);
-                       Vector argTypes = new Vector();
-                       while (st.hasMoreTokens()) {
-                               argTypes.addElement(new Integer(st.nextToken()));
-                       }
-
-                       // decide if we are returning a single column result.
-                       if (!returnTypeType.equals("c")) {
-                               byte[][] tuple = new byte[13][];
-                               tuple[0] = null;
-                               tuple[1] = schema;
-                               tuple[2] = procedureName;
-                               tuple[3] = encoding.encode("returnValue");
-                               tuple[4] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.procedureColumnReturn));
-                               tuple[5] = encoding.encode(Integer.toString(connection.getSQLType(returnType)));
-                               tuple[6] = encoding.encode(connection.getPGType(returnType));
-                               tuple[7] = null;
-                               tuple[8] = null;
-                               tuple[9] = null;
-                               tuple[10] = null;
-                               tuple[11] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.procedureNullableUnknown));
-                               tuple[12] = null;
-                               v.addElement(tuple);
-                       }
-
-                       // Add a row for each argument.
-                       for (int i=0; i<argTypes.size(); i++) {
-                               int argOid = ((Integer)argTypes.elementAt(i)).intValue();
-                               byte[][] tuple = new byte[13][];
-                               tuple[0] = null;
-                               tuple[1] = schema;
-                               tuple[2] = procedureName;
-                               tuple[3] = encoding.encode("$"+(i+1));
-                               tuple[4] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.procedureColumnIn));
-                               tuple[5] = encoding.encode(Integer.toString(connection.getSQLType(argOid)));
-                               tuple[6] = encoding.encode(connection.getPGType(argOid));
-                               tuple[7] = null;
-                               tuple[8] = null;
-                               tuple[9] = null;
-                               tuple[10] = null;
-                               tuple[11] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.procedureNullableUnknown));
-                               tuple[12] = null;
-                               v.addElement(tuple);
-                       }
-
-                       // if we are returning a multi-column result.
-                       if (returnTypeType.equals("c")) {
-                               String columnsql = "SELECT a.attname,a.atttypid FROM pg_catalog.pg_attribute a WHERE a.attrelid = "+returnTypeRelid+" ORDER BY a.attnum ";
-                               ResultSet columnrs = connection.createStatement().executeQuery(columnsql);
-                               while (columnrs.next()) {
-                                       int columnTypeOid = columnrs.getInt("atttypid");
-                                       byte[][] tuple = new byte[13][];
-                                       tuple[0] = null;
-                                       tuple[1] = schema;
-                                       tuple[2] = procedureName;
-                                       tuple[3] = columnrs.getBytes("attname");
-                                       tuple[4] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.procedureColumnResult));
-                                       tuple[5] = encoding.encode(Integer.toString(connection.getSQLType(columnTypeOid)));
-                                       tuple[6] = encoding.encode(connection.getPGType(columnTypeOid));
-                                       tuple[7] = null;
-                                       tuple[8] = null;
-                                       tuple[9] = null;
-                                       tuple[10] = null;
-                                       tuple[11] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.procedureNullableUnknown));
-                                       tuple[12] = null;
-                                       v.addElement(tuple);
-                               }
-                       }
-               }
-               rs.close();
-
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
-       }
-
-       /*
-        * Get a description of tables available in a catalog.
-        *
-        * <p>Only table descriptions matching the catalog, schema, table
-        * name and type criteria are returned. They are ordered by
-        * TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.
-        *
-        * <p>Each table description has the following columns:
-        *
-        * <ol>
-        * <li><b>TABLE_CAT</b> String => table catalog (may be null)
-        * <li><b>TABLE_SCHEM</b> String => table schema (may be null)
-        * <li><b>TABLE_NAME</b> String => table name
-        * <li><b>TABLE_TYPE</b> String => table type. Typical types are "TABLE",
-        * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL
-        * TEMPORARY", "ALIAS", "SYNONYM".
-        * <li><b>REMARKS</b> String => explanatory comment on the table
-        * </ol>
-        *
-        * <p>The valid values for the types parameter are:
-        * "TABLE", "INDEX", "SEQUENCE", "VIEW",
-        * "SYSTEM TABLE", "SYSTEM INDEX", "SYSTEM VIEW",
-        * "SYSTEM TOAST TABLE", "SYSTEM TOAST INDEX",
-        * "TEMPORARY TABLE", and "TEMPORARY VIEW"
-        *
-        * @param catalog a catalog name; For org.postgresql, this is ignored, and
-        * should be set to null
-        * @param schemaPattern a schema name pattern
-        * @param tableNamePattern a table name pattern. For all tables this should be "%"
-        * @param types a list of table types to include; null returns
-        * all types
-        * @return each row is a table description
-        * @exception SQLException if a database-access error occurs.
-        */
-       public java.sql.ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String types[]) throws SQLException
-       {
-               String select;
-               String orderby;
-               String useSchemas;
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       useSchemas = "SCHEMAS";
-                       select = "SELECT NULL AS TABLE_CAT, n.nspname AS TABLE_SCHEM, c.relname AS TABLE_NAME, "+
-                       " CASE n.nspname LIKE 'pg\\\\_%' OR n.nspname = 'information_schema' "+
-                       " WHEN true THEN CASE "+
-                       "       WHEN n.nspname = 'pg_catalog' OR n.nspname = 'information_schema' THEN CASE c.relkind "+
-                       "               WHEN 'r' THEN 'SYSTEM TABLE' "+
-                       "               WHEN 'v' THEN 'SYSTEM VIEW' "+
-                       "               WHEN 'i' THEN 'SYSTEM INDEX' "+
-                       "               ELSE NULL "+
-                       "               END "+
-                       "       WHEN n.nspname = 'pg_toast' THEN CASE c.relkind "+
-                       "               WHEN 'r' THEN 'SYSTEM TOAST TABLE' "+
-                       "               WHEN 'i' THEN 'SYSTEM TOAST INDEX' "+
-                       "               ELSE NULL "+
-                       "               END "+
-                       "       ELSE CASE c.relkind "+
-                       "               WHEN 'r' THEN 'TEMPORARY TABLE' "+
-                       "               WHEN 'i' THEN 'TEMPORARY INDEX' "+
-                       "               ELSE NULL "+
-                       "               END "+
-                       "       END "+
-                       " WHEN false THEN CASE c.relkind "+
-                       "       WHEN 'r' THEN 'TABLE' "+
-                       "       WHEN 'i' THEN 'INDEX' "+
-                       "       WHEN 'S' THEN 'SEQUENCE' "+
-                       "       WHEN 'v' THEN 'VIEW' "+
-                       "       ELSE NULL "+
-                       "       END "+
-                       " ELSE NULL "+
-                       " END "+
-                       " AS TABLE_TYPE, d.description AS REMARKS "+
-                       " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c "+
-                       " LEFT JOIN pg_catalog.pg_description d ON (c.oid = d.objoid AND d.objsubid = 0) "+
-                       " LEFT JOIN pg_catalog.pg_class dc ON (d.classoid=dc.oid AND dc.relname='pg_class') "+
-                       " LEFT JOIN pg_catalog.pg_namespace dn ON (dn.oid=dc.relnamespace AND dn.nspname='pg_catalog') "+
-                       " WHERE c.relnamespace = n.oid ";
-                       if (schemaPattern != null && !"".equals(schemaPattern)) {
-                               select += " AND n.nspname LIKE '"+escapeQuotes(schemaPattern)+"' ";
-                       }
-                       orderby = " ORDER BY TABLE_TYPE,TABLE_SCHEM,TABLE_NAME ";
-               } else {
-                       useSchemas = "NOSCHEMAS";
-                       String tableType =  ""+
-                       " CASE c.relname LIKE 'pg\\\\_%' "+
-                       " WHEN true THEN CASE c.relname LIKE 'pg\\\\_toast\\\\_%' "+
-                       "       WHEN true THEN CASE c.relkind "+
-                       "               WHEN 'r' THEN 'SYSTEM TOAST TABLE' "+
-                       "               WHEN 'i' THEN 'SYSTEM TOAST INDEX' "+
-                       "               ELSE NULL "+
-                       "               END "+
-                       "       WHEN false THEN CASE c.relname LIKE 'pg\\\\_temp\\\\_%' "+
-                       "               WHEN true THEN CASE c.relkind "+
-                       "                       WHEN 'r' THEN 'TEMPORARY TABLE' "+
-                       "                       WHEN 'i' THEN 'TEMPORARY INDEX' "+
-                       "                       ELSE NULL "+
-                       "                       END "+
-                       "               WHEN false THEN CASE c.relkind "+
-                       "                       WHEN 'r' THEN 'SYSTEM TABLE' "+
-                       "                       WHEN 'v' THEN 'SYSTEM VIEW' "+
-                       "                       WHEN 'i' THEN 'SYSTEM INDEX' "+
-                       "                       ELSE NULL "+
-                       "                       END "+
-                       "               ELSE NULL "+
-                       "               END "+
-                       "       ELSE NULL "+
-                       "       END "+
-                       " WHEN false THEN CASE c.relkind "+
-                       "       WHEN 'r' THEN 'TABLE' "+
-                       "       WHEN 'i' THEN 'INDEX' "+
-                       "       WHEN 'S' THEN 'SEQUENCE' "+
-                       "       WHEN 'v' THEN 'VIEW' "+
-                       "       ELSE NULL "+
-                       "       END "+
-                       " ELSE NULL "+
-                       " END ";
-                       orderby = " ORDER BY TABLE_TYPE,TABLE_NAME ";
-                       if (connection.haveMinimumServerVersion("7.2")) {
-                               select = "SELECT NULL AS TABLE_CAT, NULL AS TABLE_SCHEM, c.relname AS TABLE_NAME, "+tableType+" AS TABLE_TYPE, d.description AS REMARKS "+
-                                       " FROM pg_class c "+
-                                       " LEFT JOIN pg_description d ON (c.oid=d.objoid AND d.objsubid = 0) "+
-                                       " LEFT JOIN pg_class dc ON (d.classoid = dc.oid AND dc.relname='pg_class') "+
-                                       " WHERE true ";
-                       } else if (connection.haveMinimumServerVersion("7.1")) {
-                               select = "SELECT NULL AS TABLE_CAT, NULL AS TABLE_SCHEM, c.relname AS TABLE_NAME, "+tableType+" AS TABLE_TYPE, d.description AS REMARKS "+
-                                       " FROM pg_class c "+
-                                       " LEFT JOIN pg_description d ON (c.oid=d.objoid) "+
-                                       " WHERE true ";
-                       } else {
-                               select = "SELECT NULL AS TABLE_CAT, NULL AS TABLE_SCHEM, c.relname AS TABLE_NAME, "+tableType+" AS TABLE_TYPE, NULL AS REMARKS "+
-                                       " FROM pg_class c "+
-                                       " WHERE true ";
-                       }
-               }
-
-               if (types == null) {
-                       types = defaultTableTypes;
-               }
-               if (tableNamePattern != null) {
-                       select += " AND c.relname LIKE '"+escapeQuotes(tableNamePattern)+"' ";
-               }
-               String sql = select;
-               sql += " AND (false ";
-               for (int i=0; i<types.length; i++) {
-                       Hashtable clauses = (Hashtable)tableTypeClauses.get(types[i]);
-                       if (clauses != null) {
-                               String clause = (String)clauses.get(useSchemas);
-                               sql += " OR ( "+clause+" ) ";
-                       }
-               }
-               sql += ") ";
-               sql += orderby;
-
-               return connection.createStatement().executeQuery(sql);
-       }
-
-       private static final Hashtable tableTypeClauses;
-       static {
-               tableTypeClauses = new Hashtable();
-               Hashtable ht = new Hashtable();
-               tableTypeClauses.put("TABLE",ht);
-               ht.put("SCHEMAS","c.relkind = 'r' AND n.nspname NOT LIKE 'pg\\\\_%' AND n.nspname <> 'information_schema'");
-               ht.put("NOSCHEMAS","c.relkind = 'r' AND c.relname NOT LIKE 'pg\\\\_%'");
-               ht = new Hashtable();
-               tableTypeClauses.put("VIEW",ht);
-               ht.put("SCHEMAS","c.relkind = 'v' AND n.nspname <> 'pg_catalog' AND n.nspname <> 'information_schema'");
-               ht.put("NOSCHEMAS","c.relkind = 'v' AND c.relname NOT LIKE 'pg\\\\_%'");
-               ht = new Hashtable();
-               tableTypeClauses.put("INDEX",ht);
-               ht.put("SCHEMAS","c.relkind = 'i' AND n.nspname NOT LIKE 'pg\\\\_%' AND n.nspname <> 'information_schema'");
-               ht.put("NOSCHEMAS","c.relkind = 'i' AND c.relname NOT LIKE 'pg\\\\_%'");
-               ht = new Hashtable();
-               tableTypeClauses.put("SEQUENCE",ht);
-               ht.put("SCHEMAS","c.relkind = 'S'");
-               ht.put("NOSCHEMAS","c.relkind = 'S'");
-               ht = new Hashtable();
-               tableTypeClauses.put("SYSTEM TABLE",ht);
-               ht.put("SCHEMAS","c.relkind = 'r' AND (n.nspname = 'pg_catalog' OR n.nspname = 'information_schema')");
-               ht.put("NOSCHEMAS","c.relkind = 'r' AND c.relname LIKE 'pg\\\\_%' AND c.relname NOT LIKE 'pg\\\\_toast\\\\_%' AND c.relname NOT LIKE 'pg\\\\_temp\\\\_%'");
-               ht = new Hashtable();
-               tableTypeClauses.put("SYSTEM TOAST TABLE",ht);
-               ht.put("SCHEMAS","c.relkind = 'r' AND n.nspname = 'pg_toast'");
-               ht.put("NOSCHEMAS","c.relkind = 'r' AND c.relname LIKE 'pg\\\\_toast\\\\_%'");
-               ht = new Hashtable();
-               tableTypeClauses.put("SYSTEM TOAST INDEX",ht);
-               ht.put("SCHEMAS","c.relkind = 'i' AND n.nspname = 'pg_toast'");
-               ht.put("NOSCHEMAS","c.relkind = 'i' AND c.relname LIKE 'pg\\\\_toast\\\\_%'");
-               ht = new Hashtable();
-               tableTypeClauses.put("SYSTEM VIEW",ht);
-               ht.put("SCHEMAS","c.relkind = 'v' AND (n.nspname = 'pg_catalog' OR n.nspname = 'information_schema') ");
-               ht.put("NOSCHEMAS","c.relkind = 'v' AND c.relname LIKE 'pg\\\\_%'");
-               ht = new Hashtable();
-               tableTypeClauses.put("SYSTEM INDEX",ht);
-               ht.put("SCHEMAS","c.relkind = 'i' AND (n.nspname = 'pg_catalog' OR n.nspname = 'information_schema') ");
-               ht.put("NOSCHEMAS","c.relkind = 'v' AND c.relname LIKE 'pg\\\\_%' AND c.relname NOT LIKE 'pg\\\\_toast\\\\_%' AND c.relname NOT LIKE 'pg\\\\_temp\\\\_%'");
-               ht = new Hashtable();
-               tableTypeClauses.put("TEMPORARY TABLE",ht);
-               ht.put("SCHEMAS","c.relkind = 'r' AND n.nspname LIKE 'pg\\\\_temp\\\\_%' ");
-               ht.put("NOSCHEMAS","c.relkind = 'r' AND c.relname LIKE 'pg\\\\_temp\\\\_%' ");
-               ht = new Hashtable();
-               tableTypeClauses.put("TEMPORARY INDEX",ht);
-               ht.put("SCHEMAS","c.relkind = 'i' AND n.nspname LIKE 'pg\\\\_temp\\\\_%' ");
-               ht.put("NOSCHEMAS","c.relkind = 'i' AND c.relname LIKE 'pg\\\\_temp\\\\_%' ");
-       }
-
-       // These are the default tables, used when NULL is passed to getTables
-       // The choice of these provide the same behaviour as psql's \d
-       private static final String defaultTableTypes[] = {
-                               "TABLE", "VIEW", "INDEX", "SEQUENCE", "TEMPORARY TABLE"
-                       };
-
-       /*
-        * Get the schema names available in this database.  The results
-        * are ordered by schema name.
-        *
-        * <P>The schema column is:
-        *      <OL>
-        *      <LI><B>TABLE_SCHEM</B> String => schema name
-        *      </OL>
-        *
-        * @return ResultSet each row has a single String column that is a
-        * schema name
-        */
-       public java.sql.ResultSet getSchemas() throws SQLException
-       {
-               String sql;
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       sql = "SELECT nspname AS TABLE_SCHEM FROM pg_catalog.pg_namespace WHERE nspname <> 'pg_toast' AND nspname NOT LIKE 'pg\\\\_temp\\\\_%' ORDER BY TABLE_SCHEM";
-               } else {
-                       sql = "SELECT ''::text AS TABLE_SCHEM ORDER BY TABLE_SCHEM";
-               }
-               return connection.createStatement().executeQuery(sql);
-       }
-
-       /*
-        * Get the catalog names available in this database.  The results
-        * are ordered by catalog name.
-        *
-        * <P>The catalog column is:
-        *      <OL>
-        *      <LI><B>TABLE_CAT</B> String => catalog name
-        *      </OL>
-        *
-        * @return ResultSet each row has a single String column that is a
-        * catalog name
-        */
-       public java.sql.ResultSet getCatalogs() throws SQLException
-       {
-               String sql;
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       sql = "SELECT datname AS TABLE_CAT FROM pg_catalog.pg_database ORDER BY TABLE_CAT";
-               } else {
-                       sql = "SELECT datname AS TABLE_CAT FROM pg_database ORDER BY TABLE_CAT";
-               }
-               return connection.createStatement().executeQuery(sql);
-       }
-
-       /*
-        * Get the table types available in this database.      The results
-        * are ordered by table type.
-        *
-        * <P>The table type is:
-        *      <OL>
-        *      <LI><B>TABLE_TYPE</B> String => table type.  Typical types are "TABLE",
-        *                      "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
-        *                      "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
-        *      </OL>
-        *
-        * @return ResultSet each row has a single String column that is a
-        * table type
-        */
-       public java.sql.ResultSet getTableTypes() throws SQLException
-       {
-               String types[] = new String[tableTypeClauses.size()];
-               Enumeration e = tableTypeClauses.keys();
-               int i=0;
-               while (e.hasMoreElements()) {
-                       types[i++] = (String)e.nextElement();}
-               sortStringArray(types);
-
-               Field f[] = new Field[1];
-               Vector v = new Vector();
-               f[0] = new Field(connection, new String("TABLE_TYPE"), iVarcharOid, getMaxNameLength());
-               for (i=0; i < types.length; i++)
-               {
-                       byte[][] tuple = new byte[1][];
-                       tuple[0] = encoding.encode(types[i]);
-                       v.addElement(tuple);
-               }
-
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
-       }
-
-       /*
-        * Get a description of table columns available in a catalog.
-        *
-        * <P>Only column descriptions matching the catalog, schema, table
-        * and column name criteria are returned.  They are ordered by
-        * TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.
-        *
-        * <P>Each column description has the following columns:
-        *      <OL>
-        *      <LI><B>TABLE_CAT</B> String => table catalog (may be null)
-        *      <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
-        *      <LI><B>TABLE_NAME</B> String => table name
-        *      <LI><B>COLUMN_NAME</B> String => column name
-        *      <LI><B>DATA_TYPE</B> short => SQL type from java.sql.Types
-        *      <LI><B>TYPE_NAME</B> String => Data source dependent type name
-        *      <LI><B>COLUMN_SIZE</B> int => column size.      For char or date
-        *              types this is the maximum number of characters, for numeric or
-        *              decimal types this is precision.
-        *      <LI><B>BUFFER_LENGTH</B> is not used.
-        *      <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits
-        *      <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2)
-        *      <LI><B>NULLABLE</B> int => is NULL allowed?
-        *              <UL>
-        *              <LI> columnNoNulls - might not allow NULL values
-        *              <LI> columnNullable - definitely allows NULL values
-        *              <LI> columnNullableUnknown - nullability unknown
-        *              </UL>
-        *      <LI><B>REMARKS</B> String => comment describing column (may be null)
-        *      <LI><B>COLUMN_DEF</B> String => default value (may be null)
-        *      <LI><B>SQL_DATA_TYPE</B> int => unused
-        *      <LI><B>SQL_DATETIME_SUB</B> int => unused
-        *      <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the
-        *               maximum number of bytes in the column
-        *      <LI><B>ORDINAL_POSITION</B> int => index of column in table
-        *              (starting at 1)
-        *      <LI><B>IS_NULLABLE</B> String => "NO" means column definitely
-        *              does not allow NULL values; "YES" means the column might
-        *              allow NULL values.      An empty string means nobody knows.
-        *      </OL>
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog
-        * @param schemaPattern a schema name pattern; "" retrieves those
-        * without a schema
-        * @param tableNamePattern a table name pattern
-        * @param columnNamePattern a column name pattern
-        * @return ResultSet each row is a column description
-        * @see #getSearchStringEscape
-        */
-       public java.sql.ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException
-       {
-               Vector v = new Vector();                // The new ResultSet tuple stuff
-               Field f[] = new Field[18];              // The field descriptors for the new ResultSet
-
-               f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, getMaxNameLength());
-               f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, getMaxNameLength());
-               f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, getMaxNameLength());
-               f[3] = new Field(connection, "COLUMN_NAME", iVarcharOid, getMaxNameLength());
-               f[4] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
-               f[5] = new Field(connection, "TYPE_NAME", iVarcharOid, getMaxNameLength());
-               f[6] = new Field(connection, "COLUMN_SIZE", iInt4Oid, 4);
-               f[7] = new Field(connection, "BUFFER_LENGTH", iVarcharOid, getMaxNameLength());
-               f[8] = new Field(connection, "DECIMAL_DIGITS", iInt4Oid, 4);
-               f[9] = new Field(connection, "NUM_PREC_RADIX", iInt4Oid, 4);
-               f[10] = new Field(connection, "NULLABLE", iInt4Oid, 4);
-               f[11] = new Field(connection, "REMARKS", iVarcharOid, getMaxNameLength());
-               f[12] = new Field(connection, "COLUMN_DEF", iVarcharOid, getMaxNameLength());
-               f[13] = new Field(connection, "SQL_DATA_TYPE", iInt4Oid, 4);
-               f[14] = new Field(connection, "SQL_DATETIME_SUB", iInt4Oid, 4);
-               f[15] = new Field(connection, "CHAR_OCTET_LENGTH", iVarcharOid, getMaxNameLength());
-               f[16] = new Field(connection, "ORDINAL_POSITION", iInt4Oid, 4);
-               f[17] = new Field(connection, "IS_NULLABLE", iVarcharOid, getMaxNameLength());
-
-               String sql;
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       sql = "SELECT n.nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,def.adsrc,dsc.description "+
-                               " FROM pg_catalog.pg_namespace n "+
-                               " JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid) "+
-                               " JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid) "+
-                               " LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) "+
-                               " LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid) "+
-                               " LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') "+
-                               " LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog') "+
-                               " WHERE a.attnum > 0 AND NOT a.attisdropped ";
-                       if (schemaPattern != null && !"".equals(schemaPattern)) {
-                               sql += " AND n.nspname LIKE '"+escapeQuotes(schemaPattern)+"' ";
-                       }
-               } else if (connection.haveMinimumServerVersion("7.2")) {
-                       sql = "SELECT NULL::text AS nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,def.adsrc,dsc.description "+
-                               " FROM pg_class c "+
-                               " JOIN pg_attribute a ON (a.attrelid=c.oid) "+
-                               " LEFT JOIN pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) "+
-                               " LEFT JOIN pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid) "+
-                               " LEFT JOIN pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') "+
-                               " WHERE a.attnum > 0 ";
-               } else if (connection.haveMinimumServerVersion("7.1")) {
-                       sql = "SELECT NULL::text AS nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,def.adsrc,dsc.description "+
-                               " FROM pg_class c "+
-                               " JOIN pg_attribute a ON (a.attrelid=c.oid) "+
-                               " LEFT JOIN pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) "+
-                               " LEFT JOIN pg_description dsc ON (a.oid=dsc.objoid) "+
-                               " WHERE a.attnum > 0 ";
-               } else {
-                       // if < 7.1 then don't get defaults or descriptions.
-                       sql = "SELECT NULL::text AS nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,NULL AS adsrc,NULL AS description "+
-                               " FROM pg_class c, pg_attribute a "+
-                               " WHERE a.attrelid=c.oid AND a.attnum > 0 ";
-               }
-
-               if (tableNamePattern != null && !"".equals(tableNamePattern)) {
-                       sql += " AND c.relname LIKE '"+escapeQuotes(tableNamePattern)+"' ";
-               }
-               if (columnNamePattern != null && !"".equals(columnNamePattern)) {
-                       sql += " AND a.attname LIKE '"+escapeQuotes(columnNamePattern)+"' ";
-               }
-               sql += " ORDER BY nspname,relname,attnum ";
-
-               ResultSet rs = connection.createStatement().executeQuery(sql);
-               while (rs.next())
-               {
-                       byte[][] tuple = new byte[18][];
-                       int typeOid = rs.getInt("atttypid");
-
-                       tuple[0] = null;                                        // Catalog name, not supported
-                       tuple[1] = rs.getBytes("nspname");      // Schema
-                       tuple[2] = rs.getBytes("relname");      // Table name
-                       tuple[3] = rs.getBytes("attname");      // Column name
-                       tuple[4] = encoding.encode(Integer.toString(connection.getSQLType(typeOid)));
-                       String pgType = connection.getPGType(typeOid);
-                       tuple[5] = encoding.encode(pgType);     // Type name
-
-                       // by default no decimal_digits
-                       // if the type is numeric or decimal we will
-                       // overwrite later.
-                       tuple[8] = encoding.encode("0");
-
-                       if (pgType.equals("bpchar") || pgType.equals("varchar"))
-                       {
-                               int atttypmod = rs.getInt("atttypmod");
-                               tuple[6] = encoding.encode(Integer.toString(atttypmod != -1 ? atttypmod - VARHDRSZ : 0));
-                       }
-                       else if (pgType.equals("numeric") || pgType.equals("decimal")) 
-                       {
-                               int attypmod = rs.getInt("atttypmod") - VARHDRSZ;
-                               tuple[6] = encoding.encode(Integer.toString( ( attypmod >> 16 ) & 0xffff ));
-                               tuple[8] = encoding.encode(Integer.toString(attypmod & 0xffff));
-                               tuple[9] = encoding.encode("10");
-                       }
-                       else if (pgType.equals("bit") || pgType.equals("varbit")) {
-                               tuple[6] = rs.getBytes("atttypmod");
-                               tuple[9] = encoding.encode("2");
-                       }
-                       else {
-                               tuple[6] = rs.getBytes("attlen");
-                               tuple[9] = encoding.encode("10");
-                       }
-
-                       tuple[7] = null;                                                // Buffer length
-
-                       tuple[10] = encoding.encode(Integer.toString(rs.getBoolean("attnotnull") ? java.sql.DatabaseMetaData.columnNoNulls : java.sql.DatabaseMetaData.columnNullable));        // Nullable
-                       tuple[11] = rs.getBytes("description");                         // Description (if any)
-                       tuple[12] = rs.getBytes("adsrc");                               // Column default
-                       tuple[13] = null;                                               // sql data type (unused)
-                       tuple[14] = null;                                               // sql datetime sub (unused)
-                       tuple[15] = tuple[6];                                   // char octet length
-                       tuple[16] = rs.getBytes("attnum");              // ordinal position
-                       tuple[17] = encoding.encode(rs.getBoolean("attnotnull") ? "NO" : "YES");        // Is nullable
-
-                       v.addElement(tuple);
-               }
-               rs.close();
-
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
-       }
-
-       /*
-        * Get a description of the access rights for a table's columns.
-        *
-        * <P>Only privileges matching the column name criteria are
-        * returned.  They are ordered by COLUMN_NAME and PRIVILEGE.
-        *
-        * <P>Each privilige description has the following columns:
-        *      <OL>
-        *      <LI><B>TABLE_CAT</B> String => table catalog (may be null)
-        *      <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
-        *      <LI><B>TABLE_NAME</B> String => table name
-        *      <LI><B>COLUMN_NAME</B> String => column name
-        *      <LI><B>GRANTOR</B> => grantor of access (may be null)
-        *      <LI><B>GRANTEE</B> String => grantee of access
-        *      <LI><B>PRIVILEGE</B> String => name of access (SELECT,
-        *              INSERT, UPDATE, REFRENCES, ...)
-        *      <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted
-        *              to grant to others; "NO" if not; null if unknown
-        *      </OL>
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog
-        * @param schema a schema name; "" retrieves those without a schema
-        * @param table a table name
-        * @param columnNamePattern a column name pattern
-        * @return ResultSet each row is a column privilege description
-        * @see #getSearchStringEscape
-        */
-       public java.sql.ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException
-       {
-               Field f[] = new Field[8];
-               Vector v = new Vector();
-
-               if (table == null)
-                       table = "%";
-
-               if (columnNamePattern == null)
-                       columnNamePattern = "%";
-
-               f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, getMaxNameLength());
-               f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, getMaxNameLength());
-               f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, getMaxNameLength());
-               f[3] = new Field(connection, "COLUMN_NAME", iVarcharOid, getMaxNameLength());
-               f[4] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
-               f[5] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
-               f[6] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
-               f[7] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
-
-               String sql;
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       sql = "SELECT n.nspname,c.relname,u.usename,c.relacl,a.attname "+
-                               " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c, pg_catalog.pg_user u, pg_catalog.pg_attribute a "+
-                               " WHERE c.relnamespace = n.oid "+
-                               " AND u.usesysid = c.relowner "+
-                               " AND c.oid = a.attrelid "+
-                               " AND c.relkind = 'r' "+
-                               " AND a.attnum > 0 AND NOT a.attisdropped ";
-                       if (schema != null && !"".equals(schema)) {
-                               sql += " AND n.nspname = '"+escapeQuotes(schema)+"' ";
-                       }
-               } else {
-                       sql = "SELECT NULL::text AS nspname,c.relname,u.usename,c.relacl,a.attname "+
-                               "FROM pg_class c, pg_user u,pg_attribute a "+
-                               " WHERE u.usesysid = c.relowner "+
-                               " AND c.oid = a.attrelid "+
-                               " AND a.attnum > 0 "+
-                               " AND c.relkind = 'r' ";
-               }
-
-               sql += " AND c.relname = '"+escapeQuotes(table)+"' ";
-               if (columnNamePattern != null && !"".equals(columnNamePattern)) {
-                       sql += " AND a.attname LIKE '"+escapeQuotes(columnNamePattern)+"' ";
-               }
-               sql += " ORDER BY attname ";
-
-               ResultSet rs = connection.createStatement().executeQuery(sql);
-               while (rs.next()) {
-                       byte schemaName[] = rs.getBytes("nspname");
-                       byte tableName[] = rs.getBytes("relname");
-                       byte column[] = rs.getBytes("attname");
-                       String owner = rs.getString("usename");
-                       String acl = rs.getString("relacl");
-                       Hashtable permissions = parseACL(acl, owner);
-                       String permNames[] = new String[permissions.size()];
-                       Enumeration e = permissions.keys();
-                       int i=0;
-                       while (e.hasMoreElements()) {
-                               permNames[i++] = (String)e.nextElement();
-                       }
-                       sortStringArray(permNames);
-                       for (i=0; i<permNames.length; i++) {
-                               byte[] privilege = encoding.encode(permNames[i]);
-                               Vector grantees = (Vector)permissions.get(permNames[i]);
-                               for (int j=0; j<grantees.size(); j++) {
-                                       String grantee = (String)grantees.elementAt(j);
-                                       String grantable = owner.equals(grantee) ? "YES" : "NO";
-                                       byte[][] tuple = new byte[8][];
-                                       tuple[0] = null;
-                                       tuple[1] = schemaName;
-                                       tuple[2] = tableName;
-                                       tuple[3] = column;
-                                       tuple[4] = encoding.encode(owner);
-                                       tuple[5] = encoding.encode(grantee);
-                                       tuple[6] = privilege;
-                                       tuple[7] = encoding.encode(grantable);
-                                       v.addElement(tuple);
-                               }
-                       }
-               }
-               rs.close();
-
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
-       }
-
-       /*
-       * Get a description of the access rights for each table available
-       * in a catalog.
-       *
-       * This method is currently unimplemented.
-       *
-       * <P>Only privileges matching the schema and table name
-       * criteria are returned.  They are ordered by TABLE_SCHEM,
-       * TABLE_NAME, and PRIVILEGE.
-       *
-       * <P>Each privilige description has the following columns:
-       *       <OL>
-       *       <LI><B>TABLE_CAT</B> String => table catalog (may be null)
-       *       <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
-       *       <LI><B>TABLE_NAME</B> String => table name
-       *       <LI><B>GRANTOR</B> => grantor of access (may be null)
-       *       <LI><B>GRANTEE</B> String => grantee of access
-       *       <LI><B>PRIVILEGE</B> String => name of access (SELECT,
-       *               INSERT, UPDATE, REFRENCES, ...)
-       *       <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted
-       *               to grant to others; "NO" if not; null if unknown
-       *       </OL>
-       *
-       * @param catalog a catalog name; "" retrieves those without a catalog
-       * @param schemaPattern a schema name pattern; "" retrieves those
-       * without a schema
-       * @param tableNamePattern a table name pattern
-       * @return ResultSet each row is a table privilege description
-       * @see #getSearchStringEscape
-       */
-       public java.sql.ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException
-       {
-               Field f[] = new Field[7];
-               Vector v = new Vector();
-
-               f[0] = new Field(connection, "TABLE_CAT", iVarcharOid, getMaxNameLength());
-               f[1] = new Field(connection, "TABLE_SCHEM", iVarcharOid, getMaxNameLength());
-               f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, getMaxNameLength());
-               f[3] = new Field(connection, "GRANTOR", iVarcharOid, getMaxNameLength());
-               f[4] = new Field(connection, "GRANTEE", iVarcharOid, getMaxNameLength());
-               f[5] = new Field(connection, "PRIVILEGE", iVarcharOid, getMaxNameLength());
-               f[6] = new Field(connection, "IS_GRANTABLE", iVarcharOid, getMaxNameLength());
-
-               String sql;
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       sql = "SELECT n.nspname,c.relname,u.usename,c.relacl "+
-                               " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c, pg_catalog.pg_user u "+
-                               " WHERE c.relnamespace = n.oid "+
-                               " AND u.usesysid = c.relowner "+
-                               " AND c.relkind = 'r' ";
-                       if (schemaPattern != null && !"".equals(schemaPattern)) {
-                               sql += " AND n.nspname LIKE '"+escapeQuotes(schemaPattern)+"' ";
-                       }
-               } else {
-                       sql = "SELECT NULL::text AS nspname,c.relname,u.usename,c.relacl "+
-                               "FROM pg_class c, pg_user u "+
-                               " WHERE u.usesysid = c.relowner "+
-                               " AND c.relkind = 'r' ";
-               }
-
-               if (tableNamePattern != null && !"".equals(tableNamePattern)) {
-                       sql += " AND c.relname LIKE '"+escapeQuotes(tableNamePattern)+"' ";
-               }
-               sql += " ORDER BY nspname, relname ";
-
-               ResultSet rs = connection.createStatement().executeQuery(sql);
-               while (rs.next()) {
-                       byte schema[] = rs.getBytes("nspname");
-                       byte table[] = rs.getBytes("relname");
-                       String owner = rs.getString("usename");
-                       String acl = rs.getString("relacl");
-                       Hashtable permissions = parseACL(acl, owner);
-                       String permNames[] = new String[permissions.size()];
-                       Enumeration e = permissions.keys();
-                       int i=0;
-                       while (e.hasMoreElements()) {
-                               permNames[i++] = (String)e.nextElement();
-                       }
-                       sortStringArray(permNames);
-                       for (i=0; i<permNames.length; i++) {
-                               byte[] privilege = encoding.encode(permNames[i]);
-                               Vector grantees = (Vector)permissions.get(permNames[i]);
-                               for (int j=0; j<grantees.size(); j++) {
-                                       String grantee = (String)grantees.elementAt(j);
-                                       String grantable = owner.equals(grantee) ? "YES" : "NO";
-                                       byte[][] tuple = new byte[7][];
-                                       tuple[0] = null;
-                                       tuple[1] = schema;
-                                       tuple[2] = table;
-                                       tuple[3] = encoding.encode(owner);
-                                       tuple[4] = encoding.encode(grantee);
-                                       tuple[5] = privilege;
-                                       tuple[6] = encoding.encode(grantable);
-                                       v.addElement(tuple);
-                               }
-                       }
-               }
-               rs.close();
-
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
-       }
-
-       private static void sortStringArray(String s[]) {
-               for (int i=0; i<s.length-1; i++) {
-                       for (int j=i+1; j<s.length; j++) {
-                               if (s[i].compareTo(s[j]) > 0) {
-                                       String tmp = s[i];
-                                       s[i] = s[j];
-                                       s[j] = tmp;
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Parse an String of ACLs into a Vector of ACLs.
-        */
-       private static Vector parseACLArray(String aclString) {
-               Vector acls = new Vector();
-               if (aclString == null || aclString.length() == 0) {
-                       return acls;
-               }
-               boolean inQuotes = false;
-               // start at 1 because of leading "{"
-               int beginIndex = 1;
-               char prevChar = ' ';
-               for (int i=beginIndex; i<aclString.length(); i++) {
-                       
-                       char c = aclString.charAt(i);
-                       if (c == '"' && prevChar != '\\') {
-                               inQuotes = !inQuotes;
-                       } else if (c == ',' && !inQuotes) {
-                               acls.addElement(aclString.substring(beginIndex,i));
-                               beginIndex = i+1;
-                       }
-                       prevChar = c;
-               }
-               // add last element removing the trailing "}"
-               acls.addElement(aclString.substring(beginIndex,aclString.length()-1));
-
-               // Strip out enclosing quotes, if any.
-               for (int i=0; i<acls.size(); i++) {
-                       String acl = (String)acls.elementAt(i);
-                       if (acl.startsWith("\"") && acl.endsWith("\"")) {
-                               acl = acl.substring(1,acl.length()-1);
-                               acls.setElementAt(acl,i);
-                       }
-               }
-               return acls;
-       }
-
-       /**
-        * Add the user described by the given acl to the Vectors of users
-        * with the privileges described by the acl.
-        */
-       private void addACLPrivileges(String acl, Hashtable privileges) {
-               int equalIndex = acl.lastIndexOf("=");
-               String name = acl.substring(0,equalIndex);
-               if (name.length() == 0) {
-                       name = "PUBLIC";
-               }
-               String privs = acl.substring(equalIndex+1);
-               for (int i=0; i<privs.length(); i++) {
-                       char c = privs.charAt(i);
-                       String sqlpriv;
-                       switch (c) {
-                               case 'a': sqlpriv = "INSERT"; break;
-                               case 'r': sqlpriv = "SELECT"; break;
-                               case 'w': sqlpriv = "UPDATE"; break;
-                               case 'd': sqlpriv = "DELETE"; break;
-                               case 'R': sqlpriv = "RULE"; break;
-                               case 'x': sqlpriv = "REFERENCES"; break;
-                               case 't': sqlpriv = "TRIGGER"; break;
-                               // the folloowing can't be granted to a table, but
-                               // we'll keep them for completeness.
-                               case 'X': sqlpriv = "EXECUTE"; break;
-                               case 'U': sqlpriv = "USAGE"; break;
-                               case 'C': sqlpriv = "CREATE"; break;
-                               case 'T': sqlpriv = "CREATE TEMP"; break;
-                               default: sqlpriv = "UNKNOWN";
-                       }
-                       Vector usersWithPermission = (Vector)privileges.get(sqlpriv);
-                       if (usersWithPermission == null) {
-                               usersWithPermission = new Vector();
-                               privileges.put(sqlpriv,usersWithPermission);
-                       }
-                       usersWithPermission.addElement(name);
-               }
-       }
-
-       /**
-        * Take the a String representing an array of ACLs and return
-        * a Hashtable mapping the SQL permission name to a Vector of
-        * usernames who have that permission.
-        */
-       protected Hashtable parseACL(String aclArray, String owner) {
-               if (aclArray == null || aclArray == "") {
-                       //null acl is a shortcut for owner having full privs
-                       aclArray = "{" + owner + "=arwdRxt}";
-               }
-               Vector acls = parseACLArray(aclArray);
-               Hashtable privileges = new Hashtable();
-               for (int i=0; i<acls.size(); i++) {
-                       String acl = (String)acls.elementAt(i);
-                       addACLPrivileges(acl,privileges);
-               }
-               return privileges;
-       }
-
-       /*
-        * Get a description of a table's optimal set of columns that
-        * uniquely identifies a row. They are ordered by SCOPE.
-        *
-        * <P>Each column description has the following columns:
-        *      <OL>
-        *      <LI><B>SCOPE</B> short => actual scope of result
-        *              <UL>
-        *              <LI> bestRowTemporary - very temporary, while using row
-        *              <LI> bestRowTransaction - valid for remainder of current transaction
-        *              <LI> bestRowSession - valid for remainder of current session
-        *              </UL>
-        *      <LI><B>COLUMN_NAME</B> String => column name
-        *      <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
-        *      <LI><B>TYPE_NAME</B> String => Data source dependent type name
-        *      <LI><B>COLUMN_SIZE</B> int => precision
-        *      <LI><B>BUFFER_LENGTH</B> int => not used
-        *      <LI><B>DECIMAL_DIGITS</B> short  => scale
-        *      <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column
-        *              like an Oracle ROWID
-        *              <UL>
-        *              <LI> bestRowUnknown - may or may not be pseudo column
-        *              <LI> bestRowNotPseudo - is NOT a pseudo column
-        *              <LI> bestRowPseudo - is a pseudo column
-        *              </UL>
-        *      </OL>
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog
-        * @param schema a schema name; "" retrieves those without a schema
-        * @param table a table name
-        * @param scope the scope of interest; use same values as SCOPE
-        * @param nullable include columns that are nullable?
-        * @return ResultSet each row is a column description
-        */
-       // Implementation note: This is required for Borland's JBuilder to work
-       public java.sql.ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException
-       {
-               Field f[] = new Field[8];
-               Vector v = new Vector();                // The new ResultSet tuple stuff
-
-               f[0] = new Field(connection, "SCOPE", iInt2Oid, 2);
-               f[1] = new Field(connection, "COLUMN_NAME", iVarcharOid, getMaxNameLength());
-               f[2] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
-               f[3] = new Field(connection, "TYPE_NAME", iVarcharOid, getMaxNameLength());
-               f[4] = new Field(connection, "COLUMN_SIZE", iInt4Oid, 4);
-               f[5] = new Field(connection, "BUFFER_LENGTH", iInt4Oid, 4);
-               f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2);
-               f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2);
-
-               /* At the moment this simply returns a table's primary key,
-                * if there is one.  I believe other unique indexes, ctid,
-                * and oid should also be considered. -KJ
-                */
-
-               String from;
-               String where = "";
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       from = " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class ct, pg_catalog.pg_class ci, pg_catalog.pg_attribute a, pg_catalog.pg_index i ";
-                       where = " AND ct.relnamespace = n.oid ";
-                       if (schema != null && !"".equals(schema)) {
-                               where += " AND n.nspname = '"+escapeQuotes(schema)+"' ";
-                       }
-               } else {
-                       from = " FROM pg_class ct, pg_class ci, pg_attribute a, pg_index i ";
-               }
-               String sql = "SELECT a.attname, a.atttypid "+
-                       from+
-                       " WHERE ct.oid=i.indrelid AND ci.oid=i.indexrelid "+
-                       " AND a.attrelid=ci.oid AND i.indisprimary "+
-                       " AND ct.relname = '"+escapeQuotes(table)+"' "+
-                       where+
-                       " ORDER BY a.attnum ";
-
-               ResultSet rs = connection.createStatement().executeQuery(sql);
-               while (rs.next()) {
-                       byte tuple[][] = new byte[8][];
-                       int columnTypeOid = rs.getInt("atttypid");
-                       tuple[0] = encoding.encode(Integer.toString(scope));
-                       tuple[1] = rs.getBytes("attname");
-                       tuple[2] = encoding.encode(Integer.toString(connection.getSQLType(columnTypeOid)));
-                       tuple[3] = encoding.encode(connection.getPGType(columnTypeOid));
-                       tuple[4] = null;
-                       tuple[5] = null;
-                       tuple[6] = null;
-                       tuple[7] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.bestRowNotPseudo));
-                       v.addElement(tuple);
-               }
-
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
-       }
-
-       /*
-        * Get a description of a table's columns that are automatically
-        * updated when any value in a row is updated.  They are
-        * unordered.
-        *
-        * <P>Each column description has the following columns:
-        *      <OL>
-        *      <LI><B>SCOPE</B> short => is not used
-        *      <LI><B>COLUMN_NAME</B> String => column name
-        *      <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
-        *      <LI><B>TYPE_NAME</B> String => Data source dependent type name
-        *      <LI><B>COLUMN_SIZE</B> int => precision
-        *      <LI><B>BUFFER_LENGTH</B> int => length of column value in bytes
-        *      <LI><B>DECIMAL_DIGITS</B> short  => scale
-        *      <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column
-        *              like an Oracle ROWID
-        *              <UL>
-        *              <LI> versionColumnUnknown - may or may not be pseudo column
-        *              <LI> versionColumnNotPseudo - is NOT a pseudo column
-        *              <LI> versionColumnPseudo - is a pseudo column
-        *              </UL>
-        *      </OL>
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog
-        * @param schema a schema name; "" retrieves those without a schema
-        * @param table a table name
-        * @return ResultSet each row is a column description
-        */
-       public java.sql.ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException
-       {
-               Field f[] = new Field[8];
-               Vector v = new Vector();                // The new ResultSet tuple stuff
-
-               f[0] = new Field(connection, "SCOPE", iInt2Oid, 2);
-               f[1] = new Field(connection, "COLUMN_NAME", iVarcharOid, getMaxNameLength());
-               f[2] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
-               f[3] = new Field(connection, "TYPE_NAME", iVarcharOid, getMaxNameLength());
-               f[4] = new Field(connection, "COLUMN_SIZE", iInt4Oid, 4);
-               f[5] = new Field(connection, "BUFFER_LENGTH", iInt4Oid, 4);
-               f[6] = new Field(connection, "DECIMAL_DIGITS", iInt2Oid, 2);
-               f[7] = new Field(connection, "PSEUDO_COLUMN", iInt2Oid, 2);
-
-               byte tuple[][] = new byte[8][];
-
-               /* Postgresql does not have any column types that are
-                * automatically updated like some databases' timestamp type.
-                * We can't tell what rules or triggers might be doing, so we
-                * are left with the system columns that change on an update.
-                * An update may change all of the following system columns:
-                * ctid, xmax, xmin, cmax, and cmin.  Depending on if we are
-                * in a transaction and wether we roll it back or not the
-                * only guaranteed change is to ctid. -KJ
-                */
-
-               tuple[0] = null;
-               tuple[1] = encoding.encode("ctid");
-               tuple[2] = encoding.encode(Integer.toString(connection.getSQLType("tid")));
-               tuple[3] = encoding.encode("tid");
-               tuple[4] = null;
-               tuple[5] = null;
-               tuple[6] = null;
-               tuple[7] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.versionColumnPseudo));
-               v.addElement(tuple);
-
-               /* Perhaps we should check that the given
-                * catalog.schema.table actually exists. -KJ
-                */
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
-       }
-
-       /*
-        * Get a description of a table's primary key columns.  They
-        * are ordered by COLUMN_NAME.
-        *
-        * <P>Each column description has the following columns:
-        *      <OL>
-        *      <LI><B>TABLE_CAT</B> String => table catalog (may be null)
-        *      <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
-        *      <LI><B>TABLE_NAME</B> String => table name
-        *      <LI><B>COLUMN_NAME</B> String => column name
-        *      <LI><B>KEY_SEQ</B> short => sequence number within primary key
-        *      <LI><B>PK_NAME</B> String => primary key name (may be null)
-        *      </OL>
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog
-        * @param schema a schema name pattern; "" retrieves those
-        * without a schema
-        * @param table a table name
-        * @return ResultSet each row is a primary key column description
-        */
-       public java.sql.ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException
-       {
-               String select;
-               String from;
-               String where = "";
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       select = "SELECT NULL AS TABLE_CAT, n.nspname AS TABLE_SCHEM, ";
-                       from = " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class ct, pg_catalog.pg_class ci, pg_catalog.pg_attribute a, pg_catalog.pg_index i ";
-                       where = " AND ct.relnamespace = n.oid ";
-                       if (schema != null && !"".equals(schema)) {
-                               where += " AND n.nspname = '"+escapeQuotes(schema)+"' ";
-                       }
-               } else {
-                       select = "SELECT NULL AS TABLE_CAT, NULL AS TABLE_SCHEM, ";
-                       from = " FROM pg_class ct, pg_class ci, pg_attribute a, pg_index i ";
-               }
-               String sql = select+
-                       " ct.relname AS TABLE_NAME, "+
-                       " a.attname AS COLUMN_NAME, "+
-                       " a.attnum AS KEY_SEQ, "+
-                       " ci.relname AS PK_NAME "+
-                       from+
-                       " WHERE ct.oid=i.indrelid AND ci.oid=i.indexrelid "+
-                       " AND a.attrelid=ci.oid AND i.indisprimary ";
-                        if (table != null && !"".equals(table)) {
-                               sql += " AND ct.relname = '"+escapeQuotes(table)+"' ";
-                        }
-                       sql += where+
-                       " ORDER BY table_name, pk_name, key_seq";
-               return connection.createStatement().executeQuery(sql);
-       }
-
-       /**
-        *
-        * @param catalog
-        * @param schema
-        * @param primaryTable if provided will get the keys exported by this table
-        * @param foreignTable if provided will get the keys imported by this table
-        * @return ResultSet
-        * @throws SQLException
-        */
-
-       protected java.sql.ResultSet getImportedExportedKeys(String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException
-       {
-               Field f[] = new Field[14];
-
-               f[0] = new Field(connection, "PKTABLE_CAT", iVarcharOid, getMaxNameLength());
-               f[1] = new Field(connection, "PKTABLE_SCHEM", iVarcharOid, getMaxNameLength());
-               f[2] = new Field(connection, "PKTABLE_NAME", iVarcharOid, getMaxNameLength());
-               f[3] = new Field(connection, "PKCOLUMN_NAME", iVarcharOid, getMaxNameLength());
-               f[4] = new Field(connection, "FKTABLE_CAT", iVarcharOid, getMaxNameLength());
-               f[5] = new Field(connection, "FKTABLE_SCHEM", iVarcharOid, getMaxNameLength());
-               f[6] = new Field(connection, "FKTABLE_NAME", iVarcharOid, getMaxNameLength());
-               f[7] = new Field(connection, "FKCOLUMN_NAME", iVarcharOid, getMaxNameLength());
-               f[8] = new Field(connection, "KEY_SEQ", iInt2Oid, 2);
-               f[9] = new Field(connection, "UPDATE_RULE", iInt2Oid, 2);
-               f[10] = new Field(connection, "DELETE_RULE", iInt2Oid, 2);
-               f[11] = new Field(connection, "FK_NAME", iVarcharOid, getMaxNameLength());
-               f[12] = new Field(connection, "PK_NAME", iVarcharOid, getMaxNameLength());
-               f[13] = new Field(connection, "DEFERRABILITY", iInt2Oid, 2);
-
-
-               String select;
-               String from;
-               String where = "";
-
-               /*
-                * The addition of the pg_constraint in 7.3 table should have really
-                * helped us out here, but it comes up just a bit short.
-                * - The conkey, confkey columns aren't really useful without
-                *   contrib/array unless we want to issues separate queries.
-                * - Unique indexes that can support foreign keys are not necessarily
-                *   added to pg_constraint.  Also multiple unique indexes covering
-                *   the same keys can be created which make it difficult to determine
-                *   the PK_NAME field.
-                */
-
-               if (connection.haveMinimumServerVersion("7.4")) {
-                       String sql = "SELECT NULL::text AS PKTABLE_CAT, pkn.nspname AS PKTABLE_SCHEMA, pkc.relname AS PKTABLE_NAME, pka.attname AS PKCOLUMN_NAME, "+
-                       "NULL::text AS FK_TABLE_CAT, fkn.nspname AS FKTABLE_SCHEMA, fkc.relname AS FKTABLE_NAME, fka.attname AS FKCOLUMN_NAME, "+
-                       "pos.n AS KEY_SEQ, "+
-                       "CASE con.confupdtype "+
-                               " WHEN 'c' THEN " + DatabaseMetaData.importedKeyCascade +
-                               " WHEN 'n' THEN " + DatabaseMetaData.importedKeySetNull +
-                               " WHEN 'd' THEN " + DatabaseMetaData.importedKeySetDefault +
-                               " WHEN 'r' THEN " + DatabaseMetaData.importedKeyRestrict +
-                               " WHEN 'a' THEN " + DatabaseMetaData.importedKeyNoAction +
-                               " ELSE NULL END AS UPDATE_RULE, "+
-                       "CASE con.confdeltype "+
-                               " WHEN 'c' THEN " + DatabaseMetaData.importedKeyCascade +
-                               " WHEN 'n' THEN " + DatabaseMetaData.importedKeySetNull +
-                               " WHEN 'd' THEN " + DatabaseMetaData.importedKeySetDefault +
-                               " WHEN 'r' THEN " + DatabaseMetaData.importedKeyRestrict +
-                               " WHEN 'a' THEN " + DatabaseMetaData.importedKeyNoAction +
-                               " ELSE NULL END AS DELETE_RULE, "+
-                       "con.conname AS FK_NAME, pkic.relname AS PK_NAME, "+
-                       "CASE "+
-                               " WHEN con.condeferrable AND con.condeferred THEN " + DatabaseMetaData.importedKeyInitiallyDeferred +
-                               " WHEN con.condeferrable THEN " + DatabaseMetaData.importedKeyInitiallyImmediate +
-                               " ELSE " + DatabaseMetaData.importedKeyNotDeferrable+
-                               " END AS DEFERRABILITY "+
-                       " FROM "+
-                       " pg_catalog.pg_namespace pkn, pg_catalog.pg_class pkc, pg_catalog.pg_attribute pka, "+
-                       " pg_catalog.pg_namespace fkn, pg_catalog.pg_class fkc, pg_catalog.pg_attribute fka, "+
-                       " pg_catalog.pg_constraint con, information_schema._pg_keypositions() pos(n), "+
-                       " pg_catalog.pg_depend dep, pg_catalog.pg_class pkic "+
-                       " WHERE pkn.oid = pkc.relnamespace AND pkc.oid = pka.attrelid AND pka.attnum = con.confkey[pos.n] AND con.confrelid = pkc.oid "+
-                       " AND fkn.oid = fkc.relnamespace AND fkc.oid = fka.attrelid AND fka.attnum = con.conkey[pos.n] AND con.conrelid = fkc.oid "+
-                       " AND con.contype = 'f' AND con.oid = dep.objid AND pkic.oid = dep.refobjid AND pkic.relkind = 'i' AND dep.classid = 'pg_constraint'::regclass::oid AND dep.refclassid = 'pg_class'::regclass::oid ";
-                       if (primarySchema != null && !"".equals(primarySchema)) {
-                               sql += " AND pkn.nspname = '"+escapeQuotes(primarySchema)+"' ";
-                       }
-                       if (foreignSchema != null && !"".equals(foreignSchema)) {
-                               sql += " AND fkn.nspname = '"+escapeQuotes(foreignSchema)+"' ";
-                       }
-                       if (primaryTable != null && !"".equals(primaryTable)) {
-                               sql += " AND pkc.relname = '"+escapeQuotes(primaryTable)+"' ";
-                       }
-                       if (foreignTable != null && !"".equals(foreignTable)) {
-                               sql += " AND fkc.relname = '"+escapeQuotes(foreignTable)+"' ";
-                       }
-                                               
-                       if (primaryTable != null) {
-                               sql += " ORDER BY fkn.nspname,fkc.relname,pos.n";
-                       } else {
-                               sql += " ORDER BY pkn.nspname,pkc.relname,pos.n";
-                       }
-
-                       return connection.createStatement().executeQuery(sql);
-               } else if (connection.haveMinimumServerVersion("7.3")) {
-                       select = "SELECT DISTINCT n1.nspname as pnspname,n2.nspname as fnspname, ";
-                       from = " FROM pg_catalog.pg_namespace n1 "+
-                               " JOIN pg_catalog.pg_class c1 ON (c1.relnamespace = n1.oid) "+
-                               " JOIN pg_catalog.pg_index i ON (c1.oid=i.indrelid) "+
-                               " JOIN pg_catalog.pg_class ic ON (i.indexrelid=ic.oid) "+
-                               " JOIN pg_catalog.pg_attribute a ON (ic.oid=a.attrelid), "+
-                               " pg_catalog.pg_namespace n2 "+
-                               " JOIN pg_catalog.pg_class c2 ON (c2.relnamespace=n2.oid), "+
-                               " pg_catalog.pg_trigger t1 "+
-                               " JOIN pg_catalog.pg_proc p1 ON (t1.tgfoid=p1.oid), "+
-                               " pg_catalog.pg_trigger t2 "+
-                               " JOIN pg_catalog.pg_proc p2 ON (t2.tgfoid=p2.oid) ";
-                       if (primarySchema != null && !"".equals(primarySchema)) {
-                               where += " AND n1.nspname = '"+escapeQuotes(primarySchema)+"' ";
-                       }
-                       if (foreignSchema != null && !"".equals(foreignSchema)) {
-                               where += " AND n2.nspname = '"+escapeQuotes(foreignSchema)+"' ";
-                       }
-               } else {
-                       select = "SELECT DISTINCT NULL::text as pnspname, NULL::text as fnspname, ";
-                       from = " FROM pg_class c1 "+
-                               " JOIN pg_index i ON (c1.oid=i.indrelid) "+
-                               " JOIN pg_class ic ON (i.indexrelid=ic.oid) "+
-                               " JOIN pg_attribute a ON (ic.oid=a.attrelid), "+
-                               " pg_class c2, "+
-                               " pg_trigger t1 "+
-                               " JOIN pg_proc p1 ON (t1.tgfoid=p1.oid), "+
-                               " pg_trigger t2 "+
-                               " JOIN pg_proc p2 ON (t2.tgfoid=p2.oid) ";
-               }
-
-               String sql = select
-                       + "c1.relname as prelname, "
-                       + "c2.relname as frelname, "
-                       + "t1.tgconstrname, "
-                       + "a.attnum as keyseq, "
-                       + "ic.relname as fkeyname, "
-                       + "t1.tgdeferrable, "
-                       + "t1.tginitdeferred, "
-                       + "t1.tgnargs,t1.tgargs, "
-                       + "p1.proname as updaterule, "
-                       + "p2.proname as deleterule "
-                       + from 
-                       + "WHERE "
-                       // isolate the update rule
-                       + "(t1.tgrelid=c1.oid "
-                       + "AND t1.tgisconstraint "
-                       + "AND t1.tgconstrrelid=c2.oid "
-                       + "AND p1.proname LIKE 'RI\\\\_FKey\\\\_%\\\\_upd') "
-
-                       + "AND "
-                       // isolate the delete rule
-                       + "(t2.tgrelid=c1.oid "
-                       + "AND t2.tgisconstraint "
-                       + "AND t2.tgconstrrelid=c2.oid "
-                       + "AND p2.proname LIKE 'RI\\\\_FKey\\\\_%\\\\_del') "
-
-                       + "AND i.indisprimary "
-                       + where;
-
-               if (primaryTable != null) {
-                       sql += "AND c1.relname='" + escapeQuotes(primaryTable) + "' ";
-               }
-               if (foreignTable != null) {
-                       sql += "AND c2.relname='" + escapeQuotes(foreignTable) + "' ";
-               }
-
-               sql += "ORDER BY ";
-
-               // orderby is as follows getExported, orders by FKTABLE,
-               // getImported orders by PKTABLE
-               // getCrossReference orders by FKTABLE, so this should work for both,
-               // since when getting crossreference, primaryTable will be defined
-
-               if (primaryTable != null) {
-                       if (connection.haveMinimumServerVersion("7.3")) {
-                               sql += "fnspname,";
-                       }
-                       sql += "frelname";
-               } else {
-                       if (connection.haveMinimumServerVersion("7.3")) {
-                               sql += "pnspname,";
-                       }
-                       sql += "prelname";
-               }
-
-               sql += ",keyseq";
-
-               ResultSet rs = connection.createStatement().executeQuery(sql);
-
-               // returns the following columns
-               // and some example data with a table defined as follows
-
-               // create table people ( id int primary key);
-               // create table policy ( id int primary key);
-               // create table users  ( id int primary key, people_id int references people(id), policy_id int references policy(id))
-
-               // prelname | frelname | tgconstrname | keyseq | fkeyName        | tgdeferrable | tginitdeferred
-               //        1             |        2         |      3               |    4   |     5               |               6              |        7
-
-               //      people  | users    | <unnamed>    |    1   | people_pkey |               f              |        f
-
-               // | tgnargs |                                            tgargs                                                                          | updaterule                   | deleterule
-               // |    8        |                                                      9                                                                                 |    10                                |        11
-               // |    6        | <unnamed>\000users\000people\000UNSPECIFIED\000people_id\000id\000 | RI_FKey_noaction_upd | RI_FKey_noaction_del
-
-               Vector tuples = new Vector();
-
-               while ( rs.next() )
-               {
-                       byte tuple[][] = new byte[14][];
-
-                       tuple[1] = rs.getBytes(1); //PKTABLE_SCHEM
-                       tuple[5] = rs.getBytes(2); //FKTABLE_SCHEM
-                       tuple[2] = rs.getBytes(3); //PKTABLE_NAME
-                       tuple[6] = rs.getBytes(4); //FKTABLE_NAME
-                       String fKeyName = rs.getString(5);
-                       String updateRule = rs.getString(12);
-
-                       if (updateRule != null )
-                       {
-                               // Rules look like this RI_FKey_noaction_del so we want to pull out the part between the 'Key_' and the last '_' s
-
-                               String rule = updateRule.substring(8, updateRule.length() - 4);
-
-                               int action = java.sql.DatabaseMetaData.importedKeyNoAction;
-
-                               if ( rule == null || "noaction".equals(rule) )
-                                       action = java.sql.DatabaseMetaData.importedKeyNoAction;
-                               if ("cascade".equals(rule))
-                                       action = java.sql.DatabaseMetaData.importedKeyCascade;
-                               else if ("setnull".equals(rule))
-                                       action = java.sql.DatabaseMetaData.importedKeySetNull;
-                               else if ("setdefault".equals(rule))
-                                       action = java.sql.DatabaseMetaData.importedKeySetDefault;
-                               else if ("restrict".equals(rule))
-                                       action = java.sql.DatabaseMetaData.importedKeyRestrict;
-
-                               tuple[9] = encoding.encode(Integer.toString(action));
-
-                       }
-
-                       String deleteRule = rs.getString(13);
-
-                       if ( deleteRule != null )
-                       {
-
-                               String rule = deleteRule.substring(8, deleteRule.length() - 4);
-
-                               int action = java.sql.DatabaseMetaData.importedKeyNoAction;
-                               if ("cascade".equals(rule))
-                                       action = java.sql.DatabaseMetaData.importedKeyCascade;
-                               else if ("setnull".equals(rule))
-                                       action = java.sql.DatabaseMetaData.importedKeySetNull;
-                               else if ("setdefault".equals(rule))
-                                       action = java.sql.DatabaseMetaData.importedKeySetDefault;
-                               else if ("restrict".equals(rule))
-                                       action = java.sql.DatabaseMetaData.importedKeyRestrict;
-                               tuple[10] = encoding.encode(Integer.toString(action));
-                       }
-
-
-                       int keySequence = rs.getInt(6); //KEY_SEQ
-
-                       // Parse the tgargs data
-                       String fkeyColumn = "";
-                       String pkeyColumn = "";
-                       String fkName = "";
-                       // Note, I am guessing at most of this, but it should be close
-                       // if not, please correct
-                       // the keys are in pairs and start after the first four arguments
-                       // the arguments are seperated by \000
-
-                       String targs = rs.getString(11);
-
-                       // args look like this
-                       //<unnamed>\000ww\000vv\000UNSPECIFIED\000m\000a\000n\000b\000
-                       // we are primarily interested in the column names which are the last items in the string
-
-                       Vector tokens = tokenize(targs, "\\000");
-                       if (tokens.size() > 0) {
-                               fkName = (String)tokens.elementAt(0);
-                       }
-
-                       if (fkName.startsWith("<unnamed>")) {
-                               fkName = targs;
-                       }
-
-                       int element = 4 + (keySequence - 1) * 2;
-                       if (tokens.size() > element) {
-                               fkeyColumn = (String)tokens.elementAt(element);
-                       }
-
-                       element++;
-                       if (tokens.size() > element) {
-                               pkeyColumn = (String)tokens.elementAt(element);
-                       }
-
-                       tuple[3] = encoding.encode(pkeyColumn); //PKCOLUMN_NAME
-                       tuple[7] = encoding.encode(fkeyColumn); //FKCOLUMN_NAME
-
-                       tuple[8] = rs.getBytes(6); //KEY_SEQ
-                       tuple[11] = encoding.encode(fkName); //FK_NAME this will give us a unique name for the foreign key
-                       tuple[12] = rs.getBytes(7); //PK_NAME
-
-                       // DEFERRABILITY
-                       int deferrability = java.sql.DatabaseMetaData.importedKeyNotDeferrable;
-                       boolean deferrable = rs.getBoolean(8);
-                       boolean initiallyDeferred = rs.getBoolean(9);
-                       if (deferrable)
-                       {
-                               if (initiallyDeferred)
-                                       deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyDeferred;
-                               else
-                                       deferrability = java.sql.DatabaseMetaData.importedKeyInitiallyImmediate;
-                       }
-                       tuple[13] = encoding.encode(Integer.toString(deferrability));
-
-                       tuples.addElement(tuple);
-               }
-
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, tuples, "OK", 1, 0, false);
-       }
-
-       /*
-        * Get a description of the primary key columns that are
-        * referenced by a table's foreign key columns (the primary keys
-        * imported by a table).  They are ordered by PKTABLE_CAT,
-        * PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ.
-        *
-        * <P>Each primary key column description has the following columns:
-        *      <OL>
-        *      <LI><B>PKTABLE_CAT</B> String => primary key table catalog
-        *              being imported (may be null)
-        *      <LI><B>PKTABLE_SCHEM</B> String => primary key table schema
-        *              being imported (may be null)
-        *      <LI><B>PKTABLE_NAME</B> String => primary key table name
-        *              being imported
-        *      <LI><B>PKCOLUMN_NAME</B> String => primary key column name
-        *              being imported
-        *      <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
-        *      <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
-        *      <LI><B>FKTABLE_NAME</B> String => foreign key table name
-        *      <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
-        *      <LI><B>KEY_SEQ</B> short => sequence number within foreign key
-        *      <LI><B>UPDATE_RULE</B> short => What happens to
-        *               foreign key when primary is updated:
-        *              <UL>
-        *              <LI> importedKeyCascade - change imported key to agree
-        *                               with primary key update
-        *              <LI> importedKeyRestrict - do not allow update of primary
-        *                               key if it has been imported
-        *              <LI> importedKeySetNull - change imported key to NULL if
-        *                               its primary key has been updated
-        *              </UL>
-        *      <LI><B>DELETE_RULE</B> short => What happens to
-        *              the foreign key when primary is deleted.
-        *              <UL>
-        *              <LI> importedKeyCascade - delete rows that import a deleted key
-        *              <LI> importedKeyRestrict - do not allow delete of primary
-        *                               key if it has been imported
-        *              <LI> importedKeySetNull - change imported key to NULL if
-        *                               its primary key has been deleted
-        *              </UL>
-        *      <LI><B>FK_NAME</B> String => foreign key name (may be null)
-        *      <LI><B>PK_NAME</B> String => primary key name (may be null)
-        *      </OL>
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog
-        * @param schema a schema name pattern; "" retrieves those
-        * without a schema
-        * @param table a table name
-        * @return ResultSet each row is a primary key column description
-        * @see #getExportedKeys
-        */
-       public java.sql.ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException
-       {
-               return getImportedExportedKeys(null,null,null,catalog, schema, table);
-       }
-
-       /*
-        * Get a description of a foreign key columns that reference a
-        * table's primary key columns (the foreign keys exported by a
-        * table).      They are ordered by FKTABLE_CAT, FKTABLE_SCHEM,
-        * FKTABLE_NAME, and KEY_SEQ.
-        *
-        * This method is currently unimplemented.
-        *
-        * <P>Each foreign key column description has the following columns:
-        *      <OL>
-        *      <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null)
-        *      <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null)
-        *      <LI><B>PKTABLE_NAME</B> String => primary key table name
-        *      <LI><B>PKCOLUMN_NAME</B> String => primary key column name
-        *      <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
-        *              being exported (may be null)
-        *      <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
-        *              being exported (may be null)
-        *      <LI><B>FKTABLE_NAME</B> String => foreign key table name
-        *              being exported
-        *      <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
-        *              being exported
-        *      <LI><B>KEY_SEQ</B> short => sequence number within foreign key
-        *      <LI><B>UPDATE_RULE</B> short => What happens to
-        *               foreign key when primary is updated:
-        *              <UL>
-        *              <LI> importedKeyCascade - change imported key to agree
-        *                               with primary key update
-        *              <LI> importedKeyRestrict - do not allow update of primary
-        *                               key if it has been imported
-        *              <LI> importedKeySetNull - change imported key to NULL if
-        *                               its primary key has been updated
-        *              </UL>
-        *      <LI><B>DELETE_RULE</B> short => What happens to
-        *              the foreign key when primary is deleted.
-        *              <UL>
-        *              <LI> importedKeyCascade - delete rows that import a deleted key
-        *              <LI> importedKeyRestrict - do not allow delete of primary
-        *                               key if it has been imported
-        *              <LI> importedKeySetNull - change imported key to NULL if
-        *                               its primary key has been deleted
-        *              </UL>
-        *      <LI><B>FK_NAME</B> String => foreign key identifier (may be null)
-        *      <LI><B>PK_NAME</B> String => primary key identifier (may be null)
-        *      </OL>
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog
-        * @param schema a schema name pattern; "" retrieves those
-        * without a schema
-        * @param table a table name
-        * @return ResultSet each row is a foreign key column description
-        * @see #getImportedKeys
-        */
-       public java.sql.ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException
-       {
-               return getImportedExportedKeys(catalog, schema, table, null,null,null);
-       }
-
-       /*
-        * Get a description of the foreign key columns in the foreign key
-        * table that reference the primary key columns of the primary key
-        * table (describe how one table imports another's key.) This
-        * should normally return a single foreign key/primary key pair
-        * (most tables only import a foreign key from a table once.)  They
-        * are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and
-        * KEY_SEQ.
-        *
-        * This method is currently unimplemented.
-        *
-        * <P>Each foreign key column description has the following columns:
-        *      <OL>
-        *      <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null)
-        *      <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null)
-        *      <LI><B>PKTABLE_NAME</B> String => primary key table name
-        *      <LI><B>PKCOLUMN_NAME</B> String => primary key column name
-        *      <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
-        *              being exported (may be null)
-        *      <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
-        *              being exported (may be null)
-        *      <LI><B>FKTABLE_NAME</B> String => foreign key table name
-        *              being exported
-        *      <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
-        *              being exported
-        *      <LI><B>KEY_SEQ</B> short => sequence number within foreign key
-        *      <LI><B>UPDATE_RULE</B> short => What happens to
-        *               foreign key when primary is updated:
-        *              <UL>
-        *              <LI> importedKeyCascade - change imported key to agree
-        *                               with primary key update
-        *              <LI> importedKeyRestrict - do not allow update of primary
-        *                               key if it has been imported
-        *              <LI> importedKeySetNull - change imported key to NULL if
-        *                               its primary key has been updated
-        *              </UL>
-        *      <LI><B>DELETE_RULE</B> short => What happens to
-        *              the foreign key when primary is deleted.
-        *              <UL>
-        *              <LI> importedKeyCascade - delete rows that import a deleted key
-        *              <LI> importedKeyRestrict - do not allow delete of primary
-        *                               key if it has been imported
-        *              <LI> importedKeySetNull - change imported key to NULL if
-        *                               its primary key has been deleted
-        *              </UL>
-        *      <LI><B>FK_NAME</B> String => foreign key identifier (may be null)
-        *      <LI><B>PK_NAME</B> String => primary key identifier (may be null)
-        *      </OL>
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog
-        * @param schema a schema name pattern; "" retrieves those
-        * without a schema
-        * @param table a table name
-        * @return ResultSet each row is a foreign key column description
-        * @see #getImportedKeys
-        */
-       public java.sql.ResultSet getCrossReference(String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException
-       {
-               return getImportedExportedKeys(primaryCatalog, primarySchema, primaryTable, foreignCatalog, foreignSchema, foreignTable);
-       }
-
-       /*
-        * Get a description of all the standard SQL types supported by
-        * this database. They are ordered by DATA_TYPE and then by how
-        * closely the data type maps to the corresponding JDBC SQL type.
-        *
-        * <P>Each type description has the following columns:
-        *      <OL>
-        *      <LI><B>TYPE_NAME</B> String => Type name
-        *      <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
-        *      <LI><B>PRECISION</B> int => maximum precision
-        *      <LI><B>LITERAL_PREFIX</B> String => prefix used to quote a literal
-        *              (may be null)
-        *      <LI><B>LITERAL_SUFFIX</B> String => suffix used to quote a literal
-        (may be null)
-        *      <LI><B>CREATE_PARAMS</B> String => parameters used in creating
-        *              the type (may be null)
-        *      <LI><B>NULLABLE</B> short => can you use NULL for this type?
-        *              <UL>
-        *              <LI> typeNoNulls - does not allow NULL values
-        *              <LI> typeNullable - allows NULL values
-        *              <LI> typeNullableUnknown - nullability unknown
-        *              </UL>
-        *      <LI><B>CASE_SENSITIVE</B> boolean=> is it case sensitive?
-        *      <LI><B>SEARCHABLE</B> short => can you use "WHERE" based on this type:
-        *              <UL>
-        *              <LI> typePredNone - No support
-        *              <LI> typePredChar - Only supported with WHERE .. LIKE
-        *              <LI> typePredBasic - Supported except for WHERE .. LIKE
-        *              <LI> typeSearchable - Supported for all WHERE ..
-        *              </UL>
-        *      <LI><B>UNSIGNED_ATTRIBUTE</B> boolean => is it unsigned?
-        *      <LI><B>FIXED_PREC_SCALE</B> boolean => can it be a money value?
-        *      <LI><B>AUTO_INCREMENT</B> boolean => can it be used for an
-        *              auto-increment value?
-        *      <LI><B>LOCAL_TYPE_NAME</B> String => localized version of type name
-        *              (may be null)
-        *      <LI><B>MINIMUM_SCALE</B> short => minimum scale supported
-        *      <LI><B>MAXIMUM_SCALE</B> short => maximum scale supported
-        *      <LI><B>SQL_DATA_TYPE</B> int => unused
-        *      <LI><B>SQL_DATETIME_SUB</B> int => unused
-        *      <LI><B>NUM_PREC_RADIX</B> int => usually 2 or 10
-        *      </OL>
-        *
-        * @return ResultSet each row is a SQL type description
-        */
-       public java.sql.ResultSet getTypeInfo() throws SQLException
-       {
-
-               Field f[] = new Field[18];
-               Vector v = new Vector();                // The new ResultSet tuple stuff
-
-               f[0] = new Field(connection, "TYPE_NAME", iVarcharOid, getMaxNameLength());
-               f[1] = new Field(connection, "DATA_TYPE", iInt2Oid, 2);
-               f[2] = new Field(connection, "PRECISION", iInt4Oid, 4);
-               f[3] = new Field(connection, "LITERAL_PREFIX", iVarcharOid, getMaxNameLength());
-               f[4] = new Field(connection, "LITERAL_SUFFIX", iVarcharOid, getMaxNameLength());
-               f[5] = new Field(connection, "CREATE_PARAMS", iVarcharOid, getMaxNameLength());
-               f[6] = new Field(connection, "NULLABLE", iInt2Oid, 2);
-               f[7] = new Field(connection, "CASE_SENSITIVE", iBoolOid, 1);
-               f[8] = new Field(connection, "SEARCHABLE", iInt2Oid, 2);
-               f[9] = new Field(connection, "UNSIGNED_ATTRIBUTE", iBoolOid, 1);
-               f[10] = new Field(connection, "FIXED_PREC_SCALE", iBoolOid, 1);
-               f[11] = new Field(connection, "AUTO_INCREMENT", iBoolOid, 1);
-               f[12] = new Field(connection, "LOCAL_TYPE_NAME", iVarcharOid, getMaxNameLength());
-               f[13] = new Field(connection, "MINIMUM_SCALE", iInt2Oid, 2);
-               f[14] = new Field(connection, "MAXIMUM_SCALE", iInt2Oid, 2);
-               f[15] = new Field(connection, "SQL_DATA_TYPE", iInt4Oid, 4);
-               f[16] = new Field(connection, "SQL_DATETIME_SUB", iInt4Oid, 4);
-               f[17] = new Field(connection, "NUM_PREC_RADIX", iInt4Oid, 4);
-
-               String sql;
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       sql = "SELECT typname FROM pg_catalog.pg_type";
-               } else {
-                       sql = "SELECT typname FROM pg_type";
-               }
-
-               ResultSet rs = connection.createStatement().executeQuery(sql);
-               // cache some results, this will keep memory useage down, and speed
-               // things up a little.
-               byte b9[] = encoding.encode("9");
-               byte b10[] = encoding.encode("10");
-               byte bf[] = encoding.encode("f");
-               byte bnn[] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.typeNoNulls));
-               byte bts[] = encoding.encode(Integer.toString(java.sql.DatabaseMetaData.typeSearchable));
-
-               while (rs.next())
-               {
-                       byte[][] tuple = new byte[18][];
-                       String typname = rs.getString(1);
-                       tuple[0] = encoding.encode(typname);
-                       tuple[1] = encoding.encode(Integer.toString(connection.getSQLType(typname)));
-                       tuple[2] = b9;  // for now
-                       tuple[6] = bnn; // for now
-                       tuple[7] = bf; // false for now - not case sensitive
-                       tuple[8] = bts;
-                       tuple[9] = bf; // false for now - it's signed
-                       tuple[10] = bf; // false for now - must handle money
-                       tuple[11] = bf; // false for now - handle autoincrement
-                       // 12 - LOCAL_TYPE_NAME is null
-                       // 13 & 14 ?
-                       // 15 & 16 are unused so we return null
-                       tuple[17] = b10; // everything is base 10
-                       v.addElement(tuple);
-               }
-               rs.close();
-
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
-       }
-
-       /*
-        * Get a description of a table's indices and statistics. They are
-        * ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION.
-        *
-        * <P>Each index column description has the following columns:
-        *      <OL>
-        *      <LI><B>TABLE_CAT</B> String => table catalog (may be null)
-        *      <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
-        *      <LI><B>TABLE_NAME</B> String => table name
-        *      <LI><B>NON_UNIQUE</B> boolean => Can index values be non-unique?
-        *              false when TYPE is tableIndexStatistic
-        *      <LI><B>INDEX_QUALIFIER</B> String => index catalog (may be null);
-        *              null when TYPE is tableIndexStatistic
-        *      <LI><B>INDEX_NAME</B> String => index name; null when TYPE is
-        *              tableIndexStatistic
-        *      <LI><B>TYPE</B> short => index type:
-        *              <UL>
-        *              <LI> tableIndexStatistic - this identifies table statistics that are
-        *                       returned in conjuction with a table's index descriptions
-        *              <LI> tableIndexClustered - this is a clustered index
-        *              <LI> tableIndexHashed - this is a hashed index
-        *              <LI> tableIndexOther - this is some other style of index
-        *              </UL>
-        *      <LI><B>ORDINAL_POSITION</B> short => column sequence number
-        *              within index; zero when TYPE is tableIndexStatistic
-        *      <LI><B>COLUMN_NAME</B> String => column name; null when TYPE is
-        *              tableIndexStatistic
-        *      <LI><B>ASC_OR_DESC</B> String => column sort sequence, "A" => ascending
-        *              "D" => descending, may be null if sort sequence is not supported;
-        *              null when TYPE is tableIndexStatistic
-        *      <LI><B>CARDINALITY</B> int => When TYPE is tableIndexStatisic then
-        *              this is the number of rows in the table; otherwise it is the
-        *              number of unique values in the index.
-        *      <LI><B>PAGES</B> int => When TYPE is  tableIndexStatisic then
-        *              this is the number of pages used for the table, otherwise it
-        *              is the number of pages used for the current index.
-        *      <LI><B>FILTER_CONDITION</B> String => Filter condition, if any.
-        *              (may be null)
-        *      </OL>
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog
-        * @param schema a schema name pattern; "" retrieves those without a schema
-        * @param table a table name
-        * @param unique when true, return only indices for unique values;
-        *         when false, return indices regardless of whether unique or not
-        * @param approximate when true, result is allowed to reflect approximate
-        *         or out of data values; when false, results are requested to be
-        *         accurate
-        * @return ResultSet each row is an index column description
-        */
-       // Implementation note: This is required for Borland's JBuilder to work
-       public java.sql.ResultSet getIndexInfo(String catalog, String schema, String tableName, boolean unique, boolean approximate) throws SQLException
-       {
-               String select;
-               String from;
-               String where = "";
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       select = "SELECT NULL AS TABLE_CAT, n.nspname AS TABLE_SCHEM, ";
-                       from = " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class ct, pg_catalog.pg_class ci, pg_catalog.pg_index i, pg_catalog.pg_attribute a, pg_catalog.pg_am am ";
-                       where = " AND n.oid = ct.relnamespace ";
-                       if (schema != null && ! "".equals(schema)) {
-                               where += " AND n.nspname = '"+escapeQuotes(schema)+"' ";
-                       }
-               } else {
-                       select = "SELECT NULL AS TABLE_CAT, NULL AS TABLE_SCHEM, ";
-                       from = " FROM pg_class ct, pg_class ci, pg_index i, pg_attribute a, pg_am am ";
-               }
-
-               String sql = select+
-                       " ct.relname AS TABLE_NAME, NOT i.indisunique AS NON_UNIQUE, NULL AS INDEX_QUALIFIER, ci.relname AS INDEX_NAME, "+
-                       " CASE i.indisclustered "+
-                       " WHEN true THEN "+java.sql.DatabaseMetaData.tableIndexClustered+
-                       " ELSE CASE am.amname "+
-                       "       WHEN 'hash' THEN "+java.sql.DatabaseMetaData.tableIndexHashed+
-                       "       ELSE "+java.sql.DatabaseMetaData.tableIndexOther+
-                       "       END "+
-                       " END AS TYPE, "+
-                       " a.attnum AS ORDINAL_POSITION, "+
-                       " a.attname AS COLUMN_NAME, "+
-                       " NULL AS ASC_OR_DESC, "+
-                       " ci.reltuples AS CARDINALITY, "+
-                       " ci.relpages AS PAGES, "+
-                       " NULL AS FILTER_CONDITION "+
-                       from+
-                       " WHERE ct.oid=i.indrelid AND ci.oid=i.indexrelid AND a.attrelid=ci.oid AND ci.relam=am.oid "+
-                       where+
-                       " AND ct.relname = '"+escapeQuotes(tableName)+"' ";
-
-               if (unique) {
-                       sql += " AND i.indisunique ";
-               }
-               sql += " ORDER BY NON_UNIQUE, TYPE, INDEX_NAME, ORDINAL_POSITION ";
-               return connection.createStatement().executeQuery(sql);
-       }
-
-       /**
-        * Tokenize based on words not on single characters.
-        */
-       private static Vector tokenize(String input, String delimiter) {
-               Vector result = new Vector();
-               int start = 0;
-               int end = input.length();
-               int delimiterSize = delimiter.length();
-
-               while (start < end) {
-                       int delimiterIndex = input.indexOf(delimiter,start);
-                       if (delimiterIndex < 0) {
-                               result.addElement(input.substring(start));
-                               break;
-                       } else {
-                               String token = input.substring(start,delimiterIndex);
-                               result.addElement(token);
-                               start = delimiterIndex + delimiterSize;
-                       }
-               }
-               return result;
-       }
-
-               
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
deleted file mode 100644 (file)
index 42cde40..0000000
+++ /dev/null
@@ -1,1255 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * AbstractJdbc1ResultSet.java
- *     This class defines methods of the jdbc1 specification.  This class is
- *     extended by org.postgresql.jdbc2.AbstractJdbc2ResultSet which adds the
- *     jdbc2 methods.  The real ResultSet class (for jdbc1) is 
- *     org.postgresql.jdbc1.Jdbc1ResultSet
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java,v 1.25 2003/12/12 17:58:34 davec Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.jdbc1;
-
-import java.math.BigDecimal;
-import java.io.*;
-import java.sql.*;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Vector;
-import org.postgresql.Driver;
-import org.postgresql.core.BaseConnection;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-import org.postgresql.core.Encoding;
-import org.postgresql.core.QueryExecutor;
-import org.postgresql.largeobject.*;
-import org.postgresql.util.PGbytea;
-import org.postgresql.util.PGtokenizer;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-public abstract class AbstractJdbc1ResultSet implements BaseResultSet
-{
-
-       protected Vector rows;                  // The results
-       protected BaseStatement statement;
-       protected Field fields[];               // The field descriptions
-       protected String status;                // Status of the result
-       protected boolean binaryCursor = false; // is the data binary or Strings
-       protected int updateCount;              // How many rows did we get back?
-       protected long insertOID;               // The oid of an inserted row
-       protected int current_row;              // Our pointer to where we are at
-       protected byte[][] this_row;            // the current row result
-       protected BaseConnection connection;    // the connection which we returned from
-       protected SQLWarning warnings = null;   // The warning chain
-       protected boolean wasNullFlag = false;  // the flag for wasNull()
-
-       // We can chain multiple resultSets together - this points to
-       // next resultSet in the chain.
-       protected BaseResultSet next = null;
-
-       private StringBuffer sbuf = null;
-       public byte[][] rowBuffer = null;
-
-       private SimpleDateFormat m_tsFormat = null;
-       private SimpleDateFormat m_tstzFormat = null;
-       private SimpleDateFormat m_dateFormat = null;
-
-       private int fetchSize;      // Fetch size for next read (might be 0).
-       private int lastFetchSize;  // Fetch size of last read (might be 0).
-
-       public abstract ResultSetMetaData getMetaData() throws SQLException;
-
-       public AbstractJdbc1ResultSet(BaseStatement statement,
-                                     Field[] fields,
-                                     Vector tuples,
-                                     String status,
-                                     int updateCount,
-                                     long insertOID, 
-                                         boolean binaryCursor)
-       {
-               this.connection = statement.getPGConnection();
-               this.statement = statement;
-               this.fields = fields;
-               this.rows = tuples;
-               this.status = status;
-               this.updateCount = updateCount;
-
-               this.insertOID = insertOID;
-               this.this_row = null;
-               this.current_row = -1;
-               this.binaryCursor = binaryCursor;
-
-               this.lastFetchSize = this.fetchSize = (statement == null ? 0 : statement.getFetchSize());
-       }
-
-    public BaseStatement getPGStatement() {
-               return statement;
-       }
-
-       public StringBuffer getStringBuffer() {
-               return sbuf;
-       }
-
-       //This is implemented in jdbc2
-       public void setStatement(BaseStatement statement) {
-       }
-
-       //method to reinitialize a result set with more data
-       public void reInit (Field[] fields, Vector tuples, String status,
-                         int updateCount, long insertOID, boolean binaryCursor)
-       {
-               this.fields = fields;
-               // on a reinit the size of this indicates how many we pulled
-               // back. If it's 0 then the res set has ended.
-               this.rows = tuples;
-               this.status = status;
-               this.updateCount = updateCount;
-               this.insertOID = insertOID;
-               this.this_row = null;
-               this.current_row = -1;
-               this.binaryCursor = binaryCursor;
-       }
-
-       //
-       // Part of the JDBC2 support, but convenient to implement here.
-       //
-  
-       public void setFetchSize(int rows) throws SQLException
-       {
-               fetchSize = rows;
-       }
-
-
-       public int getFetchSize() throws SQLException
-       {
-               return fetchSize;
-       }
-
-       public boolean next() throws SQLException
-       {
-               if (rows == null)
-                       throw new PSQLException("postgresql.con.closed", PSQLState.CONNECTION_DOES_NOT_EXIST);
-
-               if (++current_row >= rows.size())
-               {
-                       String cursorName = statement.getFetchingCursorName();
-                       if (cursorName == null || lastFetchSize == 0 || rows.size() < lastFetchSize)
-                               return false;  // Not doing a cursor-based fetch or the last fetch was the end of the query
-                       // Use the ref to the statement to get
-                       // the details we need to do another cursor
-                       // query - it will use reinit() to repopulate this
-                       // with the right data.
-                       // NB: We can reach this point with fetchSize == 0 
-                       // if the fetch size is changed halfway through reading results.
-                       // Use "FETCH FORWARD ALL" in that case to complete the query.
-                       String[] sql = new String[] {
-                               fetchSize == 0 ? ("FETCH FORWARD ALL FROM " + cursorName) :
-                               ("FETCH FORWARD " + fetchSize + " FROM " + cursorName)
-                       };
-                       QueryExecutor.execute(sql,
-                                                                 new String[0],
-                                                                 this);
-  
-                       // Test the new rows array.
-                       lastFetchSize = fetchSize;
-                       if (rows.size() == 0)
-                               return false;
-
-                       // Otherwise reset the counter and let it go on...
-                       current_row = 0;
-               }
-
-               this_row = (byte [][])rows.elementAt(current_row);
-
-               rowBuffer = new byte[this_row.length][];
-               System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
-               return true;
-       }
-
-       public void close() throws SQLException
-       {
-               //release resources held (memory for tuples)
-               if (rows != null)
-               {
-                       rows = null;
-               }
-       }
-
-       public boolean wasNull() throws SQLException
-       {
-               return wasNullFlag;
-       }
-
-       public String getString(int columnIndex) throws SQLException
-       {
-               checkResultSet( columnIndex );
-               wasNullFlag = (this_row[columnIndex - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               Encoding encoding = connection.getEncoding();
-               return trimString(columnIndex, encoding.decode(this_row[columnIndex-1]));
-       }
-
-       public boolean getBoolean(int columnIndex) throws SQLException
-       {
-               return toBoolean( getString(columnIndex) );
-       }
-
-
-       public byte getByte(int columnIndex) throws SQLException
-       {
-               String s = getString(columnIndex);
-               
-               if (s != null )
-               {
-                       try
-                       {
-                               switch(fields[columnIndex-1].getSQLType())
-                               {
-                                       case Types.NUMERIC:
-                                       case Types.REAL:
-                                       case Types.DOUBLE:
-                                       case Types.FLOAT:
-                                       case Types.DECIMAL:
-                                               int loc = s.indexOf(".");
-                                               if (loc!=-1 && Integer.parseInt(s.substring(loc+1,s.length()))==0)
-                                               {
-                                                       s = s.substring(0,loc);
-                                               }
-                                               break;
-                                       case Types.CHAR:
-                                               s = s.trim();
-                                               break;
-                               }
-                               if ( s.length() == 0 ) return 0;
-                               return Byte.parseByte(s);
-                       }
-                       catch (NumberFormatException e)
-                       {
-                               throw new PSQLException("postgresql.res.badbyte", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
-                       }
-               }
-               return 0; // SQL NULL
-       }
-
-       public short getShort(int columnIndex) throws SQLException
-       {
-               String s = getFixedString(columnIndex);
-
-               if (s != null)
-               {
-                       try
-                       {
-                               switch(fields[columnIndex-1].getSQLType())
-                               {
-                                       case Types.NUMERIC:
-                                       case Types.REAL:
-                                       case Types.DOUBLE:
-                                       case Types.FLOAT:
-                                       case Types.DECIMAL:
-                                               int loc = s.indexOf(".");
-                                               if (loc!=-1 && Integer.parseInt(s.substring(loc+1,s.length()))==0)
-                                               {
-                                                       s = s.substring(0,loc);
-                                               }
-                                               break;
-                                       case Types.CHAR:
-                                               s = s.trim();
-                                               break;
-                               }
-                               return Short.parseShort(s);
-                       }
-                       catch (NumberFormatException e)
-                       {
-                               throw new PSQLException("postgresql.res.badshort", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
-                       }
-               }
-               return 0; // SQL NULL
-       }
-
-       public int getInt(int columnIndex) throws SQLException
-       {
-               return toInt( getFixedString(columnIndex) );
-       }
-
-       public long getLong(int columnIndex) throws SQLException
-       {
-               return toLong( getFixedString(columnIndex) );
-       }
-
-       public float getFloat(int columnIndex) throws SQLException
-       {
-               return toFloat( getFixedString(columnIndex) );
-       }
-
-       public double getDouble(int columnIndex) throws SQLException
-       {
-               return toDouble( getFixedString(columnIndex) );
-       }
-
-       public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
-       {
-               return toBigDecimal( getFixedString(columnIndex), scale );
-       }
-
-       /*
-        * Get the value of a column in the current row as a Java byte array.
-        *
-        * <p>In normal use, the bytes represent the raw values returned by the
-        * backend. However, if the column is an OID, then it is assumed to
-        * refer to a Large Object, and that object is returned as a byte array.
-        *
-        * <p><b>Be warned</b> If the large object is huge, then you may run out
-        * of memory.
-        *
-        * @param columnIndex the first column is 1, the second is 2, ...
-        * @return the column value; if the value is SQL NULL, the result
-        *      is null
-        * @exception SQLException if a database access error occurs
-        */
-       public byte[] getBytes(int columnIndex) throws SQLException
-       {
-               checkResultSet( columnIndex );
-               wasNullFlag = (this_row[columnIndex - 1] == null);
-               if (!wasNullFlag)
-               {
-                       if (binaryCursor)
-                       {
-                               //If the data is already binary then just return it
-                               return this_row[columnIndex - 1];
-                       }
-                       else if (connection.haveMinimumCompatibleVersion("7.2"))
-                       {
-                               //Version 7.2 supports the bytea datatype for byte arrays
-                               if (fields[columnIndex - 1].getPGType().equals("bytea"))
-                               {
-                                       return trimBytes(columnIndex, PGbytea.toBytes(this_row[columnIndex - 1]));
-                               }
-                               else
-                               {
-                                       return trimBytes(columnIndex, this_row[columnIndex - 1]);
-                               }
-                       }
-                       else
-                       {
-                               //Version 7.1 and earlier supports LargeObjects for byte arrays
-                               // Handle OID's as BLOBS
-                               if ( fields[columnIndex - 1].getOID() == 26)
-                               {
-                                       LargeObjectManager lom = connection.getLargeObjectAPI();
-                                       LargeObject lob = lom.open(getInt(columnIndex));
-                                       byte buf[] = lob.read(lob.size());
-                                       lob.close();
-                                       return trimBytes(columnIndex, buf);
-                               }
-                               else
-                               {
-                                       return trimBytes(columnIndex, this_row[columnIndex - 1]);
-                               }
-                       }
-               }
-               return null;
-       }
-
-       public java.sql.Date getDate(int columnIndex) throws SQLException
-       {
-               return toDate( getString(columnIndex) );
-       }
-
-       public Time getTime(int columnIndex) throws SQLException
-       {
-               return toTime( getString(columnIndex), this, fields[columnIndex - 1].getPGType() );
-       }
-
-       public Timestamp getTimestamp(int columnIndex) throws SQLException
-       {
-               return toTimestamp( getString(columnIndex), this, fields[columnIndex - 1].getPGType() );
-       }
-
-       public InputStream getAsciiStream(int columnIndex) throws SQLException
-       {
-               checkResultSet( columnIndex );
-               wasNullFlag = (this_row[columnIndex - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               if (connection.haveMinimumCompatibleVersion("7.2"))
-               {
-                       //Version 7.2 supports AsciiStream for all the PG text types
-                       //As the spec/javadoc for this method indicate this is to be used for
-                       //large text values (i.e. LONGVARCHAR)  PG doesn't have a separate
-                       //long string datatype, but with toast the text datatype is capable of
-                       //handling very large values.  Thus the implementation ends up calling
-                       //getString() since there is no current way to stream the value from the server
-                       try
-                       {
-                               return new ByteArrayInputStream(getString(columnIndex).getBytes("ASCII"));
-                       }
-                       catch (UnsupportedEncodingException l_uee)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_uee);
-                       }
-               }
-               else
-               {
-                       // In 7.1 Handle as BLOBS so return the LargeObject input stream
-                       return getBinaryStream(columnIndex);
-               }
-       }
-
-       public InputStream getUnicodeStream(int columnIndex) throws SQLException
-       {
-               checkResultSet( columnIndex );
-               wasNullFlag = (this_row[columnIndex - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               if (connection.haveMinimumCompatibleVersion("7.2"))
-               {
-                       //Version 7.2 supports AsciiStream for all the PG text types
-                       //As the spec/javadoc for this method indicate this is to be used for
-                       //large text values (i.e. LONGVARCHAR)  PG doesn't have a separate
-                       //long string datatype, but with toast the text datatype is capable of
-                       //handling very large values.  Thus the implementation ends up calling
-                       //getString() since there is no current way to stream the value from the server
-                       try
-                       {
-                               return new ByteArrayInputStream(getString(columnIndex).getBytes("UTF-8"));
-                       }
-                       catch (UnsupportedEncodingException l_uee)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_uee);
-                       }
-               }
-               else
-               {
-                       // In 7.1 Handle as BLOBS so return the LargeObject input stream
-                       return getBinaryStream(columnIndex);
-               }
-       }
-
-       public InputStream getBinaryStream(int columnIndex) throws SQLException
-       {
-               checkResultSet( columnIndex );
-               wasNullFlag = (this_row[columnIndex - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               if (connection.haveMinimumCompatibleVersion("7.2"))
-               {
-                       //Version 7.2 supports BinaryStream for all PG bytea type
-                       //As the spec/javadoc for this method indicate this is to be used for
-                       //large binary values (i.e. LONGVARBINARY)      PG doesn't have a separate
-                       //long binary datatype, but with toast the bytea datatype is capable of
-                       //handling very large values.  Thus the implementation ends up calling
-                       //getBytes() since there is no current way to stream the value from the server
-                       byte b[] = getBytes(columnIndex);
-                       if (b != null)
-                               return new ByteArrayInputStream(b);
-               }
-               else
-               {
-                       // In 7.1 Handle as BLOBS so return the LargeObject input stream
-                       if ( fields[columnIndex - 1].getOID() == 26)
-                       {
-                               LargeObjectManager lom = connection.getLargeObjectAPI();
-                               LargeObject lob = lom.open(getInt(columnIndex));
-                               return lob.getInputStream();
-                       }
-               }
-               return null;
-       }
-
-       public String getString(String columnName) throws SQLException
-       {
-               return getString(findColumn(columnName));
-       }
-
-       public boolean getBoolean(String columnName) throws SQLException
-       {
-               return getBoolean(findColumn(columnName));
-       }
-
-       public byte getByte(String columnName) throws SQLException
-       {
-
-               return getByte(findColumn(columnName));
-       }
-
-       public short getShort(String columnName) throws SQLException
-       {
-               return getShort(findColumn(columnName));
-       }
-
-       public int getInt(String columnName) throws SQLException
-       {
-               return getInt(findColumn(columnName));
-       }
-
-       public long getLong(String columnName) throws SQLException
-       {
-               return getLong(findColumn(columnName));
-       }
-
-       public float getFloat(String columnName) throws SQLException
-       {
-               return getFloat(findColumn(columnName));
-       }
-
-       public double getDouble(String columnName) throws SQLException
-       {
-               return getDouble(findColumn(columnName));
-       }
-
-       public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException
-       {
-               return getBigDecimal(findColumn(columnName), scale);
-       }
-
-       public byte[] getBytes(String columnName) throws SQLException
-       {
-               return getBytes(findColumn(columnName));
-       }
-
-       public java.sql.Date getDate(String columnName) throws SQLException
-       {
-               return getDate(findColumn(columnName));
-       }
-
-       public Time getTime(String columnName) throws SQLException
-       {
-               return getTime(findColumn(columnName));
-       }
-
-       public Timestamp getTimestamp(String columnName) throws SQLException
-       {
-               return getTimestamp(findColumn(columnName));
-       }
-
-       public InputStream getAsciiStream(String columnName) throws SQLException
-       {
-               return getAsciiStream(findColumn(columnName));
-       }
-
-       public InputStream getUnicodeStream(String columnName) throws SQLException
-       {
-               return getUnicodeStream(findColumn(columnName));
-       }
-
-       public InputStream getBinaryStream(String columnName) throws SQLException
-       {
-               return getBinaryStream(findColumn(columnName));
-       }
-
-       public SQLWarning getWarnings() throws SQLException
-       {
-               return warnings;
-       }
-
-       public void clearWarnings() throws SQLException
-       {
-               warnings = null;
-       }
-
-       public void addWarnings(SQLWarning warnings)
-       {
-               if ( this.warnings != null )
-                       this.warnings.setNextWarning(warnings);
-               else
-                       this.warnings = warnings;
-       }
-
-       public String getCursorName() throws SQLException
-       {
-               return (connection.getCursorName());
-       }
-
-       /*
-        * Get the value of a column in the current row as a Java object
-        *
-        * <p>This method will return the value of the given column as a
-        * Java object.  The type of the Java object will be the default
-        * Java Object type corresponding to the column's SQL type, following
-        * the mapping specified in the JDBC specification.
-        *
-        * <p>This method may also be used to read database specific abstract
-        * data types.
-        *
-        * @param columnIndex the first column is 1, the second is 2...
-        * @return a Object holding the column value
-        * @exception SQLException if a database access error occurs
-        */
-       public Object getObject(int columnIndex) throws SQLException
-       {
-               Field field;
-
-               if (columnIndex < 1 || columnIndex > fields.length)
-                       throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
-               field = fields[columnIndex - 1];
-
-               // some fields can be null, mainly from those returned by MetaData methods
-               if (field == null)
-               {
-                       wasNullFlag = true;
-                       return null;
-               }
-
-               switch (field.getSQLType())
-               {
-                       case Types.BIT:
-                               return getBoolean(columnIndex) ? Boolean.TRUE : Boolean.FALSE;
-                       case Types.SMALLINT:
-                               return new Short(getShort(columnIndex));
-                       case Types.INTEGER:
-                               return new Integer(getInt(columnIndex));
-                       case Types.BIGINT:
-                               return new Long(getLong(columnIndex));
-                       case Types.NUMERIC:
-                               return getBigDecimal
-                                          (columnIndex, (field.getMod() == -1) ? -1 : ((field.getMod() - 4) & 0xffff));
-                       case Types.REAL:
-                               return new Float(getFloat(columnIndex));
-                       case Types.DOUBLE:
-                               return new Double(getDouble(columnIndex));
-                       case Types.CHAR:
-                       case Types.VARCHAR:
-                               return getString(columnIndex);
-                       case Types.DATE:
-                               return getDate(columnIndex);
-                       case Types.TIME:
-                               return getTime(columnIndex);
-                       case Types.TIMESTAMP:
-                               return getTimestamp(columnIndex);
-                       case Types.BINARY:
-                       case Types.VARBINARY:
-                               return getBytes(columnIndex);
-                       default:
-                               String type = field.getPGType();
-
-                               // if the backend doesn't know the type then coerce to String
-                               if (type.equals("unknown"))
-                               {
-                                       return getString(columnIndex);
-                               }
-                                // Specialized support for ref cursors is neater.
-                                else if (type.equals("refcursor"))
-                                {
-                                        String cursorName = getString(columnIndex);
-                                        return statement.createRefCursorResultSet(cursorName);
-                                }
-                               else
-                               {
-                                       return connection.getObject(field.getPGType(), getString(columnIndex));
-                               }
-               }
-       }
-
-       public Object getObject(String columnName) throws SQLException
-       {
-               return getObject(findColumn(columnName));
-       }
-
-       /*
-        * Map a ResultSet column name to a ResultSet column index
-        */
-       public int findColumn(String columnName) throws SQLException
-       {
-               int i;
-
-               final int flen = fields.length;
-               for (i = 0 ; i < flen; ++i)
-                       if (fields[i].getName().equalsIgnoreCase(columnName))
-                               return (i + 1);
-               throw new PSQLException ("postgresql.res.colname", columnName);
-       }
-
-
-       /*
-        * We at times need to know if the resultSet we are working
-        * with is the result of an UPDATE, DELETE or INSERT (in which
-        * case, we only have a row count), or of a SELECT operation
-        * (in which case, we have multiple fields) - this routine
-        * tells us.
-        */
-       public boolean reallyResultSet()
-       {
-               return (fields != null);
-       }
-
-       /*
-        * Since ResultSets can be chained, we need some method of
-        * finding the next one in the chain.  The method getNext()
-        * returns the next one in the chain.
-        *
-        * @return the next ResultSet, or null if there are none
-        */
-       public ResultSet getNext()
-       {
-               return (ResultSet)next;
-       }
-
-       /*
-        * This following method allows us to add a ResultSet object
-        * to the end of the current chain.
-        */
-       public void append(BaseResultSet r)
-       {
-               if (next == null)
-                       next = r;
-               else
-                       next.append(r);
-       }
-
-       /*
-        * If we are just a place holder for results, we still need
-        * to get an updateCount.  This method returns it.
-        */
-       public int getResultCount()
-       {
-               return updateCount;
-       }
-
-       /*
-        * We also need to provide a couple of auxiliary functions for
-        * the implementation of the ResultMetaData functions.  In
-        * particular, we need to know the number of rows and the
-        * number of columns.  Rows are also known as Tuples
-        */
-       public int getTupleCount()
-       {
-               return rows.size();
-       }
-
-       /*
-        * getColumnCount returns the number of columns
-        */
-       public int getColumnCount()
-       {
-               return fields.length;
-       }
-
-       /*
-        * Returns the status message from the backend.<p>
-        * It is used internally by the driver.
-        */
-       public String getStatusString()
-       {
-               return status;
-       }
-
-       /*
-        * returns the OID of a field.<p>
-        * It is used internally by the driver.
-        */
-       public int getColumnOID(int field)
-       {
-               return fields[field -1].getOID();
-       }
-
-       /*
-        * returns the OID of the last inserted row.  Deprecated in 7.2 because
-                       * range for OID values is greater than java signed int.
-        * @deprecated Replaced by getLastOID() in 7.2
-        */
-       public int getInsertedOID()
-       {
-               return (int) getLastOID();
-       }
-
-
-       /*
-        * returns the OID of the last inserted row
-                       * @since 7.2
-        */
-       public long getLastOID()
-       {
-               return insertOID;
-       }
-
-       /*
-        * This is used to fix get*() methods on Money fields. It should only be
-        * used by those methods!
-        *
-        * It converts ($##.##) to -##.## and $##.## to ##.##
-        */
-       public String getFixedString(int col) throws SQLException
-       {
-               String s = getString(col);
-
-               // Handle SQL Null
-               wasNullFlag = (this_row[col - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               // if we don't have at least 2 characters it can't be money.
-               if (s.length() < 2)
-                       return s;
-
-               // Handle Money
-               if (s.charAt(0) == '(')
-               {
-                       s = "-" + PGtokenizer.removePara(s).substring(1);
-               }
-               if (s.charAt(0) == '$')
-               {
-                       s = s.substring(1);
-               }
-               else if (s.charAt(0) == '-' && s.charAt(1) == '$')
-               {
-                       s = "-" + s.substring(2);
-               }
-
-               return s;
-       }
-
-       protected void checkResultSet( int column ) throws SQLException
-       {
-               if ( this_row == null )
-                       throw new PSQLException("postgresql.res.nextrequired");
-               if ( column < 1 || column > fields.length )
-                       throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE );
-       }
-
-       //----------------- Formatting Methods -------------------
-
-       public static boolean toBoolean(String s)
-       {
-               if (s != null)
-               {
-                       s = s.trim();
-
-                       if (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("t"))
-                               return true;
-
-                       try
-                       {
-                               if (Double.valueOf(s).doubleValue()==1)
-                                       return true;
-                       }
-                       catch (NumberFormatException e)
-                       {
-                       }
-               }
-               return false;           // SQL NULL
-       }
-
-       public static int toInt(String s) throws SQLException
-       {
-               if (s != null)
-               {
-                       try
-                       {
-                               s = s.trim();
-                               return Integer.parseInt(s);
-                       }
-                       catch (NumberFormatException e)
-                       {
-                               throw new PSQLException ("postgresql.res.badint", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
-                       }
-               }
-               return 0;               // SQL NULL
-       }
-
-       public static long toLong(String s) throws SQLException
-       {
-               if (s != null)
-               {
-                       try
-                       {
-                               s = s.trim();           
-                               return Long.parseLong(s);
-                       }
-                       catch (NumberFormatException e)
-                       {
-                               throw new PSQLException ("postgresql.res.badlong", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
-                       }
-               }
-               return 0;               // SQL NULL
-       }
-
-       public static BigDecimal toBigDecimal(String s, int scale) throws SQLException
-       {
-               BigDecimal val;
-               if (s != null)
-               {
-                       try
-                       {
-                               s = s.trim();
-                               val = new BigDecimal(s);
-                       }
-                       catch (NumberFormatException e)
-                       {
-                               throw new PSQLException ("postgresql.res.badbigdec", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
-                       }
-                       if (scale == -1)
-                               return val;
-                       try
-                       {
-                               return val.setScale(scale);
-                       }
-                       catch (ArithmeticException e)
-                       {
-                               throw new PSQLException ("postgresql.res.badbigdec", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
-                       }
-               }
-               return null;            // SQL NULL
-       }
-
-       public static float toFloat(String s) throws SQLException
-       {
-               if (s != null)
-               {
-                       try
-                       {
-                               s = s.trim();
-                               return Float.valueOf(s).floatValue();
-                       }
-                       catch (NumberFormatException e)
-                       {
-                               throw new PSQLException ("postgresql.res.badfloat", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
-                       }
-               }
-               return 0;               // SQL NULL
-       }
-
-       public static double toDouble(String s) throws SQLException
-       {
-               if (s != null)
-               {
-                       try
-                       {
-                               s = s.trim();
-                               return Double.valueOf(s).doubleValue();
-                       }
-                       catch (NumberFormatException e)
-                       {
-                               throw new PSQLException ("postgresql.res.baddouble", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
-                       }
-               }
-               return 0;               // SQL NULL
-       }
-
-       public static java.sql.Date toDate(String s) throws SQLException
-       {
-               if (s == null)
-                       return null;
-               // length == 10: SQL Date
-               // length >  10: SQL Timestamp, assumes PGDATESTYLE=ISO
-               try
-               {
-                       s = s.trim();
-                       return java.sql.Date.valueOf((s.length() == 10) ? s : s.substring(0, 10));
-               }
-               catch (NumberFormatException e)
-               {
-                       throw new PSQLException("postgresql.res.baddate",PSQLState.BAD_DATETIME_FORMAT, s);
-               }
-       }
-
-       public static Time toTime(String s, BaseResultSet resultSet, String pgDataType) throws SQLException
-       {
-               if (s == null)
-                       return null; // SQL NULL
-               try
-               {
-                       s = s.trim();
-                       if (s.length() == 8)
-                       {
-                               //value is a time value
-                               return java.sql.Time.valueOf(s);
-                       }
-                       else if (s.indexOf(".") == 8)
-                       {
-                               //value is a time value with fractional seconds
-                               java.sql.Time l_time = java.sql.Time.valueOf(s.substring(0, 8));
-                               String l_strMillis = s.substring(9);
-                               if (l_strMillis.length() > 3)
-                                       l_strMillis = l_strMillis.substring(0, 3);
-                               int l_millis = Integer.parseInt(l_strMillis);
-                               if (l_millis < 10)
-                               {
-                                       l_millis = l_millis * 100;
-                               }
-                               else if (l_millis < 100)
-                               {
-                                       l_millis = l_millis * 10;
-                               }
-                               return new java.sql.Time(l_time.getTime() + l_millis);
-                       }
-                       else
-                       {
-                               //value is a timestamp
-                               return new java.sql.Time(toTimestamp(s, resultSet, pgDataType).getTime());
-                       }
-               }
-               catch (NumberFormatException e)
-               {
-                       throw new PSQLException("postgresql.res.badtime", PSQLState.BAD_DATETIME_FORMAT, s);
-               }
-       }
-
-       /**
-       * Parse a string and return a timestamp representing its value.
-       *
-       * The driver is set to return ISO date formated strings. We modify this
-       * string from the ISO format to a format that Java can understand. Java
-       * expects timezone info as 'GMT+09:00' where as ISO gives '+09'.
-       * Java also expects fractional seconds to 3 places where postgres
-       * will give, none, 2 or 6 depending on the time and postgres version.
-       * From version 7.2 postgres returns fractional seconds to 6 places.
-       *
-       * According to the Timestamp documentation, fractional digits are kept
-       * in the nanos field of Timestamp and not in the milliseconds of Date.
-       * Thus, parsing for fractional digits is entirely separated from the
-       * rest.
-       *
-       * The method assumes that there are no more than 9 fractional
-       * digits given. Undefined behavior if this is not the case.
-       *
-       * @param s                 The ISO formated date string to parse.
-       * @param resultSet The ResultSet this date is part of.
-       *
-       * @return null if s is null or a timestamp of the parsed string s.
-       *
-       * @throws SQLException if there is a problem parsing s.
-       **/
-       public static Timestamp toTimestamp(String s, BaseResultSet resultSet, String pgDataType)
-       throws SQLException
-       {
-               BaseResultSet rs = resultSet;
-               if (s == null)
-                       return null;
-
-               s = s.trim();
-               // We must be synchronized here incase more theads access the ResultSet
-               // bad practice but possible. Anyhow this is to protect sbuf and
-               // SimpleDateFormat objects
-               synchronized (rs)
-               {
-                       StringBuffer l_sbuf = rs.getStringBuffer();
-                       SimpleDateFormat df = null;
-                       if ( Driver.logDebug )
-                               Driver.debug("the data from the DB is " + s);
-
-                       // If first time, create the buffer, otherwise clear it.
-                       if (l_sbuf == null)
-                               l_sbuf = new StringBuffer(32);
-                       else
-                       {
-                               l_sbuf.setLength(0);
-                       }
-
-                       // Copy s into sbuf for parsing.
-                       l_sbuf.append(s);
-                       int slen = s.length();
-
-                       // For a Timestamp, the fractional seconds are stored in the
-                       // nanos field. As a DateFormat is used for parsing which can
-                       // only parse to millisecond precision and which returns a
-                       // Date object, the fractional second parsing is completely
-                       // separate.
-                       int nanos = 0;
-
-                       if (slen > 19)
-                       {
-                               // The len of the ISO string to the second value is 19 chars. If
-                               // greater then 19, there may be tz info and perhaps fractional
-                               // second info which we need to change to java to read it.
-
-                               // cut the copy to second value "2001-12-07 16:29:22"
-                               int i = 19;
-                               l_sbuf.setLength(i);
-
-                               char c = s.charAt(i++);
-                               if (c == '.')
-                               {
-                                       // Found a fractional value.
-                                       final int start = i;
-                                       while (true)
-                                       {
-                                               c = s.charAt(i++);
-                                               if (!Character.isDigit(c))
-                                                       break;
-                                               if (i == slen)
-                                                       {
-                                                               i++;
-                                                               break;
-                                                       }
-                                       }
-
-                                       // The range [start, i - 1) contains all fractional digits.
-                                       final int end = i - 1;
-                                       try
-                                               {
-                                                       nanos = Integer.parseInt(s.substring(start, end));
-                                               }
-                                       catch (NumberFormatException e)
-                                               {
-                                                       throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, e);
-                                               }
-
-                                       // The nanos field stores nanoseconds. Adjust the parsed
-                                       // value to the correct magnitude.
-                                       for (int digitsToNano = 9 - (end - start);
-                                                digitsToNano > 0; --digitsToNano)
-                                               nanos *= 10;
-                               }
-
-                               if (i < slen)
-                               {
-                                       // prepend the GMT part and then add the remaining bit of
-                                       // the string.
-                                       l_sbuf.append(" GMT");
-                                       l_sbuf.append(c);
-                                       l_sbuf.append(s.substring(i, slen));
-
-                                       // Lastly, if the tz part doesn't specify the :MM part then
-                                       // we add ":00" for java.
-                                       if (slen - i < 5)
-                                               l_sbuf.append(":00");
-
-                                       // we'll use this dateformat string to parse the result.
-                                       df = rs.getTimestampTZFormat();
-                               }
-                               else
-                               {
-                                       // Just found fractional seconds but no timezone.
-                                       //If timestamptz then we use GMT, else local timezone
-                                       if (pgDataType.equals("timestamptz"))
-                                       {
-                                               l_sbuf.append(" GMT");
-                                               df = rs.getTimestampTZFormat();
-                                       }
-                                       else
-                                       {
-                                               df = rs.getTimestampFormat();
-                                       }
-                               }
-                       }
-                       else if (slen == 19)
-                       {
-                               // No tz or fractional second info.
-                               //If timestamptz then we use GMT, else local timezone
-                               if (pgDataType.equals("timestamptz"))
-                               {
-                                       l_sbuf.append(" GMT");
-                                       df = rs.getTimestampTZFormat();
-                               }
-                               else
-                               {
-                                       df = rs.getTimestampFormat();
-                               }
-                       }
-                       else
-                       {
-                               if (slen == 8 && s.equals("infinity"))
-                                       //java doesn't have a concept of postgres's infinity
-                                       //so set to an arbitrary future date
-                                       s = "9999-01-01";
-                               if (slen == 9 && s.equals("-infinity"))
-                                       //java doesn't have a concept of postgres's infinity
-                                       //so set to an arbitrary old date
-                                       s = "0001-01-01";
-
-                               // We must just have a date. This case is
-                               // needed if this method is called on a date
-                               // column
-                               df = rs.getDateFormat();
-                       }
-
-                       try
-                       {
-                               // All that's left is to parse the string and return the ts.
-                               if ( Driver.logDebug )
-                                       Driver.debug("the data after parsing is " 
-                     + l_sbuf.toString() + " with " + nanos + " nanos");
-
-                               Timestamp result = new Timestamp(df.parse(l_sbuf.toString()).getTime());
-                               result.setNanos(nanos);
-                               return result;
-                       }
-                       catch (ParseException e)
-                       {
-                               throw new PSQLException("postgresql.res.badtimestamp", PSQLState.BAD_DATETIME_FORMAT, new Integer(e.getErrorOffset()), s);
-                       }
-               }
-       }
-       
-       private boolean isColumnTrimmable(int columnIndex) throws SQLException
-       {
-               switch (fields[columnIndex-1].getSQLType())
-               {
-                       case Types.CHAR:
-                       case Types.VARCHAR:
-                       case Types.LONGVARCHAR:
-                       case Types.BINARY:
-                       case Types.VARBINARY:
-                       case Types.LONGVARBINARY:
-                               return true;
-               }
-               return false;
-       }
-
-       private byte[] trimBytes(int p_columnIndex, byte[] p_bytes) throws SQLException
-       {
-               int l_maxSize = statement.getMaxFieldSize();
-               //we need to trim if maxsize is set and the length is greater than maxsize and the
-               //type of this column is a candidate for trimming
-               if (l_maxSize > 0 && p_bytes.length > l_maxSize && isColumnTrimmable(p_columnIndex))
-               {
-                       byte[] l_bytes = new byte[l_maxSize];
-                       System.arraycopy (p_bytes, 0, l_bytes, 0, l_maxSize);
-                       return l_bytes;
-               }
-               else
-               {
-                       return p_bytes;
-               }
-       }
-
-       private String trimString(int p_columnIndex, String p_string) throws SQLException
-       {
-               int l_maxSize = statement.getMaxFieldSize();
-               //we need to trim if maxsize is set and the length is greater than maxsize and the
-               //type of this column is a candidate for trimming
-               if (l_maxSize > 0 && p_string.length() > l_maxSize && isColumnTrimmable(p_columnIndex))
-               {
-                       return p_string.substring(0,l_maxSize);
-               } 
-               else 
-               {
-                       return p_string;
-               }
-       }
-       
-       public SimpleDateFormat getTimestampTZFormat() {
-               if (m_tstzFormat == null) {
-                       m_tstzFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
-               }
-               return m_tstzFormat;
-       }
-       public SimpleDateFormat getTimestampFormat() {
-               if (m_tsFormat == null) {
-                       m_tsFormat = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
-               }
-               return m_tsFormat;
-       }
-       public SimpleDateFormat getDateFormat() {
-               if (m_dateFormat == null) {
-                       m_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-               }
-               return m_dateFormat;
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java
deleted file mode 100644 (file)
index fc0d5ee..0000000
+++ /dev/null
@@ -1,462 +0,0 @@
-package org.postgresql.jdbc1;
-
-
-import org.postgresql.core.Field;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Vector;
-
-public abstract class AbstractJdbc1ResultSetMetaData
-{
-
-       protected Vector rows;
-       protected Field[] fields;
-
-       /*
-        *      Initialise for a result with a tuple set and
-        *      a field descriptor set
-        *
-        * @param rows the Vector of rows returned by the ResultSet
-        * @param fields the array of field descriptors
-        */
-       public AbstractJdbc1ResultSetMetaData(Vector rows, Field[] fields)
-       {
-               this.rows = rows;
-               this.fields = fields;
-       }
-
-       /*
-        * Whats the number of columns in the ResultSet?
-        *
-        * @return the number
-        * @exception SQLException if a database access error occurs
-        */
-       public int getColumnCount() throws SQLException
-       {
-               return fields.length;
-       }
-
-       /*
-        * Is the column automatically numbered (and thus read-only)
-        * I believe that PostgreSQL does not support this feature.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isAutoIncrement(int column) throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * Does a column's case matter? ASSUMPTION: Any field that is
-        * not obviously case insensitive is assumed to be case sensitive
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isCaseSensitive(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               switch (sql_type)
-               {
-                       case Types.SMALLINT:
-                       case Types.INTEGER:
-                       case Types.FLOAT:
-                       case Types.REAL:
-                       case Types.DOUBLE:
-                       case Types.DATE:
-                       case Types.TIME:
-                       case Types.TIMESTAMP:
-                               return false;
-                       default:
-                               return true;
-               }
-       }
-
-       /*
-        * Can the column be used in a WHERE clause?  Basically for
-        * this, I split the functions into two types: recognised
-        * types (which are always useable), and OTHER types (which
-        * may or may not be useable).  The OTHER types, for now, I
-        * will assume they are useable.  We should really query the
-        * catalog to see if they are useable.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if they can be used in a WHERE clause
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isSearchable(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               // This switch is pointless, I know - but it is a set-up
-               // for further expansion.
-               switch (sql_type)
-               {
-                       case Types.OTHER:
-                               return true;
-                       default:
-                               return true;
-               }
-       }
-
-       /*
-        * Is the column a cash value?  6.1 introduced the cash/money
-        * type, which haven't been incorporated as of 970414, so I
-        * just check the type name for both 'cash' and 'money'
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if its a cash column
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isCurrency(int column) throws SQLException
-       {
-               String type_name = getField(column).getPGType();
-
-               return type_name.equals("cash") || type_name.equals("money");
-       }
-
-       /*
-        * Indicates the nullability of values in the designated column.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return one of the columnNullable values
-        * @exception SQLException if a database access error occurs
-        */
-       public int isNullable(int column) throws SQLException
-       {
-               /*
-                * TODO This needs a real implementation, taking into account columns
-                * defined with NOT NULL or PRIMARY KEY, CHECK constraints, views,
-                * functions etc.
-                */
-               return java.sql.ResultSetMetaData.columnNullableUnknown;
-       }
-
-       /*
-        * Is the column a signed number? In PostgreSQL, all numbers
-        * are signed, so this is trivial.      However, strings are not
-        * signed (duh!)
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isSigned(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               switch (sql_type)
-               {
-                       case Types.SMALLINT:
-                       case Types.INTEGER:
-                       case Types.FLOAT:
-                       case Types.REAL:
-                       case Types.DOUBLE:
-                               return true;
-                       case Types.DATE:
-                       case Types.TIME:
-                       case Types.TIMESTAMP:
-                               return false;   // I don't know about these?
-                       default:
-                               return false;
-               }
-       }
-
-       /*
-        * What is the column's normal maximum width in characters?
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the maximum width
-        * @exception SQLException if a database access error occurs
-        */
-       public int getColumnDisplaySize(int column) throws SQLException
-       {
-               Field f = getField(column);
-               String type_name = f.getPGType();
-               int typmod = f.getMod();
-
-               // I looked at other JDBC implementations and couldn't find a consistent
-               // interpretation of the "display size" for numeric values, so this is our's
-               // FIXME: currently, only types with a SQL92 or SQL3 pendant are implemented - jens@jens.de
-
-               // fixed length data types
-               if (type_name.equals( "int2" ))
-                       return 6;  // -32768 to +32768 (5 digits and a sign)
-               if (type_name.equals( "int4" )
-                               || type_name.equals( "oid" ))
-                       return 11; // -2147483648 to +2147483647
-               if (type_name.equals( "int8" ))
-                       return 20; // -9223372036854775808 to +9223372036854775807
-               if (type_name.equals( "money" ))
-                       return 12; // MONEY = DECIMAL(9,2)
-               if (type_name.equals( "float4" ))
-                       return 11; // i checked it out ans wasn't able to produce more than 11 digits
-               if (type_name.equals( "float8" ))
-                       return 20; // dito, 20
-               if (type_name.equals( "char" ))
-                       return 1;
-               if (type_name.equals( "bool" ))
-                       return 1;
-               if (type_name.equals( "date" ))
-                       return 14; // "01/01/4713 BC" - "31/12/32767 AD"
-               if (type_name.equals( "time" ))
-                       return 8;  // 00:00:00-23:59:59
-               if (type_name.equals( "timestamp" ))
-                       return 22; // hhmmm ... the output looks like this: 1999-08-03 22:22:08+02
-
-               // variable length fields
-               typmod -= 4;
-               if (type_name.equals( "bpchar" )
-                               || type_name.equals( "varchar" ))
-                       return typmod; // VARHDRSZ=sizeof(int32)=4
-               if (type_name.equals( "numeric" ))
-                       return ( (typmod >> 16) & 0xffff )
-                                  + 1 + ( typmod & 0xffff ); // DECIMAL(p,s) = (p digits).(s digits)
-
-               // if we don't know better
-               return f.getLength();
-       }
-
-       /*
-        * What is the suggested column title for use in printouts and
-        * displays?  We suggest the ColumnName!
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the column label
-        * @exception SQLException if a database access error occurs
-        */
-       public String getColumnLabel(int column) throws SQLException
-       {
-               return getColumnName(column);
-       }
-
-       /*
-        * What's a column's name?
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the column name
-        * @exception SQLException if a database access error occurs
-        */
-       public String getColumnName(int column) throws SQLException
-       {
-               Field f = getField(column);
-               if (f != null)
-                       return f.getName();
-               return "field" + column;
-       }
-
-       /*
-        * What is a column's table's schema?  This relies on us knowing
-        * the table name....which I don't know how to do as yet.  The 
-        * JDBC specification allows us to return "" if this is not
-        * applicable.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return the Schema
-        * @exception SQLException if a database access error occurs
-        */
-       public String getSchemaName(int column) throws SQLException
-       {
-               return "";
-       }
-
-       /*
-        * What is a column's number of decimal digits.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return the precision
-        * @exception SQLException if a database access error occurs
-        */
-       public int getPrecision(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               switch (sql_type)
-               {
-                       case Types.SMALLINT:
-                               return 5;
-                       case Types.INTEGER:
-                               return 10;
-                       case Types.REAL:
-                               return 8;
-                       case Types.FLOAT:
-                               return 16;
-                       case Types.DOUBLE:
-                               return 16;
-                       case Types.VARCHAR:
-                               return 0;
-                       case Types.NUMERIC:
-                               Field f = getField(column);
-                               if (f != null)
-                                       return ((0xFFFF0000)&f.getMod()) >> 16;
-                               else
-                                       return 0;
-                       default:
-                               return 0;
-               }
-       }
-
-       /*
-        * What is a column's number of digits to the right of the
-        * decimal point?
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return the scale
-        * @exception SQLException if a database access error occurs
-        */
-       public int getScale(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               switch (sql_type)
-               {
-                       case Types.SMALLINT:
-                               return 0;
-                       case Types.INTEGER:
-                               return 0;
-                       case Types.REAL:
-                               return 8;
-                       case Types.FLOAT:
-                               return 16;
-                       case Types.DOUBLE:
-                               return 16;
-                       case Types.VARCHAR:
-                               return 0;
-                       case Types.NUMERIC:
-                               Field f = getField(column);
-                               if (f != null)
-                                       return (((0x0000FFFF)&f.getMod()) - 4);
-                               else
-                                       return 0;
-                       default:
-                               return 0;
-               }
-       }
-
-       /*
-        * Whats a column's table's name?  How do I find this out?      Both
-        * getSchemaName() and getCatalogName() rely on knowing the table
-        * Name, so we need this before we can work on them.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return column name, or "" if not applicable
-        * @exception SQLException if a database access error occurs
-        */
-       public String getTableName(int column) throws SQLException
-       {
-               return "";
-       }
-
-       /*
-        * What's a column's table's catalog name?  As with getSchemaName(),
-        * we can say that if getTableName() returns n/a, then we can too -
-        * otherwise, we need to work on it.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return catalog name, or "" if not applicable
-        * @exception SQLException if a database access error occurs
-        */
-       public String getCatalogName(int column) throws SQLException
-       {
-               return "";
-       }
-
-       /*
-        * What is a column's SQL Type? (java.sql.Type int)
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the java.sql.Type value
-        * @exception SQLException if a database access error occurs
-        * @see org.postgresql.Field#getSQLType
-        * @see java.sql.Types
-        */
-       public int getColumnType(int column) throws SQLException
-       {
-               return getField(column).getSQLType();
-       }
-
-       /*
-        * Whats is the column's data source specific type name?
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the type name
-        * @exception SQLException if a database access error occurs
-        */
-       public String getColumnTypeName(int column) throws SQLException
-       {
-               return getField(column).getPGType();
-       }
-
-       /*
-        * Is the column definitely not writable?  In reality, we would
-        * have to check the GRANT/REVOKE stuff for this to be effective,
-        * and I haven't really looked into that yet, so this will get
-        * re-visited.
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isReadOnly(int column) throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * Is it possible for a write on the column to succeed?  Again, we
-        * would in reality have to check the GRANT/REVOKE stuff, which
-        * I haven't worked with as yet.  However, if it isn't ReadOnly, then
-        * it is obviously writable.
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isWritable(int column) throws SQLException
-       {
-               return !isReadOnly(column);
-       }
-
-       /*
-        * Will a write on this column definately succeed?      Hmmm...this
-        * is a bad one, since the two preceding functions have not been
-        * really defined.      I cannot tell is the short answer.      I thus
-        * return isWritable() just to give us an idea.
-        *
-        * @param column the first column is 1, the second is 2, etc..
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isDefinitelyWritable(int column) throws SQLException
-       {
-               return false;
-       }
-
-       // ********************************************************
-       //      END OF PUBLIC INTERFACE
-       // ********************************************************
-
-       /*
-        * For several routines in this package, we need to convert
-        * a columnIndex into a Field[] descriptor.  Rather than do
-        * the same code several times, here it is.
-        *
-        * @param columnIndex the first column is 1, the second is 2...
-        * @return the Field description
-        * @exception SQLException if a database access error occurs
-        */
-       private Field getField(int columnIndex) throws SQLException
-       {
-               if (columnIndex < 1 || columnIndex > fields.length)
-                       throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
-               return fields[columnIndex - 1];
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
deleted file mode 100644 (file)
index c8644f4..0000000
+++ /dev/null
@@ -1,2309 +0,0 @@
-package org.postgresql.jdbc1;
-
-import org.postgresql.core.BaseConnection;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-import org.postgresql.core.QueryExecutor;
-import org.postgresql.largeobject.LargeObject;
-import org.postgresql.largeobject.LargeObjectManager;
-import org.postgresql.util.PGbytea;
-import org.postgresql.util.PGobject;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.sql.CallableStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.Vector;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v 1.44 2003/12/12 18:36:19 davec Exp $
- * This class defines methods of the jdbc1 specification.  This class is
- * extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
- * methods.  The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
- */
-public abstract class AbstractJdbc1Statement implements BaseStatement
-{
-        // The connection who created us
-       protected BaseConnection connection;
-
-       /** The warnings chain. */
-       protected SQLWarning warnings = null;
-
-       /** Maximum number of rows to return, 0 = unlimited */
-       protected int maxrows = 0;
-
-       /** Number of rows to get in a batch. */
-       protected int fetchSize = 0;
-
-       /** Timeout (in seconds) for a query (not used) */
-       protected int timeout = 0;
-
-       protected boolean replaceProcessingEnabled = true;
-
-       /** The current results */
-       protected BaseResultSet result = null;
-
-       // Static variables for parsing SQL when replaceProcessing is true.
-       private static final short IN_SQLCODE = 0;
-       private static final short IN_STRING = 1;
-       private static final short BACKSLASH = 2;
-       private static final short ESC_TIMEDATE = 3;
-
-       // Some performance caches
-       private StringBuffer sbuf = new StringBuffer(32);
-
-       protected String[] m_sqlFragments;              // Query fragments.
-       private String[] m_executeSqlFragments;         // EXECUTE(...) if useServerPrepare
-       protected Object[] m_binds = new Object[0];     // Parameter values
-       
-       protected String[] m_bindTypes = new String[0]; // Parameter types, for PREPARE(...)
-       protected String m_statementName = null;        // Allocated PREPARE statement name for server-prepared statements
-       protected String m_cursorName = null;           // Allocated DECLARE cursor name for cursor-based fetch
-       // Constants for allowXXX and m_isSingleStatement vars, below.
-       // The idea is to defer the cost of examining the query until we really need to know,
-       // but don't reexamine it every time thereafter.
-       private static final short UNKNOWN = 0;      // Don't know yet, examine the query.
-       private static final short NO = 1;           // Don't use feature
-       private static final short YES = 2;          // Do use feature
-       
-       private short m_isSingleDML = UNKNOWN;         // Is the query a single SELECT/UPDATE/INSERT/DELETE?
-       private short m_isSingleSelect = UNKNOWN;      // Is the query a single SELECT?
-       private short m_isSingleStatement = UNKNOWN;   // Is the query a single statement?
-
-       private boolean m_useServerPrepare = false;
-
-    // m_preparedCount is used for naming of auto-cursors and must
-    // be synchronized so that multiple threads using the same
-    // connection don't stomp over each others cursors.
-       private static int m_preparedCount = 1;
-    private synchronized static int next_preparedCount()
-    {
-        return m_preparedCount++;
-    }
-
-       //Used by the callablestatement style methods
-       private static final String JDBC_SYNTAX = "{[? =] call <some_function> ([? [,?]*]) }";
-       private static final String RESULT_ALIAS = "result";
-       private String originalSql = "";
-       private boolean isFunction;
-       // functionReturnType contains the user supplied value to check
-       // testReturn contains a modified version to make it easier to
-       // check the getXXX methods..
-       private int functionReturnType;
-       private int testReturn;
-       // returnTypeSet is true when a proper call to registerOutParameter has been made
-       private boolean returnTypeSet;
-       protected Object callResult;
-       protected int maxfieldSize = 0;
-
-       public abstract BaseResultSet createResultSet(Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException;
-
-       public AbstractJdbc1Statement (BaseConnection connection)
-       {
-               this.connection = connection;
-       }
-
-       public AbstractJdbc1Statement (BaseConnection connection, String p_sql) throws SQLException
-       {
-               this.connection = connection;
-               parseSqlStmt(p_sql);  // this allows Callable stmt to override
-       }
-
-       public BaseConnection getPGConnection() {
-               return connection;
-       }
-
-       public String getFetchingCursorName() {
-               return m_cursorName;
-       }
-
-       public int getFetchSize() {
-               return fetchSize;
-       }
-
-       protected void parseSqlStmt (String p_sql) throws SQLException
-       {
-               String l_sql = p_sql;
-
-               l_sql = replaceProcessing(l_sql);
-
-               if (this instanceof CallableStatement)
-               {
-                       l_sql = modifyJdbcCall(l_sql);
-               }
-
-               Vector v = new Vector();
-               boolean inQuotes = false;
-               int lastParmEnd = 0, i;
-
-               m_isSingleSelect = m_isSingleDML = UNKNOWN;
-               m_isSingleStatement = YES;
-
-               for (i = 0; i < l_sql.length(); ++i)
-               {
-                       int c = l_sql.charAt(i);
-
-                       if (c == '\'')
-                               inQuotes = !inQuotes;
-                       if (c == '?' && !inQuotes)
-                       {
-                               v.addElement(l_sql.substring (lastParmEnd, i));
-                               lastParmEnd = i + 1;
-                       }
-                       if (c == ';' && !inQuotes)
-                               m_isSingleStatement = m_isSingleSelect = m_isSingleDML = NO;
-               }
-               v.addElement(l_sql.substring (lastParmEnd, l_sql.length()));
-
-               m_sqlFragments = new String[v.size()];
-               m_binds = new Object[v.size() - 1];
-               m_bindTypes = new String[v.size() - 1];
-
-               for (i = 0 ; i < m_sqlFragments.length; ++i)
-                       m_sqlFragments[i] = (String)v.elementAt(i);
-
-       }
-
-       /*
-        * Deallocate resources allocated for the current query
-        * in preparation for replacing it with a new query.
-        */
-       private void deallocateQuery()
-       {               
-               //If we have already created a server prepared statement, we need
-               //to deallocate the existing one
-               if (m_statementName != null)
-               {
-                       try
-                       {
-                               connection.execSQL("DEALLOCATE " + m_statementName);
-                       }
-                       catch (Exception e)
-                       {
-                       }
-               }
-
-               m_statementName = null;
-               m_cursorName = null; // automatically closed at end of txn anyway
-               m_executeSqlFragments = null;
-               m_isSingleStatement = m_isSingleSelect = m_isSingleDML = UNKNOWN;
-       }
-  
-       /*
-        * Execute a SQL statement that retruns a single ResultSet
-        *
-        * @param sql typically a static SQL SELECT statement
-        * @return a ResulSet that contains the data produced by the query
-        * @exception SQLException if a database access error occurs
-        */
-       public java.sql.ResultSet executeQuery(String p_sql) throws SQLException
-       {
-               deallocateQuery();
-
-               String l_sql = replaceProcessing(p_sql);
-               m_sqlFragments = new String[] {l_sql};
-               m_binds = new Object[0];
-
-               return executeQuery();
-       }
-
-       /*
-        * A Prepared SQL query is executed and its ResultSet is returned
-        *
-        * @return a ResultSet that contains the data produced by the
-        *               *      query - never null
-        * @exception SQLException if a database access error occurs
-        */
-       public java.sql.ResultSet executeQuery() throws SQLException
-       {
-                this.execute();
-
-               while (result != null && !result.reallyResultSet())
-                       result = (BaseResultSet) result.getNext();
-               if (result == null)
-                       throw new PSQLException("postgresql.stat.noresult", PSQLState.NO_DATA);
-               return (ResultSet) result;
-       }
-
-       /*
-        * Execute a SQL INSERT, UPDATE or DELETE statement.  In addition
-        * SQL statements that return nothing such as SQL DDL statements
-        * can be executed
-        *
-        * @param sql a SQL statement
-        * @return either a row count, or 0 for SQL commands
-        * @exception SQLException if a database access error occurs
-        */
-       public int executeUpdate(String p_sql) throws SQLException
-       {
-               deallocateQuery();
-
-               String l_sql = replaceProcessing(p_sql);
-               m_sqlFragments = new String[] {l_sql};
-               m_binds = new Object[0];
-
-               return executeUpdate();
-       }
-
-       /*
-        * Execute a SQL INSERT, UPDATE or DELETE statement.  In addition,
-        * SQL statements that return nothing such as SQL DDL statements can
-        * be executed.
-        *
-        * @return either the row count for INSERT, UPDATE or DELETE; or
-        *               *      0 for SQL statements that return nothing.
-        * @exception SQLException if a database access error occurs
-        */
-       public int executeUpdate() throws SQLException
-       {
-               this.execute();
-               if (result.reallyResultSet())
-                       throw new PSQLException("postgresql.stat.result");
-               return this.getUpdateCount();
-       }
-
-       /*
-        * Execute a SQL statement that may return multiple results. We
-        * don't have to worry about this since we do not support multiple
-        * ResultSets.   You can use getResultSet or getUpdateCount to
-        * retrieve the result.
-        *
-        * @param sql any SQL statement
-        * @return true if the next result is a ResulSet, false if it is
-        *      an update count or there are no more results
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean execute(String p_sql) throws SQLException
-       {
-               deallocateQuery();
-
-               String l_sql = replaceProcessing(p_sql);
-               m_sqlFragments = new String[] {l_sql};
-               m_binds = new Object[0];
-
-               return execute();
-       }
-
-       /*
-        * Check if the current query is a single statement.
-        */
-       private boolean isSingleStatement()
-       {
-               if (m_isSingleStatement != UNKNOWN)
-                       return m_isSingleStatement == YES;
-               
-               // Crude detection of multiple statements. This could be
-               // improved by parsing the whole query for quotes, but is
-               // it worth it given that the only queries that get here are
-               // unparameterized queries?
-               
-               for (int i = 0; i < m_sqlFragments.length; ++i) { // a bit redundant, but ..
-                       if (m_sqlFragments[i].indexOf(';') != -1) {
-                               m_isSingleStatement = NO;
-                               return false;
-                       }
-               }
-               
-               m_isSingleStatement = YES;
-               return true;
-       }
-
-       /*
-        * Helper for isSingleSelect() and isSingleDML(): computes values
-        * of m_isSingleDML and m_isSingleSelect.
-        */
-       private void analyzeStatementType()
-       {
-               if (!isSingleStatement()) {
-                       m_isSingleSelect = m_isSingleDML = NO;
-                       return;
-               }
-               
-               String compare = m_sqlFragments[0].trim().toLowerCase();
-               if (compare.startsWith("select")) {
-                       m_isSingleSelect = m_isSingleDML = YES;
-                       return;
-               }
-
-               m_isSingleSelect = NO;
-
-               if (!compare.startsWith("update") &&
-                       !compare.startsWith("delete") &&
-                       !compare.startsWith("insert")) {
-                       m_isSingleDML = NO;
-                       return;
-               }
-               
-               m_isSingleDML = YES;
-       }
-
-       /*
-        * Check if the current query is a single SELECT.
-        */
-       private boolean isSingleSelect()
-       {
-               if (m_isSingleSelect == UNKNOWN)
-                       analyzeStatementType();
-
-               return m_isSingleSelect == YES;
-       }
-
-       /*
-        * Check if the current query is a single SELECT/UPDATE/INSERT/DELETE.
-        */
-       private boolean isSingleDML()
-       {
-               if (m_isSingleDML == UNKNOWN)
-                       analyzeStatementType();
-
-               return m_isSingleDML == YES;
-       }
-
-       /*
-        * Return the query fragments to use for a server-prepared statement.
-        * The first query executed will include a PREPARE and EXECUTE;
-        * subsequent queries will just be an EXECUTE.
-        */
-       private String[] transformToServerPrepare() {
-               if (m_statementName != null)
-                       return m_executeSqlFragments;
-               
-               // First time through.
-               m_statementName = "JDBC_STATEMENT_" + m_preparedCount++;
-               
-               // Set up m_executeSqlFragments
-               m_executeSqlFragments = new String[m_sqlFragments.length];
-               m_executeSqlFragments[0] = "EXECUTE " + m_statementName;                                
-               if (m_sqlFragments.length > 1) {
-                       m_executeSqlFragments[0] += "(";
-                       for (int i = 1; i < m_bindTypes.length; i++)
-                               m_executeSqlFragments[i] = ", ";
-                       m_executeSqlFragments[m_bindTypes.length] = ")";
-               }
-               
-               // Set up the PREPARE.
-               String[] prepareSqlFragments = new String[m_sqlFragments.length];
-               System.arraycopy(m_sqlFragments, 0, prepareSqlFragments, 0, m_sqlFragments.length);
-               
-               synchronized (sbuf) {
-                       sbuf.setLength(0);
-                       sbuf.append("PREPARE ");
-                       sbuf.append(m_statementName);
-                       if (m_sqlFragments.length > 1) {
-                               sbuf.append("(");
-                               for (int i = 0; i < m_bindTypes.length; i++) {
-                                       if (i != 0) sbuf.append(", ");
-                                       sbuf.append(m_bindTypes[i]);                                                    
-                               }
-                               sbuf.append(")");
-                       }
-                       sbuf.append(" AS ");
-                       sbuf.append(m_sqlFragments[0]);
-                       for (int i = 1; i < m_sqlFragments.length; i++) {
-                               sbuf.append(" $");
-                               sbuf.append(i);
-                               sbuf.append(" ");
-                               sbuf.append(m_sqlFragments[i]);
-                       }
-                       sbuf.append("; ");
-                       sbuf.append(m_executeSqlFragments[0]);
-                       
-                       prepareSqlFragments[0] = sbuf.toString();
-               }
-               
-               System.arraycopy(m_executeSqlFragments, 1, prepareSqlFragments, 1, prepareSqlFragments.length - 1);
-               return prepareSqlFragments;
-       }
-       
-       /*
-        * Return the current query transformed into a cursor-based statement.
-        * This uses a new cursor on each query.
-        */
-       private String[] transformToCursorFetch() 
-       {
-               
-               // Pinch the prepared count for our own nefarious purposes.
-               m_cursorName = "JDBC_CURS_" + m_preparedCount++;
-               
-               // Create a cursor declaration and initial fetch statement from the original query.
-               int len = m_sqlFragments.length;
-               String[] cursorBasedSql = new String[len];
-               System.arraycopy(m_sqlFragments, 0, cursorBasedSql, 0, len);
-               cursorBasedSql[0] = "DECLARE " + m_cursorName + " CURSOR FOR " + cursorBasedSql[0];
-               cursorBasedSql[len-1] += "; FETCH FORWARD " + fetchSize + " FROM " + m_cursorName;
-               
-               // Make the cursor based query the one that will be used.
-               if (org.postgresql.Driver.logDebug)
-                       org.postgresql.Driver.debug("using cursor based sql with cursor name " + m_cursorName);
-               
-               return cursorBasedSql;
-       }
-
-       /**
-        * Do transformations to a query for server-side prepare or setFetchSize() cursor
-        * work.
-        * @return the query fragments to execute
-        */
-       private String[] getQueryFragments()
-       {
-               // nb: isSingleXXX() are relatively expensive, avoid calling them unless we must.
-               
-               // We check the "mutable" bits of these conditions (which may change without
-               // a new query being created) here; isSingleXXX() only concern themselves with
-               // the query structure itself.
-
-               // We prefer cursor-based-fetch over server-side-prepare here.          
-               // Eventually a v3 implementation should let us do both at once.
-               if (fetchSize > 0 && !connection.getAutoCommit() && isSingleSelect())
-                       return transformToCursorFetch();
-
-               if (isUseServerPrepare() && isSingleDML())
-                       return transformToServerPrepare();
-               
-               // Not server-prepare or cursor-fetch, just return a plain query.
-               return m_sqlFragments;
-       }                                       
-       
-       /*
-        * Some prepared statements return multiple results; the execute method
-        * handles these complex statements as well as the simpler form of
-        * statements handled by executeQuery and executeUpdate
-        *
-        * @return true if the next result is a ResultSet; false if it is an
-        *               update count or there are no more results
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean execute() throws SQLException
-       {
-               if (isFunction && !returnTypeSet)
-                       throw new PSQLException("postgresql.call.noreturntype", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
-               if (isFunction)
-               { // set entry 1 to dummy entry..
-                       m_binds[0] = ""; // dummy entry which ensured that no one overrode
-                       m_bindTypes[0] = PG_TEXT;
-                       // and calls to setXXX (2,..) really went to first arg in a function call..
-               }
-
-               // New in 7.1, if we have a previous resultset then force it to close
-               // This brings us nearer to compliance, and helps memory management.
-               // Internal stuff will call ExecSQL directly, bypassing this.
-
-               if (result != null)
-               {
-                       java.sql.ResultSet rs = getResultSet();
-                       if (rs != null)
-                               rs.close();
-               }
-
-               // Get the actual query fragments to run (might be a transformed version of
-               // the original fragments)
-               String[] fragments = getQueryFragments();
-
-               // New in 7.1, pass Statement so that ExecSQL can customise to it                
-               result = QueryExecutor.execute(fragments,
-                                                                          m_binds,
-                                                                          this);
-
-               //If we are executing a callable statement function set the return data
-               if (isFunction)
-               {
-                       if (!result.reallyResultSet())
-                               throw new PSQLException("postgresql.call.noreturnval", PSQLState.NO_DATA);
-                       if (!result.next ())
-                               throw new PSQLException ("postgresql.call.noreturnval", PSQLState.NO_DATA);
-                       callResult = result.getObject(1);
-                       int columnType = result.getMetaData().getColumnType(1);
-                       if (columnType != functionReturnType)
-                               throw new PSQLException ("postgresql.call.wrongrtntype", PSQLState.DATA_TYPE_MISMATCH,
-                                                                                new Object[]{
-                                                                                        "java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType });
-                       result.close ();
-                       return true;
-               }
-               else
-               {
-                       return (result != null && result.reallyResultSet());
-               }
-       }
-       
-       /*
-        * setCursorName defines the SQL cursor name that will be used by
-        * subsequent execute methods.  This name can then be used in SQL
-        * positioned update/delete statements to identify the current row
-        * in the ResultSet generated by this statement.  If a database
-        * doesn't support positioned update/delete, this method is a
-        * no-op.
-        *
-        * <p><B>Note:</B> By definition, positioned update/delete execution
-        * must be done by a different Statement than the one which
-        * generated the ResultSet being used for positioning.  Also, cursor
-        * names must be unique within a Connection.
-        *
-        * <p>We throw an additional constriction.      There can only be one
-        * cursor active at any one time.
-        *
-        * @param name the new cursor name
-        * @exception SQLException if a database access error occurs
-        */
-       public void setCursorName(String name) throws SQLException
-       {
-               connection.setCursorName(name);
-       }
-
-
-       /*
-        * getUpdateCount returns the current result as an update count,
-        * if the result is a ResultSet or there are no more results, -1
-        * is returned.  It should only be called once per result.
-        *
-        * @return the current result as an update count.
-        * @exception SQLException if a database access error occurs
-        */
-       public int getUpdateCount() throws SQLException
-       {
-               if (result == null)
-                       return -1;
-               if (isFunction)
-                       return 1;
-               if (result.reallyResultSet())
-                       return -1;
-               return result.getResultCount();
-       }
-
-       /*
-        * getMoreResults moves to a Statement's next result.  If it returns
-        * true, this result is a ResulSet.
-        *
-        * @return true if the next ResultSet is valid
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean getMoreResults() throws SQLException
-       {
-               result = (BaseResultSet) result.getNext();
-               return (result != null && result.reallyResultSet());
-       }
-
-
-
-       /*
-        * Returns the status message from the current Result.<p>
-        * This is used internally by the driver.
-        *
-        * @return status message from backend
-        */
-       public String getResultStatusString()
-       {
-               if (result == null)
-                       return null;
-               return result.getStatusString();
-       }
-
-       /*
-        * 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.
-        *
-        * @return the current maximum row limit; zero means unlimited
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxRows() throws SQLException
-       {
-               return maxrows;
-       }
-
-       /*
-        * Set the maximum number of rows
-        *
-        * @param max the new max rows limit; zero means unlimited
-        * @exception SQLException if a database access error occurs
-        * @see getMaxRows
-        */
-       public void setMaxRows(int max) throws SQLException
-       {
-               if (max<0) throw new PSQLException("postgresql.input.rows.gt0");
-               maxrows = max;
-       }
-
-       /*
-        * If escape scanning is on (the default), the driver will do escape
-        * substitution before sending the SQL to the database.
-        *
-        * @param enable true to enable; false to disable
-        * @exception SQLException if a database access error occurs
-        */
-       public void setEscapeProcessing(boolean enable) throws SQLException
-       {
-               replaceProcessingEnabled = enable;
-       }
-
-       /*
-        * The queryTimeout limit is the number of seconds the driver
-        * will wait for a Statement to execute.  If the limit is
-        * exceeded, a SQLException is thrown.
-        *
-        * @return the current query timeout limit in seconds; 0 = unlimited
-        * @exception SQLException if a database access error occurs
-        */
-       public int getQueryTimeout() throws SQLException
-       {
-               return timeout;
-       }
-
-       /*
-        * Sets the queryTimeout limit
-        *
-        * @param seconds - the new query timeout limit in seconds
-        * @exception SQLException if a database access error occurs
-        */
-       public void setQueryTimeout(int seconds) throws SQLException
-       {
-               if (seconds<0) throw new PSQLException("postgresql.input.query.gt0");
-               timeout = seconds;
-       }
-
-       /**
-        * This adds a warning to the warning chain.
-        * @param msg message to add
-        */
-       public void addWarning(String msg)
-       {
-               if (warnings != null)
-                       warnings.setNextWarning(new SQLWarning(msg));
-               else
-                       warnings = new SQLWarning(msg);
-       }
-
-       /*
-        * The first warning reported by calls on this Statement is
-        * returned.  A Statement's execute methods clear its SQLWarning
-        * chain.  Subsequent Statement warnings will be chained to this
-        * SQLWarning.
-        *
-        * <p>The Warning chain is automatically cleared each time a statement
-        * is (re)executed.
-        *
-        * <p><B>Note:</B>      If you are processing a ResultSet then any warnings
-        * associated with ResultSet reads will be chained on the ResultSet
-        * object.
-        *
-        * @return the first SQLWarning on null
-        * @exception SQLException if a database access error occurs
-        */
-       public SQLWarning getWarnings() throws SQLException
-       {
-               return warnings;
-       }
-
-       /*
-        * The maxFieldSize limit (in bytes) is the maximum amount of
-        * data returned for any column value; it only applies to
-        * BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR and LONGVARCHAR
-        * columns.  If the limit is exceeded, the excess data is silently
-        * discarded.
-        *
-        * @return the current max column size limit; zero means unlimited
-        * @exception SQLException if a database access error occurs
-        */
-       public int getMaxFieldSize() throws SQLException
-       {
-               return maxfieldSize;
-       }
-
-       /*
-        * Sets the maxFieldSize 
-        *
-        * @param max the new max column size limit; zero means unlimited
-        * @exception SQLException if a database access error occurs
-        */
-       public void setMaxFieldSize(int max) throws SQLException
-       {
-               if (max < 0) throw new PSQLException("postgresql.input.field.gt0");
-               maxfieldSize = max;
-       }
-
-       /*
-        * After this call, getWarnings returns null until a new warning
-        * is reported for this Statement.
-        *
-        * @exception SQLException if a database access error occurs
-        */
-       public void clearWarnings() throws SQLException
-       {
-               warnings = null;
-       }
-
-       /*
-        * Cancel can be used by one thread to cancel a statement that
-        * is being executed by another thread.
-        * <p>
-        * Not implemented, this method is a no-op.
-        *
-        * @exception SQLException only because thats the spec.
-        */
-       public void cancel() throws SQLException
-       {
-               throw new PSQLException("postgresql.unimplemented", PSQLState.NOT_IMPLEMENTED);
-       }
-
-       /*
-        * getResultSet returns the current result as a ResultSet.      It
-        * should only be called once per result.
-        *
-        * @return the current result set; null if there are no more
-        * @exception SQLException if a database access error occurs (why?)
-        */
-       public java.sql.ResultSet getResultSet() throws SQLException
-       {
-               if (result != null && result.reallyResultSet())
-                       return (ResultSet) result;
-               return null;
-       }
-
-       /*
-        * In many cases, it is desirable to immediately release a
-        * Statement's database and JDBC resources instead of waiting
-        * for this to happen when it is automatically closed.  The
-        * close method provides this immediate release.
-        *
-        * <p><B>Note:</B> A Statement is automatically closed when it is
-        * garbage collected.  When a Statement is closed, its current
-        * ResultSet, if one exists, is also closed.
-        *
-        * @exception SQLException if a database access error occurs (why?)
-        */
-       public void close() throws SQLException
-       {
-               // Force the ResultSet to close
-               java.sql.ResultSet rs = getResultSet();
-               if (rs != null)
-                       rs.close();
-
-               deallocateQuery();
-
-               // Disasociate it from us (For Garbage Collection)
-               result = null;
-       }
-
-       /**
-        * This finalizer ensures that statements that have allocated server-side
-        * resources free them when they become unreferenced.
-        */
-       protected void finalize() {
-               try { close(); }
-               catch (SQLException e) {}
-       }
-       /*
-        * Filter the SQL string of Java SQL Escape clauses.
-        *
-        * Currently implemented Escape clauses are those mentioned in 11.3
-        * in the specification. Basically we look through the sql string for
-        * {d xxx}, {t xxx} or {ts xxx} in non-string sql code. When we find
-        * them, we just strip the escape part leaving only the xxx part.
-        * So, something like "select * from x where d={d '2001-10-09'}" would
-        * return "select * from x where d= '2001-10-09'".
-        */
-       protected String replaceProcessing(String p_sql)
-       {
-               if (replaceProcessingEnabled)
-               {
-                       // Since escape codes can only appear in SQL CODE, we keep track
-                       // of if we enter a string or not.
-                       StringBuffer newsql = new StringBuffer(p_sql.length());
-                       short state = IN_SQLCODE;
-
-                       int i = -1;
-                       int len = p_sql.length();
-                       while (++i < len)
-                       {
-                               char c = p_sql.charAt(i);
-                               switch (state)
-                               {
-                                       case IN_SQLCODE:
-                                               if (c == '\'')                            // start of a string?
-                                                       state = IN_STRING;
-                                               else if (c == '{')                        // start of an escape code?
-                                                       if (i + 1 < len)
-                                                       {
-                                                               char next = p_sql.charAt(i + 1);
-                                                               if (next == 'd')
-                                                               {
-                                                                       state = ESC_TIMEDATE;
-                                                                       i++;
-                                                                       break;
-                                                               }
-                                                               else if (next == 't')
-                                                               {
-                                                                       state = ESC_TIMEDATE;
-                                                                       i += (i + 2 < len && p_sql.charAt(i + 2) == 's') ? 2 : 1;
-                                                                       break;
-                                                               }
-                                                       }
-                                               newsql.append(c);
-                                               break;
-
-                                       case IN_STRING:
-                                               if (c == '\'')                             // end of string?
-                                                       state = IN_SQLCODE;
-                                               else if (c == '\\')                        // a backslash?
-                                                       state = BACKSLASH;
-
-                                               newsql.append(c);
-                                               break;
-
-                                       case BACKSLASH:
-                                               state = IN_STRING;
-
-                                               newsql.append(c);
-                                               break;
-
-                                       case ESC_TIMEDATE:
-                                               if (c == '}')
-                                                       state = IN_SQLCODE;               // end of escape code.
-                                               else
-                                                       newsql.append(c);
-                                               break;
-                               } // end switch
-                       }
-
-                       return newsql.toString();
-               }
-               else
-               {
-                       return p_sql;
-               }
-       }
-
-       /*
-        *
-        * The following methods are postgres extensions and are defined
-        * in the interface BaseStatement
-        *
-        */
-
-       /*
-        * Returns the Last inserted/updated oid.  Deprecated in 7.2 because
-                       * range of OID values is greater than a java signed int.
-        * @deprecated Replaced by getLastOID in 7.2
-        */
-       public int getInsertedOID() throws SQLException
-       {
-               if (result == null)
-                       return 0;
-               return (int) result.getLastOID();
-       }
-
-       /*
-        * Returns the Last inserted/updated oid.
-        * @return OID of last insert
-                       * @since 7.2
-        */
-       public long getLastOID() throws SQLException
-       {
-               if (result == null)
-                       return 0;
-               return result.getLastOID();
-       }
-
-       /*
-        * Set a parameter to SQL NULL
-        *
-        * <p><B>Note:</B> You must specify the parameters SQL type (although
-        * PostgreSQL ignores it)
-        *
-        * @param parameterIndex the first parameter is 1, etc...
-        * @param sqlType the SQL type code defined in java.sql.Types
-        * @exception SQLException if a database access error occurs
-        */
-       public void setNull(int parameterIndex, int sqlType) throws SQLException
-       {
-        String l_pgType;
-               switch (sqlType)
-               {
-                       case Types.INTEGER:
-                               l_pgType = PG_INTEGER;
-                               break;
-                       case Types.TINYINT:
-                       case Types.SMALLINT:
-                               l_pgType = PG_INT2;
-                               break;
-                       case Types.BIGINT:
-                               l_pgType = PG_INT8;
-                               break;
-                       case Types.REAL:
-                       case Types.FLOAT:
-                               l_pgType = PG_FLOAT;
-                               break;
-                       case Types.DOUBLE:
-                               l_pgType = PG_DOUBLE;
-                               break;
-                       case Types.DECIMAL:
-                       case Types.NUMERIC:
-                               l_pgType = PG_NUMERIC;
-                               break;
-                       case Types.CHAR:
-                       case Types.VARCHAR:
-                       case Types.LONGVARCHAR:
-                               l_pgType = PG_TEXT;
-                               break;
-                       case Types.DATE:
-                               l_pgType = PG_DATE;
-                               break;
-                       case Types.TIME:
-                               l_pgType = PG_TIME;
-                               break;
-                       case Types.TIMESTAMP:
-                               l_pgType = PG_TIMESTAMPTZ;
-                               break;
-                       case Types.BIT:
-                               l_pgType = PG_BOOLEAN;
-                               break;
-                       case Types.BINARY:
-                       case Types.VARBINARY:
-                       case Types.LONGVARBINARY:
-                               l_pgType = PG_BYTEA;
-                               break;
-                       case Types.OTHER:
-                               l_pgType = PG_TEXT;
-                               break;
-                       default:
-                               l_pgType = PG_TEXT;
-               }
-               bind(parameterIndex, "null", l_pgType);
-       }
-
-       /*
-        * Set a parameter to a Java boolean value.  The driver converts this
-        * to a SQL BIT value when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setBoolean(int parameterIndex, boolean x) throws SQLException
-       {
-               bind(parameterIndex, x ? "'1'" : "'0'", PG_BOOLEAN);
-       }
-
-       /*
-        * Set a parameter to a Java byte value.  The driver converts this to
-        * a SQL TINYINT value when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setByte(int parameterIndex, byte x) throws SQLException
-       {
-               bind(parameterIndex, Integer.toString(x), PG_INT2);
-       }
-
-       /*
-        * Set a parameter to a Java short value.  The driver converts this
-        * to a SQL SMALLINT value when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setShort(int parameterIndex, short x) throws SQLException
-       {
-               bind(parameterIndex, Integer.toString(x), PG_INT2);
-       }
-
-       /*
-        * Set a parameter to a Java int value.  The driver converts this to
-        * a SQL INTEGER value when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setInt(int parameterIndex, int x) throws SQLException
-       {
-               bind(parameterIndex, Integer.toString(x), PG_INTEGER);
-       }
-
-       /*
-        * Set a parameter to a Java long value.  The driver converts this to
-        * a SQL BIGINT value when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setLong(int parameterIndex, long x) throws SQLException
-       {
-               bind(parameterIndex, Long.toString(x), PG_INT8);
-       }
-
-       /*
-        * Set a parameter to a Java float value.  The driver converts this
-        * to a SQL FLOAT value when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setFloat(int parameterIndex, float x) throws SQLException
-       {
-               bind(parameterIndex, Float.toString(x), PG_FLOAT);
-       }
-
-       /*
-        * Set a parameter to a Java double value.      The driver converts this
-        * to a SQL DOUBLE value when it sends it to the database
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setDouble(int parameterIndex, double x) throws SQLException
-       {
-               bind(parameterIndex, Double.toString(x), PG_DOUBLE);
-       }
-
-       /*
-        * Set a parameter to a java.lang.BigDecimal value.  The driver
-        * converts this to a SQL NUMERIC value when it sends it to the
-        * database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
-       {
-               if (x == null)
-                       setNull(parameterIndex, Types.DECIMAL);
-               else
-               {
-                       bind(parameterIndex, x.toString(), PG_NUMERIC);
-               }
-       }
-
-       /*
-        * Set a parameter to a Java String value.      The driver converts this
-        * to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments
-        * size relative to the driver's limits on VARCHARs) when it sends it
-        * to the database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setString(int parameterIndex, String x) throws SQLException
-       {
-               setString(parameterIndex, x, PG_TEXT);
-       }
-
-       public void setString(int parameterIndex, String x, String type) throws SQLException
-       {
-               // if the passed string is null, then set this column to null
-               if (x == null)
-                       setNull(parameterIndex, Types.VARCHAR);
-               else
-               {
-                       // use the shared buffer object. Should never clash but this makes
-                       // us thread safe!
-                       synchronized (sbuf)
-                       {
-                               sbuf.setLength(0);
-                               sbuf.ensureCapacity(2 + x.length() + (int)(x.length() / 10));
-                               sbuf.append('\'');
-                               escapeString(x, sbuf);
-                               sbuf.append('\'');
-                               bind(parameterIndex, sbuf.toString(), type);
-                       }
-               }
-       }
-
-    private void escapeString(String p_input, StringBuffer p_output) {
-        for (int i = 0 ; i < p_input.length() ; ++i)
-        {
-            char c = p_input.charAt(i);
-                       switch (c)
-                       {
-                           case '\\':
-                           case '\'':
-                                       p_output.append('\\');
-                                       p_output.append(c);
-                                       break;
-                           case '\0':
-                                       throw new IllegalArgumentException("\\0 not allowed");
-                               default:
-                                       p_output.append(c);
-                       }
-        }
-    }
-
-
-       /*
-        * Set a parameter to a Java array of bytes.  The driver converts this
-        * to a SQL VARBINARY or LONGVARBINARY (depending on the argument's
-        * size relative to the driver's limits on VARBINARYs) when it sends
-        * it to the database.
-        *
-        * <p>Implementation note:
-        * <br>With org.postgresql, this creates a large object, and stores the
-        * objects oid in this column.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setBytes(int parameterIndex, byte x[]) throws SQLException
-       {
-               if (connection.haveMinimumCompatibleVersion("7.2"))
-               {
-                       //Version 7.2 supports the bytea datatype for byte arrays
-                       if (null == x)
-                       {
-                               setNull(parameterIndex, Types.VARBINARY);
-                       }
-                       else
-                       {
-                               setString(parameterIndex, PGbytea.toPGString(x), PG_BYTEA);
-                       }
-               }
-               else
-               {
-                       //Version 7.1 and earlier support done as LargeObjects
-                       LargeObjectManager lom = connection.getLargeObjectAPI();
-                       int oid = lom.create();
-                       LargeObject lob = lom.open(oid);
-                       lob.write(x);
-                       lob.close();
-                       setInt(parameterIndex, oid);
-               }
-       }
-
-       /*
-        * Set a parameter to a java.sql.Date value.  The driver converts this
-        * to a SQL DATE value when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setDate(int parameterIndex, java.sql.Date x) throws SQLException
-       {
-               if (null == x)
-               {
-                       setNull(parameterIndex, Types.DATE);
-               }
-               else
-               {
-                       bind(parameterIndex, "'" + x.toString() + "'", PG_DATE);
-               }
-       }
-
-       /*
-        * Set a parameter to a java.sql.Time value.  The driver converts
-        * this to a SQL TIME value when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1...));
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setTime(int parameterIndex, Time x) throws SQLException
-       {
-               if (null == x)
-               {
-                       setNull(parameterIndex, Types.TIME);
-               }
-               else
-               {
-                       bind(parameterIndex, "'" + x.toString() + "'", PG_TIME);
-               }
-       }
-
-       /*
-        * Set a parameter to a java.sql.Timestamp value.  The driver converts
-        * this to a SQL TIMESTAMP value when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
-       {
-               if (null == x)
-               {
-                       setNull(parameterIndex, Types.TIMESTAMP);
-               }
-               else
-               {
-                       // Use the shared StringBuffer
-                       synchronized (sbuf)
-                       {
-                               sbuf.setLength(0);
-                               sbuf.ensureCapacity(32);
-                               sbuf.append("'");
-                               //format the timestamp
-                               //we do our own formating so that we can get a format
-                               //that works with both timestamp with time zone and
-                               //timestamp without time zone datatypes.
-                               //The format is '2002-01-01 23:59:59.123456-0130'
-                               //we need to include the local time and timezone offset
-                               //so that timestamp without time zone works correctly
-                               int l_year = x.getYear() + 1900;
-                               sbuf.append(l_year);
-                               sbuf.append('-');
-                               int l_month = x.getMonth() + 1;
-                               if (l_month < 10)
-                                       sbuf.append('0');
-                               sbuf.append(l_month);
-                               sbuf.append('-');
-                               int l_day = x.getDate();
-                               if (l_day < 10)
-                                       sbuf.append('0');
-                               sbuf.append(l_day);
-                               sbuf.append(' ');
-                               int l_hours = x.getHours();
-                               if (l_hours < 10)
-                                       sbuf.append('0');
-                               sbuf.append(l_hours);
-                               sbuf.append(':');
-                               int l_minutes = x.getMinutes();
-                               if (l_minutes < 10)
-                                       sbuf.append('0');
-                               sbuf.append(l_minutes);
-                               sbuf.append(':');
-                               int l_seconds = x.getSeconds();
-                               if (l_seconds < 10)
-                                       sbuf.append('0');
-                               sbuf.append(l_seconds);
-                               // Make decimal from nanos.
-                               char[] l_decimal = {'0', '0', '0', '0', '0', '0', '0', '0', '0'};
-                               char[] l_nanos = Integer.toString(x.getNanos()).toCharArray();
-                               System.arraycopy(l_nanos, 0, l_decimal, l_decimal.length - l_nanos.length, l_nanos.length);
-                               sbuf.append('.');
-                               if (connection.haveMinimumServerVersion("7.2"))
-                               {
-                                       sbuf.append(l_decimal, 0, 6);
-                               }
-                               else
-                               {
-                                       // Because 7.1 include bug that "hh:mm:59.999" becomes "hh:mm:60.00".
-                                       sbuf.append(l_decimal, 0, 2);
-                               }
-                               //add timezone offset
-                               int l_offset = -(x.getTimezoneOffset());
-                               int l_houros = l_offset / 60;
-                               if (l_houros >= 0)
-                               {
-                                       sbuf.append('+');
-                               }
-                               else
-                               {
-                                       sbuf.append('-');
-                               }
-                               if (l_houros > -10 && l_houros < 10)
-                                       sbuf.append('0');
-                               if (l_houros >= 0)
-                               {
-                                       sbuf.append(l_houros);
-                               }
-                               else
-                               {
-                                       sbuf.append(-l_houros);
-                               }
-                               int l_minos = l_offset - (l_houros * 60);
-                               if (l_minos != 0)
-                               {
-                                       if (l_minos > -10 && l_minos < 10)
-                                               sbuf.append('0');
-                                       if (l_minos >= 0)
-                                       {
-                                               sbuf.append(l_minos);
-                                       }
-                                       else
-                                       {
-                                               sbuf.append(-l_minos);
-                                       }
-                               }
-                               sbuf.append("'");
-                               bind(parameterIndex, sbuf.toString(), PG_TIMESTAMPTZ);
-                       }
-
-               }
-       }
-
-       /*
-        * When a very large ASCII value is input to a LONGVARCHAR parameter,
-        * it may be more practical to send it via a java.io.InputStream.
-        * JDBC will read the data from the stream as needed, until it reaches
-        * end-of-file.  The JDBC driver will do any necessary conversion from
-        * ASCII to the database char format.
-        *
-        * <P><B>Note:</B> This stream object can either be a standard Java
-        * stream object or your own subclass that implements the standard
-        * interface.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @param length the number of bytes in the stream
-        * @exception SQLException if a database access error occurs
-        */
-       public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
-       {
-               if (connection.haveMinimumCompatibleVersion("7.2"))
-               {
-                       //Version 7.2 supports AsciiStream for all PG text types (char, varchar, text)
-                       //As the spec/javadoc for this method indicate this is to be used for
-                       //large String values (i.e. LONGVARCHAR)  PG doesn't have a separate
-                       //long varchar datatype, but with toast all text datatypes are capable of
-                       //handling very large values.  Thus the implementation ends up calling
-                       //setString() since there is no current way to stream the value to the server
-                       try
-                       {
-                               InputStreamReader l_inStream = new InputStreamReader(x, "ASCII");
-                               char[] l_chars = new char[length];
-                               int l_charsRead = l_inStream.read(l_chars, 0, length);
-                               setString(parameterIndex, new String(l_chars, 0, l_charsRead), PG_TEXT);
-                       }
-                       catch (UnsupportedEncodingException l_uee)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_uee);
-                       }
-                       catch (IOException l_ioe)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_ioe);
-                       }
-               }
-               else
-               {
-                       //Version 7.1 supported only LargeObjects by treating everything
-                       //as binary data
-                       setBinaryStream(parameterIndex, x, length);
-               }
-       }
-
-       /*
-        * When a very large Unicode value is input to a LONGVARCHAR parameter,
-        * it may be more practical to send it via a java.io.InputStream.
-        * JDBC will read the data from the stream as needed, until it reaches
-        * end-of-file.  The JDBC driver will do any necessary conversion from
-        * UNICODE to the database char format.
-        *
-        * <P><B>Note:</B> This stream object can either be a standard Java
-        * stream object or your own subclass that implements the standard
-        * interface.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException
-       {
-               if (connection.haveMinimumCompatibleVersion("7.2"))
-               {
-                       //Version 7.2 supports AsciiStream for all PG text types (char, varchar, text)
-                       //As the spec/javadoc for this method indicate this is to be used for
-                       //large String values (i.e. LONGVARCHAR)  PG doesn't have a separate
-                       //long varchar datatype, but with toast all text datatypes are capable of
-                       //handling very large values.  Thus the implementation ends up calling
-                       //setString() since there is no current way to stream the value to the server
-                       try
-                       {
-                               InputStreamReader l_inStream = new InputStreamReader(x, "UTF-8");
-                               char[] l_chars = new char[length];
-                               int l_charsRead = l_inStream.read(l_chars, 0, length);
-                               setString(parameterIndex, new String(l_chars, 0, l_charsRead), PG_TEXT);
-                       }
-                       catch (UnsupportedEncodingException l_uee)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_uee);
-                       }
-                       catch (IOException l_ioe)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_ioe);
-                       }
-               }
-               else
-               {
-                       //Version 7.1 supported only LargeObjects by treating everything
-                       //as binary data
-                       setBinaryStream(parameterIndex, x, length);
-               }
-       }
-
-       /*
-        * When a very large binary value is input to a LONGVARBINARY parameter,
-        * it may be more practical to send it via a java.io.InputStream.
-        * JDBC will read the data from the stream as needed, until it reaches
-        * end-of-file.
-        *
-        * <P><B>Note:</B> This stream object can either be a standard Java
-        * stream object or your own subclass that implements the standard
-        * interface.
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        */
-       public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
-       {
-               if (connection.haveMinimumCompatibleVersion("7.2"))
-               {
-                       //Version 7.2 supports BinaryStream for for the PG bytea type
-                       //As the spec/javadoc for this method indicate this is to be used for
-                       //large binary values (i.e. LONGVARBINARY)      PG doesn't have a separate
-                       //long binary datatype, but with toast the bytea datatype is capable of
-                       //handling very large values.  Thus the implementation ends up calling
-                       //setBytes() since there is no current way to stream the value to the server
-                       byte[] l_bytes = new byte[length];
-                       int l_bytesRead;
-                       try
-                       {
-                               l_bytesRead = x.read(l_bytes, 0, length);
-                       }
-                       catch (IOException l_ioe)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_ioe);
-                       }
-                       if (l_bytesRead == length)
-                       {
-                               setBytes(parameterIndex, l_bytes);
-                       }
-                       // x.read will return -1 not 0 on an empty InputStream
-                       else if (l_bytesRead == -1)
-                       {
-                               setBytes(parameterIndex, new byte[0]);
-                       }
-                       else
-                       {
-                               //the stream contained less data than they said
-                               byte[] l_bytes2 = new byte[l_bytesRead];
-                               System.arraycopy(l_bytes, 0, l_bytes2, 0, l_bytesRead);
-                               setBytes(parameterIndex, l_bytes2);
-                       }
-               }
-               else
-               {
-                       //Version 7.1 only supported streams for LargeObjects
-                       //but the jdbc spec indicates that streams should be
-                       //available for LONGVARBINARY instead
-                       LargeObjectManager lom = connection.getLargeObjectAPI();
-                       int oid = lom.create();
-                       LargeObject lob = lom.open(oid);
-                       OutputStream los = lob.getOutputStream();
-                       try
-                       {
-                               // could be buffered, but then the OutputStream returned by LargeObject
-                               // is buffered internally anyhow, so there would be no performance
-                               // boost gained, if anything it would be worse!
-                               int c = x.read();
-                               int p = 0;
-                               while (c > -1 && p < length)
-                               {
-                                       los.write(c);
-                                       c = x.read();
-                                       p++;
-                               }
-                               los.close();
-                       }
-                       catch (IOException se)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, se);
-                       }
-                       // lob is closed by the stream so don't call lob.close()
-                       setInt(parameterIndex, oid);
-               }
-       }
-
-
-       /*
-        * In general, parameter values remain in force for repeated used of a
-        * Statement.  Setting a parameter value automatically clears its
-        * previous value.      However, in coms cases, it is useful to immediately
-        * release the resources used by the current parameter values; this
-        * can be done by calling clearParameters
-        *
-        * @exception SQLException if a database access error occurs
-        */
-       public void clearParameters() throws SQLException
-       {
-               int i;
-
-               for (i = 0 ; i < m_binds.length ; i++)
-               {
-                       m_binds[i] = null;
-                       m_bindTypes[i] = null;
-               }
-       }
-
-       // Helper method that extracts numeric values from an arbitary Object.
-       private String numericValueOf(Object x)
-       {
-               if (x instanceof Boolean)
-                       return ((Boolean)x).booleanValue() ? "1" :"0";
-               else if (x instanceof Integer || x instanceof Long || 
-                                x instanceof Double || x instanceof Short ||
-                                x instanceof Number || x instanceof Float)
-                       return x.toString();
-               else
-                       //ensure the value is a valid numeric value to avoid
-                       //sql injection attacks
-                       return new BigDecimal(x.toString()).toString();
-       }               
-
-       /*
-        * Set the value of a parameter using an object; use the java.lang
-        * equivalent objects for integral values.
-        *
-        * <P>The given Java object will be converted to the targetSqlType before
-        * being sent to the database.
-        *
-        * <P>note that this method may be used to pass database-specific
-        * abstract data types.  This is done by using a Driver-specific
-        * Java type and using a targetSqlType of java.sql.Types.OTHER
-        *
-        * @param parameterIndex the first parameter is 1...
-        * @param x the object containing the input parameter value
-        * @param targetSqlType The SQL type to be send to the database
-        * @param scale For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC
-        *               *      types this is the number of digits after the decimal.  For
-        *               *      all other types this value will be ignored.
-        * @exception SQLException if a database access error occurs
-        */
-       public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException
-       {
-               if (x == null)
-               {
-                       setNull(parameterIndex, targetSqlType);
-                       return ;
-               }
-               switch (targetSqlType)
-               {
-                       case Types.INTEGER:
-                               bind(parameterIndex, numericValueOf(x), PG_INTEGER);
-                               break;
-                       case Types.TINYINT:
-                       case Types.SMALLINT:
-                               bind(parameterIndex, numericValueOf(x), PG_INT2);
-                               break;
-                       case Types.BIGINT:
-                               bind(parameterIndex, numericValueOf(x), PG_INT8);
-                               break;
-                       case Types.REAL:
-                       case Types.FLOAT:
-                               bind(parameterIndex, numericValueOf(x), PG_FLOAT);
-                               break;
-                       case Types.DOUBLE:
-                               bind(parameterIndex, numericValueOf(x), PG_DOUBLE);
-                               break;
-                       case Types.DECIMAL:
-                       case Types.NUMERIC:
-                               bind(parameterIndex, numericValueOf(x), PG_NUMERIC);
-                               break;
-                       case Types.CHAR:
-                       case Types.VARCHAR:
-                       case Types.LONGVARCHAR:
-                               setString(parameterIndex, x.toString());
-                               break;
-                       case Types.DATE:
-                               if (x instanceof java.sql.Date) 
-                                       setDate(parameterIndex, (java.sql.Date)x);
-                               else
-                               {
-                                       java.sql.Date tmpd = (x instanceof java.util.Date) ? new java.sql.Date(((java.util.Date)x).getTime()) : dateFromString(x.toString());
-                                       setDate(parameterIndex, tmpd);
-                               }
-                               break;
-                       case Types.TIME:
-                               if (x instanceof java.sql.Time)
-                                       setTime(parameterIndex, (java.sql.Time)x);
-                               else
-                               {
-                                       java.sql.Time tmpt = (x instanceof java.util.Date) ? new java.sql.Time(((java.util.Date)x).getTime()) : timeFromString(x.toString());
-                                       setTime(parameterIndex, tmpt);
-                               }
-                               break;
-                       case Types.TIMESTAMP:
-                               if (x instanceof java.sql.Timestamp)
-                                       setTimestamp(parameterIndex ,(java.sql.Timestamp)x);
-                               else
-                               {
-                                       java.sql.Timestamp tmpts = (x instanceof java.util.Date) ? new java.sql.Timestamp(((java.util.Date)x).getTime()) : timestampFromString(x.toString());
-                                       setTimestamp(parameterIndex, tmpts);
-                               }
-                               break;
-                       case Types.BIT:
-                               if (x instanceof Boolean)
-                               {
-                                       bind(parameterIndex, ((Boolean)x).booleanValue() ? "'1'" : "'0'", PG_BOOLEAN);
-                               }
-                               else if (x instanceof String)
-                               {
-                                       bind(parameterIndex, Boolean.valueOf(x.toString()).booleanValue() ? "'1'" : "'0'", PG_BOOLEAN);
-                               }
-                               else if (x instanceof Number)
-                               {
-                                       bind(parameterIndex, ((Number)x).intValue()!=0 ? "'1'" : "'0'", PG_BOOLEAN);
-                               }
-                               else
-                               {
-                                       throw new PSQLException("postgresql.prep.type", PSQLState.INVALID_PARAMETER_TYPE);
-                               }
-                               break;
-                       case Types.BINARY:
-                       case Types.VARBINARY:
-                       case Types.LONGVARBINARY:
-                               setObject(parameterIndex, x);
-                               break;
-                       case Types.OTHER:
-                               if (x instanceof PGobject)
-                                       setString(parameterIndex, ((PGobject)x).getValue(), ((PGobject)x).getType());
-                               else
-                                       throw new PSQLException("postgresql.prep.type", PSQLState.INVALID_PARAMETER_TYPE);
-                               break;
-                       default:
-                               throw new PSQLException("postgresql.prep.type", PSQLState.INVALID_PARAMETER_TYPE);
-               }
-       }
-
-       public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
-       {
-               setObject(parameterIndex, x, targetSqlType, 0);
-       }
-
-       /*
-        * This stores an Object into a parameter.
-        */
-       public void setObject(int parameterIndex, Object x) throws SQLException
-       {
-               if (x == null)
-               {
-                       setNull(parameterIndex, Types.OTHER);
-                       return ;
-               }
-               if (x instanceof String)
-                       setString(parameterIndex, (String)x);
-               else if (x instanceof BigDecimal)
-                       setBigDecimal(parameterIndex, (BigDecimal)x);
-               else if (x instanceof Short)
-                       setShort(parameterIndex, ((Short)x).shortValue());
-               else if (x instanceof Integer)
-                       setInt(parameterIndex, ((Integer)x).intValue());
-               else if (x instanceof Long)
-                       setLong(parameterIndex, ((Long)x).longValue());
-               else if (x instanceof Float)
-                       setFloat(parameterIndex, ((Float)x).floatValue());
-               else if (x instanceof Double)
-                       setDouble(parameterIndex, ((Double)x).doubleValue());
-               else if (x instanceof byte[])
-                       setBytes(parameterIndex, (byte[])x);
-               else if (x instanceof java.sql.Date)
-                       setDate(parameterIndex, (java.sql.Date)x);
-               else if (x instanceof Time)
-                       setTime(parameterIndex, (Time)x);
-               else if (x instanceof Timestamp)
-                       setTimestamp(parameterIndex, (Timestamp)x);
-               else if (x instanceof Boolean)
-                       setBoolean(parameterIndex, ((Boolean)x).booleanValue());
-               else if (x instanceof PGobject)
-                       setString(parameterIndex, ((PGobject)x).getValue(), PG_TEXT);
-               else
-                       // Try to store as a string in database
-                       setString(parameterIndex, x.toString(), PG_TEXT);
-       }
-
-       /*
-        * Before executing a stored procedure call you must explicitly
-        * call registerOutParameter to register the java.sql.Type of each
-        * out parameter.
-        *
-        * <p>Note: When reading the value of an out parameter, you must use
-        * the getXXX method whose Java type XXX corresponds to the
-        * parameter's registered SQL type.
-        *
-        * ONLY 1 RETURN PARAMETER if {?= call ..} syntax is used
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @param sqlType SQL type code defined by java.sql.Types; for
-        * parameters of type Numeric or Decimal use the version of
-        * registerOutParameter that accepts a scale value
-        * @exception SQLException if a database-access error occurs.
-        */
-       public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
-       {
-               if (parameterIndex != 1)
-                       throw new PSQLException ("postgresql.call.noinout", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
-               if (!isFunction)
-                       throw new PSQLException ("postgresql.call.procasfunc", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL,originalSql);
-
-               // functionReturnType contains the user supplied value to check
-               // testReturn contains a modified version to make it easier to
-               // check the getXXX methods..
-               functionReturnType = sqlType;
-               testReturn = sqlType;
-               if (functionReturnType == Types.CHAR ||
-                               functionReturnType == Types.LONGVARCHAR)
-                       testReturn = Types.VARCHAR;
-               else if (functionReturnType == Types.FLOAT)
-                       testReturn = Types.REAL; // changes to streamline later error checking
-               returnTypeSet = true;
-       }
-
-       /*
-        * You must also specify the scale for numeric/decimal types:
-        *
-        * <p>Note: When reading the value of an out parameter, you must use
-        * the getXXX method whose Java type XXX corresponds to the
-        * parameter's registered SQL type.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @param sqlType use either java.sql.Type.NUMERIC or java.sql.Type.DECIMAL
-        * @param scale a value greater than or equal to zero representing the
-        * desired number of digits to the right of the decimal point
-        * @exception SQLException if a database-access error occurs.
-        */
-       public void registerOutParameter(int parameterIndex, int sqlType,
-                                                                        int scale) throws SQLException
-       {
-               registerOutParameter (parameterIndex, sqlType); // ignore for now..
-       }
-
-       /*
-        * An OUT parameter may have the value of SQL NULL; wasNull
-        * reports whether the last value read has this special value.
-        *
-        * <p>Note: You must first call getXXX on a parameter to read its
-        * value and then call wasNull() to see if the value was SQL NULL.
-        * @return true if the last parameter read was SQL NULL
-        * @exception SQLException if a database-access error occurs.
-        */
-       public boolean wasNull() throws SQLException
-       {
-               // check to see if the last access threw an exception
-               return (callResult == null);
-       }
-
-       /*
-        * Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a
-        * Java String.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is null
-        * @exception SQLException if a database-access error occurs.
-        */
-       public String getString(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.VARCHAR, "String");
-               return (String)callResult;
-       }
-
-
-       /*
-        * Get the value of a BIT parameter as a Java boolean.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is false
-        * @exception SQLException if a database-access error occurs.
-        */
-       public boolean getBoolean(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.BIT, "Boolean");
-               if (callResult == null)
-                       return false;
-               return ((Boolean)callResult).booleanValue ();
-       }
-
-       /*
-        * Get the value of a TINYINT parameter as a Java byte.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is 0
-        * @exception SQLException if a database-access error occurs.
-        */
-       public byte getByte(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.TINYINT, "Byte");
-               if (callResult == null)
-                       return 0;
-               return (byte)((Integer)callResult).intValue ();
-       }
-
-       /*
-        * Get the value of a SMALLINT parameter as a Java short.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is 0
-        * @exception SQLException if a database-access error occurs.
-        */
-       public short getShort(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.SMALLINT, "Short");
-               if (callResult == null)
-                       return 0;
-               return (short)((Integer)callResult).intValue ();
-       }
-
-
-       /*
-        * Get the value of an INTEGER parameter as a Java int.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is 0
-        * @exception SQLException if a database-access error occurs.
-        */
-       public int getInt(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.INTEGER, "Int");
-               if (callResult == null)
-                       return 0;
-               return ((Integer)callResult).intValue ();
-       }
-
-       /*
-        * Get the value of a BIGINT parameter as a Java long.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is 0
-        * @exception SQLException if a database-access error occurs.
-        */
-       public long getLong(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.BIGINT, "Long");
-               if (callResult == null)
-                       return 0;
-               return ((Long)callResult).longValue ();
-       }
-
-       /*
-        * Get the value of a FLOAT parameter as a Java float.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is 0
-        * @exception SQLException if a database-access error occurs.
-        */
-       public float getFloat(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.REAL, "Float");
-               if (callResult == null)
-                       return 0;
-               return ((Float)callResult).floatValue ();
-       }
-
-       /*
-        * Get the value of a DOUBLE parameter as a Java double.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is 0
-        * @exception SQLException if a database-access error occurs.
-        */
-       public double getDouble(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.DOUBLE, "Double");
-               if (callResult == null)
-                       return 0;
-               return ((Double)callResult).doubleValue ();
-       }
-
-       /*
-        * Get the value of a NUMERIC parameter as a java.math.BigDecimal
-        * object.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @param scale a value greater than or equal to zero representing the
-        * desired number of digits to the right of the decimal point
-        * @return the parameter value; if the value is SQL NULL, the result is null
-        * @exception SQLException if a database-access error occurs.
-        * @deprecated in Java2.0
-        */
-       public BigDecimal getBigDecimal(int parameterIndex, int scale)
-       throws SQLException
-       {
-               checkIndex (parameterIndex, Types.NUMERIC, "BigDecimal");
-               return ((BigDecimal)callResult);
-       }
-
-       /*
-        * Get the value of a SQL BINARY or VARBINARY parameter as a Java
-        * byte[]
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is null
-        * @exception SQLException if a database-access error occurs.
-        */
-       public byte[] getBytes(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.VARBINARY, Types.BINARY, "Bytes");
-               return ((byte [])callResult);
-       }
-
-
-       /*
-        * Get the value of a SQL DATE parameter as a java.sql.Date object
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is null
-        * @exception SQLException if a database-access error occurs.
-        */
-       public java.sql.Date getDate(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.DATE, "Date");
-               return (java.sql.Date)callResult;
-       }
-
-       /*
-        * Get the value of a SQL TIME parameter as a java.sql.Time object.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is null
-        * @exception SQLException if a database-access error occurs.
-        */
-       public java.sql.Time getTime(int parameterIndex) throws SQLException
-       {
-               checkIndex (parameterIndex, Types.TIME, "Time");
-               return (java.sql.Time)callResult;
-       }
-
-       /*
-        * Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return the parameter value; if the value is SQL NULL, the result is null
-        * @exception SQLException if a database-access error occurs.
-        */
-       public java.sql.Timestamp getTimestamp(int parameterIndex)
-       throws SQLException
-       {
-               checkIndex (parameterIndex, Types.TIMESTAMP, "Timestamp");
-               return (java.sql.Timestamp)callResult;
-       }
-
-       // getObject returns a Java object for the parameter.
-       // See the JDBC spec's "Dynamic Programming" chapter for details.
-       /*
-        * Get the value of a parameter as a Java object.
-        *
-        * <p>This method returns a Java object whose type coresponds to the
-        * SQL type that was registered for this parameter using
-        * registerOutParameter.
-        *
-        * <P>Note that this method may be used to read datatabase-specific,
-        * abstract data types. This is done by specifying a targetSqlType
-        * of java.sql.types.OTHER, which allows the driver to return a
-        * database-specific Java type.
-        *
-        * <p>See the JDBC spec's "Dynamic Programming" chapter for details.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return A java.lang.Object holding the OUT parameter value.
-        * @exception SQLException if a database-access error occurs.
-        */
-       public Object getObject(int parameterIndex)
-       throws SQLException
-       {
-               checkIndex (parameterIndex);
-               return callResult;
-       }
-
-       //This method is implemeted in jdbc2
-       public int getResultSetConcurrency() throws SQLException
-       {
-               return 0;
-       }
-
-       /*
-        * Returns the SQL statement with the current template values
-        * substituted.
-        */
-       public String toString()
-       {
-               if (m_sqlFragments == null)
-                       return super.toString();
-
-               synchronized (sbuf)
-               {
-                       sbuf.setLength(0);
-                       int i;
-
-                       for (i = 0 ; i < m_binds.length ; ++i)
-                       {
-                               sbuf.append (m_sqlFragments[i]);
-                               if (m_binds[i] == null)
-                                       sbuf.append( '?' );
-                               else
-                                       sbuf.append (m_binds[i]);
-                       }
-                       sbuf.append(m_sqlFragments[m_binds.length]);
-                       return sbuf.toString();
-               }
-       }
-
-       /*
-     * Note if s is a String it should be escaped by the caller to avoid SQL
-     * injection attacks.  It is not done here for efficency reasons as
-     * most calls to this method do not require escaping as the source
-     * of the string is known safe (i.e. Integer.toString())
-        */
-       private void bind(int paramIndex, Object s, String type) throws SQLException
-       {
-               if (paramIndex < 1 || paramIndex > m_binds.length)
-                       throw new PSQLException("postgresql.prep.range", PSQLState.INVALID_PARAMETER_VALUE);
-               if (paramIndex == 1 && isFunction) // need to registerOut instead
-                       throw new PSQLException ("postgresql.call.funcover");
-               m_binds[paramIndex - 1] = s;
-               m_bindTypes[paramIndex - 1] = type;
-       }
-
-       /**
-        * this method will turn a string of the form
-        * {? = call <some_function> (?, [?,..]) }
-        * into the PostgreSQL format which is
-        * select <some_function> (?, [?, ...]) as result
-        * or select * from <some_function> (?, [?, ...]) as result (7.3)
-        *
-        */
-       private String modifyJdbcCall(String p_sql) throws SQLException
-       {
-               //Check that this is actually a call which should start with a {
-        //if not do nothing and treat this as a standard prepared sql
-               if (!p_sql.trim().startsWith("{")) {
-                       return p_sql;
-               }
-
-               // syntax checking is not complete only a few basics :(
-               originalSql = p_sql; // save for error msgs..
-               String l_sql = p_sql;
-               int index = l_sql.indexOf ("="); // is implied func or proc?
-               boolean isValid = true;
-               if (index > -1)
-               {
-                       isFunction = true;
-                       isValid = l_sql.indexOf ("?") < index; // ? before =
-               }
-               l_sql = l_sql.trim ();
-               if (l_sql.startsWith ("{") && l_sql.endsWith ("}"))
-               {
-                       l_sql = l_sql.substring (1, l_sql.length() - 1);
-               }
-               else
-                       isValid = false;
-               index = l_sql.indexOf ("call");
-               if (index == -1 || !isValid)
-                       throw new PSQLException ("postgresql.call.malformed",PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL,
-                                                                        new Object[]{l_sql, JDBC_SYNTAX});
-               l_sql = l_sql.replace ('{', ' '); // replace these characters
-               l_sql = l_sql.replace ('}', ' ');
-               l_sql = l_sql.replace (';', ' ');
-
-               // this removes the 'call' string and also puts a hidden '?'
-               // at the front of the line for functions, this will
-               // allow the registerOutParameter to work correctly
-               // because in the source sql there was one more ? for the return
-               // value that is not needed by the postgres syntax.  But to make
-               // sure that the parameter numbers are the same as in the original
-               // sql we add a dummy parameter in this case
-               l_sql = (isFunction ? "?" : "") + l_sql.substring (index + 4);
-               if (connection.haveMinimumServerVersion("7.3")) {
-                       l_sql = "select * from " + l_sql + " as " + RESULT_ALIAS + ";";
-               } else {
-                       l_sql = "select " + l_sql + " as " + RESULT_ALIAS + ";";
-               }
-               return l_sql;
-       }
-
-       /** helperfunction for the getXXX calls to check isFunction and index == 1
-        * Compare BOTH type fields against the return type.
-        */
-       protected void checkIndex (int parameterIndex, int type1, int type2, String getName)
-       throws SQLException
-       {
-               checkIndex (parameterIndex);            
-               if (type1 != this.testReturn && type2 != this.testReturn)
-                       throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
-                                               new Object[]{"java.sql.Types=" + testReturn,
-                                                            getName,
-                                                            "java.sql.Types=" + type1});
-       }
-
-       /** helperfunction for the getXXX calls to check isFunction and index == 1
-        */
-       protected void checkIndex (int parameterIndex, int type, String getName)
-       throws SQLException
-       {
-               checkIndex (parameterIndex);
-               if (type != this.testReturn)
-                       throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
-                                               new Object[]{"java.sql.Types=" + testReturn,
-                                                            getName,
-                                                            "java.sql.Types=" + type});
-       }
-
-       /** helperfunction for the getXXX calls to check isFunction and index == 1
-        * @param parameterIndex index of getXXX (index)
-        * check to make sure is a function and index == 1
-        */
-       private void checkIndex (int parameterIndex) throws SQLException
-       {
-               if (!isFunction)
-                       throw new PSQLException("postgresql.call.noreturntype", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
-               if (parameterIndex != 1)
-                       throw new PSQLException("postgresql.call.noinout", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
-       }
-
-
-
-    public void setUseServerPrepare(boolean flag) throws SQLException {
-        //Server side prepared statements were introduced in 7.3
-        if (connection.haveMinimumServerVersion("7.3")) {
-                       if (m_useServerPrepare != flag)
-                               deallocateQuery();
-                       m_useServerPrepare = flag;
-               } else {
-                       //This is a pre 7.3 server so no op this method
-                       //which means we will never turn on the flag to use server
-                       //prepared statements and thus regular processing will continue
-               }
-       }
-
-       public boolean isUseServerPrepare()
-       {
-               return m_useServerPrepare;
-       }
-
-       private java.sql.Date dateFromString (String s) throws SQLException
-       {
-               int timezone = 0;
-               long millis = 0;
-               long localoffset = 0;
-               int timezoneLocation = (s.indexOf('+') == -1) ? s.lastIndexOf("-") : s.indexOf('+');
-               //if the last index of '-' or '+' is past 8. we are guaranteed that it is a timezone marker
-               //shortest = yyyy-m-d
-               //longest = yyyy-mm-dd
-               try
-               {
-                       timezone = (timezoneLocation>7) ? timezoneLocation : s.length();
-                       millis = java.sql.Date.valueOf(s.substring(0,timezone)).getTime();
-               }
-               catch (Exception e)
-               {
-                       throw new PSQLException("postgresql.format.baddate", PSQLState.BAD_DATETIME_FORMAT, s , "yyyy-MM-dd[-tz]");
-               }
-               timezone = 0;
-               if (timezoneLocation>7 && timezoneLocation+3 == s.length())
-               {
-                       timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
-                       localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
-                       if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(new java.sql.Date(millis)))
-                               localoffset += 60*60*1000;
-                       if (s.charAt(timezoneLocation)=='+')
-                               timezone*=-1;
-               }
-               millis = millis + timezone*60*60*1000 + localoffset;
-               return new java.sql.Date(millis);
-       }
-       
-       private java.sql.Time timeFromString (String s) throws SQLException
-       {
-               int timezone = 0;
-               long millis = 0;
-               long localoffset = 0;
-               int timezoneLocation = (s.indexOf('+') == -1) ? s.lastIndexOf("-") : s.indexOf('+');
-               //if the index of the last '-' or '+' is greater than 0 that means this time has a timezone.
-               //everything earlier than that position, we treat as the time and parse it as such.
-               try
-               {
-                       timezone = (timezoneLocation==-1) ? s.length() : timezoneLocation;      
-                       millis = java.sql.Time.valueOf(s.substring(0,timezone)).getTime();
-               }
-               catch (Exception e)
-               {
-                       throw new PSQLException("postgresql.format.badtime", PSQLState.BAD_DATETIME_FORMAT, s, "HH:mm:ss[-tz]");
-               }
-               timezone = 0;
-               if (timezoneLocation != -1 && timezoneLocation+3 == s.length())
-               {
-                       timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
-                       localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
-                       if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(new java.sql.Date(millis)))
-                               localoffset += 60*60*1000;
-                       if (s.charAt(timezoneLocation)=='+')
-                               timezone*=-1;
-               }
-               millis = millis + timezone*60*60*1000 + localoffset;
-               return new java.sql.Time(millis);
-       }
-       
-       private java.sql.Timestamp timestampFromString (String s) throws SQLException
-       {
-               int timezone = 0;
-               long millis = 0;
-               long localoffset = 0;
-               int nanosVal = 0;
-               int timezoneLocation = (s.indexOf('+') == -1) ? s.lastIndexOf("-") : s.indexOf('+');
-               int nanospos = s.indexOf(".");
-               //if there is a '.', that means there are nanos info, and we take the timestamp up to that point
-               //if not, then we check to see if the last +/- (to indicate a timezone) is greater than 8
-               //8 is because the shortest date, will have last '-' at position 7. e.g yyyy-x-x
-               try
-               {
-                       if (nanospos != -1)
-                               timezone = nanospos;
-                       else if (timezoneLocation > 8)
-                               timezone = timezoneLocation;
-                       else 
-                               timezone = s.length();
-                       millis = java.sql.Timestamp.valueOf(s.substring(0,timezone)).getTime();
-               }
-               catch (Exception e)
-               {
-                       throw new PSQLException("postgresql.format.badtimestamp", PSQLState.BAD_DATETIME_FORMAT, s, "yyyy-MM-dd HH:mm:ss[.xxxxxx][-tz]");
-               }
-               timezone = 0;
-               if (nanospos != -1)
-               {
-                       int tmploc = (timezoneLocation > 8) ? timezoneLocation : s.length();
-                       nanosVal = Integer.parseInt(s.substring(nanospos+1,tmploc));
-                       int diff = 8-((tmploc-1)-(nanospos+1));
-                       for (int i=0;i<diff;i++)
-                               nanosVal*=10;
-               }
-               if (timezoneLocation>8 && timezoneLocation+3 == s.length())
-               {
-                       timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
-                       localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
-                       if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(new java.sql.Date(millis)))
-                               localoffset += 60*60*1000;
-                       if (s.charAt(timezoneLocation)=='+')
-                               timezone*=-1;
-               }
-               millis = millis + timezone*60*60*1000 + localoffset;
-               java.sql.Timestamp tmpts = new java.sql.Timestamp(millis);
-               tmpts.setNanos(nanosVal);
-               return tmpts;
-       }
-                       
-       
-       private static final String PG_TEXT = "text";
-       private static final String PG_INTEGER = "integer";
-       private static final String PG_INT2 = "int2";
-       private static final String PG_INT8 = "int8";
-       private static final String PG_NUMERIC = "numeric";
-       private static final String PG_FLOAT = "float";
-       private static final String PG_DOUBLE = "double precision";
-       private static final String PG_BOOLEAN = "boolean";
-       private static final String PG_DATE = "date";
-       private static final String PG_TIME = "time";
-       private static final String PG_TIMESTAMPTZ = "timestamptz";
-    private static final String PG_BYTEA = "bytea";
-
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1CallableStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1CallableStatement.java
deleted file mode 100644 (file)
index 697a186..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.postgresql.jdbc1;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.Field;
-
-public class Jdbc1CallableStatement extends AbstractJdbc1Statement implements java.sql.CallableStatement
-{
-
-       public Jdbc1CallableStatement(Jdbc1Connection connection, String sql) throws SQLException
-       {
-               super(connection, sql);
-       }
-
-       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);
-       }
-
-       public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
-       {
-                return new Jdbc1RefCursorResultSet(this, cursorName);
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java
deleted file mode 100644 (file)
index 15d11f5..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.postgresql.jdbc1;
-
-
-import java.util.Vector;
-import java.sql.*;
-import org.postgresql.core.Field;
-import org.postgresql.util.PSQLException;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java,v 1.8 2003/11/29 19:52:10 pgsql 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 class Jdbc1Connection extends org.postgresql.jdbc1.AbstractJdbc1Connection implements java.sql.Connection
-{
-
-       public java.sql.Statement createStatement() throws SQLException
-       {
-               return new org.postgresql.jdbc1.Jdbc1Statement(this);
-       }
-
-       public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException
-       {
-               return new org.postgresql.jdbc1.Jdbc1PreparedStatement(this, sql);
-       }
-
-       public java.sql.CallableStatement prepareCall(String sql) throws SQLException
-       {
-               return new org.postgresql.jdbc1.Jdbc1CallableStatement(this, sql);
-       }
-
-       public java.sql.DatabaseMetaData getMetaData() throws SQLException
-       {
-               if (metadata == null)
-                       metadata = new org.postgresql.jdbc1.Jdbc1DatabaseMetaData(this);
-               return metadata;
-       }
-
-}
-
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1DatabaseMetaData.java
deleted file mode 100644 (file)
index fde36f5..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.postgresql.jdbc1;
-
-
-import java.sql.*;
-import java.util.*;
-import org.postgresql.core.Field;
-import org.postgresql.util.PSQLException;
-
-public class Jdbc1DatabaseMetaData extends AbstractJdbc1DatabaseMetaData implements java.sql.DatabaseMetaData
-{
-       public Jdbc1DatabaseMetaData(Jdbc1Connection conn)
-       {
-               super(conn);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java
deleted file mode 100644 (file)
index a80928e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.postgresql.jdbc1;
-
-
-import java.sql.*;
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.Field;
-
-public class Jdbc1PreparedStatement extends AbstractJdbc1Statement implements PreparedStatement
-{
-
-       public Jdbc1PreparedStatement(Jdbc1Connection connection, String sql) throws SQLException
-       {
-               super(connection, sql);
-       }
-
-       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);
-       }
-
-       public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
-       {
-                return new Jdbc1RefCursorResultSet(this, cursorName);
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1RefCursorResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1RefCursorResultSet.java
deleted file mode 100644 (file)
index 7b83bf6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.postgresql.jdbc1;
-
-import java.sql.SQLException;
-import org.postgresql.core.QueryExecutor;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.PGRefCursorResultSet;
-
-/** A real result set based on a ref cursor.
- *
- * @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
- */
-public class Jdbc1RefCursorResultSet extends Jdbc1ResultSet
-        implements PGRefCursorResultSet
-{
-
-        // The name of the cursor being used.
-        String refCursorHandle;
-
-        // Indicates when the result set has activaly bound to the cursor.
-        boolean isInitialized = false;
-
-        
-        Jdbc1RefCursorResultSet(BaseStatement statement, String refCursorName)
-        {
-                super(statement, null, null, null, -1, 0L, false);
-                this.refCursorHandle = refCursorName;
-        }
-
-        public String getRefCursor ()
-        {
-                return refCursorHandle;
-        }
-
-        public boolean next () throws SQLException
-        {
-                if (isInitialized)
-                        return super.next();
-                // Initialize this res set with the rows from the cursor.
-                String[] toExec = { "FETCH ALL IN \"" + refCursorHandle + "\";" };
-                QueryExecutor.execute(toExec, new String[0], this);
-                isInitialized = true;
-                return super.next();
-        }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java
deleted file mode 100644 (file)
index 4e3dc05..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.postgresql.jdbc1;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java,v 1.7 2003/11/29 19:52:10 pgsql 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 class Jdbc1ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet implements java.sql.ResultSet
-{
-
-       public Jdbc1ResultSet(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
-       {
-               return new Jdbc1ResultSetMetaData(rows, fields);
-       }
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1ResultSetMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1ResultSetMetaData.java
deleted file mode 100644 (file)
index 39748d6..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.postgresql.jdbc1;
-
-import java.util.Vector;
-import org.postgresql.core.Field;
-
-public class Jdbc1ResultSetMetaData extends AbstractJdbc1ResultSetMetaData implements java.sql.ResultSetMetaData
-{
-       public Jdbc1ResultSetMetaData(Vector rows, Field[] fields)
-       {
-               super(rows, fields);
-       }
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Statement.java
deleted file mode 100644 (file)
index 0cfc4a6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.postgresql.jdbc1;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.Field;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Statement.java,v 1.7 2003/11/29 19:52:10 pgsql Exp $
- * This class implements the java.sql.Statement interface for JDBC1.
- * However most of the implementation is really done in
- * org.postgresql.jdbc1.AbstractJdbc1Statement
- */
-public class Jdbc1Statement extends org.postgresql.jdbc1.AbstractJdbc1Statement implements java.sql.Statement
-{
-
-       public Jdbc1Statement (Jdbc1Connection c)
-       {
-               super(c);
-       }
-
-       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);
-       }
-
-       public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
-       {
-                return new Jdbc1RefCursorResultSet(this, cursorName);
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Blob.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Blob.java
deleted file mode 100644 (file)
index 27e10af..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.postgresql.jdbc2;
-
-import org.postgresql.PGConnection;
-import org.postgresql.largeobject.LargeObject;
-import org.postgresql.largeobject.LargeObjectManager;
-import java.io.InputStream;
-import java.sql.Blob;
-import java.sql.SQLException;
-
-public abstract class AbstractJdbc2Blob
-{
-       private int oid;
-       private LargeObject lo;
-
-       public AbstractJdbc2Blob(PGConnection conn, int oid) throws SQLException
-       {
-               this.oid = oid;
-               LargeObjectManager lom = conn.getLargeObjectAPI();
-               this.lo = lom.open(oid);
-       }
-
-       public long length() throws SQLException
-       {
-               return lo.size();
-       }
-
-       public InputStream getBinaryStream() throws SQLException
-       {
-               return lo.getInputStream();
-       }
-
-       public byte[] getBytes(long pos, int length) throws SQLException
-       {
-               lo.seek((int)pos, LargeObject.SEEK_SET);
-               return lo.read(length);
-       }
-
-       /*
-        * For now, this is not implemented.
-        */
-       public long position(byte[] pattern, long start) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /*
-        * This should be simply passing the byte value of the pattern Blob
-        */
-       public long position(Blob pattern, long start) throws SQLException
-       {
-               return position(pattern.getBytes(0, (int)pattern.length()), start);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Clob.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Clob.java
deleted file mode 100644 (file)
index d1948f6..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-import org.postgresql.PGConnection;
-import org.postgresql.largeobject.LargeObject;
-import org.postgresql.largeobject.LargeObjectManager;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.sql.Clob;
-import java.sql.SQLException;
-
-public class AbstractJdbc2Clob
-{
-       private int oid;
-       private LargeObject lo;
-
-       public AbstractJdbc2Clob(PGConnection conn, int oid) throws SQLException
-       {
-               this.oid = oid;
-               LargeObjectManager lom = conn.getLargeObjectAPI();
-               this.lo = lom.open(oid);
-       }
-
-       public long length() throws SQLException
-       {
-               return lo.size();
-       }
-
-       public InputStream getAsciiStream() throws SQLException
-       {
-               return lo.getInputStream();
-       }
-
-       public Reader getCharacterStream() throws SQLException
-       {
-               return new InputStreamReader(lo.getInputStream());
-       }
-
-       public String getSubString(long i, int j) throws SQLException
-       {
-               lo.seek((int)i - 1);
-               return new String(lo.read(j));
-       }
-
-       /*
-        * For now, this is not implemented.
-        */
-       public long position(String pattern, long start) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /*
-        * This should be simply passing the byte value of the pattern Blob
-        */
-       public long position(Clob pattern, long start) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java
deleted file mode 100644 (file)
index feba229..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-import java.io.PrintWriter;
-import java.sql.DriverManager;
-import java.sql.SQLData;
-import java.sql.SQLException;
-import java.sql.Types;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java,v 1.7 2003/11/29 19:52:10 pgsql 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
- */
-public abstract class AbstractJdbc2Connection extends org.postgresql.jdbc1.AbstractJdbc1Connection
-{
-       /*
-        * The current type mappings
-        */
-       protected java.util.Map typemap;
-       public java.sql.Statement createStatement() throws SQLException
-       {
-               // The spec says default of TYPE_FORWARD_ONLY but everyone is used to
-               // using TYPE_SCROLL_INSENSITIVE
-               return createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY);
-       }
-
-       public abstract java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException;
-
-       public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException
-       {
-               return prepareStatement(sql, java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY);
-       }
-
-       public abstract java.sql.PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException;
-
-       public java.sql.CallableStatement prepareCall(String sql) throws SQLException
-       {
-               return prepareCall(sql, java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY);
-       }
-
-       public abstract java.sql.CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException;
-
-       public java.util.Map getTypeMap() throws SQLException
-       {
-               return typemap;
-       }
-
-
-       public void setTypeMap(java.util.Map map) throws SQLException
-       {
-               typemap = map;
-       }
-
-       /*
-        * This overides the standard internal getObject method so that we can
-        * check the jdbc2 type map first
-        */
-       public Object getObject(String type, String value) throws SQLException
-       {
-               if (typemap != null)
-               {
-                       SQLData d = (SQLData) typemap.get(type);
-                       if (d != null)
-                       {
-                               // Handle the type (requires SQLInput & SQLOutput classes to be implemented)
-                               throw org.postgresql.Driver.notImplemented();
-                       }
-               }
-
-               // Default to the original method
-               return super.getObject(type, value);
-       }
-
-
-       //Because the get/setLogStream methods are deprecated in JDBC2
-       //we use the get/setLogWriter methods here for JDBC2 by overriding
-       //the base version of this method
-       protected void enableDriverManagerLogging()
-       {
-               if (DriverManager.getLogWriter() == null)
-               {
-                       DriverManager.setLogWriter(new PrintWriter(System.out));
-               }
-       }
-
-
-       /*
-        * This implemetation uses the jdbc2Types array to support the jdbc2
-        * datatypes.  Basically jdbc1 and jdbc2 are the same, except that
-        * jdbc2 adds the Array types.
-        */
-       public int getSQLType(String pgTypeName)
-       {
-               int sqlType = Types.OTHER; // default value
-               for (int i = 0;i < jdbc2Types.length;i++)
-               {
-                       if (pgTypeName.equals(jdbc2Types[i]))
-                       {
-                               sqlType = jdbc2Typei[i];
-                               break;
-                       }
-               }
-               return sqlType;
-       }
-
-       /*
-        * This table holds the org.postgresql names for the types supported.
-        * Any types that map to Types.OTHER (eg POINT) don't go into this table.
-        * They default automatically to Types.OTHER
-        *
-        * Note: This must be in the same order as below.
-        *
-        * Tip: keep these grouped together by the Types. value
-        */
-       private static final String jdbc2Types[] = {
-                               "int2",
-                               "int4", "oid",
-                               "int8",
-                               "cash", "money",
-                               "numeric",
-                               "float4",
-                               "float8",
-                               "bpchar", "char", "char2", "char4", "char8", "char16",
-                               "varchar", "text", "name", "filename",
-                               "bytea",
-                               "bool",
-                               "bit",
-                               "date",
-                               "time",
-                               "abstime", "timestamp", "timestamptz",
-                               "_bool", "_char", "_int2", "_int4", "_text",
-                               "_oid", "_varchar", "_int8", "_float4", "_float8",
-                               "_abstime", "_date", "_time", "_timestamp", "_numeric",
-                               "_bytea"
-                       };
-
-       /*
-        * This table holds the JDBC type for each entry above.
-        *
-        * Note: This must be in the same order as above
-        *
-        * Tip: keep these grouped together by the Types. value
-        */
-       private static final int jdbc2Typei[] = {
-                                                                                               Types.SMALLINT,
-                                                                                               Types.INTEGER, Types.INTEGER,
-                                                                                               Types.BIGINT,
-                                                                                               Types.DOUBLE, Types.DOUBLE,
-                                                                                               Types.NUMERIC,
-                                                                                               Types.REAL,
-                                                                                               Types.DOUBLE,
-                                                                                               Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR,
-                                                                                               Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
-                                                                                               Types.BINARY,
-                                                                                               Types.BIT,
-                                                                                               Types.BIT,
-                                                                                               Types.DATE,
-                                                                                               Types.TIME,
-                                                                                               Types.TIMESTAMP, Types.TIMESTAMP, Types.TIMESTAMP,
-                                                                                               Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY,
-                                                                                               Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY,
-                                                                                               Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY,
-                                                                                               Types.ARRAY
-                                                                                       };
-
-
-
-
-}
-
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
deleted file mode 100644 (file)
index d3f7e12..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.postgresql.jdbc2;
-
-import java.sql.SQLException;
-
-public abstract class AbstractJdbc2DatabaseMetaData extends org.postgresql.jdbc1.AbstractJdbc1DatabaseMetaData
-{
-
-       public AbstractJdbc2DatabaseMetaData(AbstractJdbc2Connection conn)
-       {
-               super(conn);
-       }
-
-
-
-       // ** JDBC 2 Extensions **
-
-       /*
-        * Does the database support the given result set type?
-        *
-        * @param type - defined in java.sql.ResultSet
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-        */
-       public boolean supportsResultSetType(int type) throws SQLException
-       {
-               // The only type we don't support
-               return type != java.sql.ResultSet.TYPE_SCROLL_SENSITIVE;
-       }
-
-
-       /*
-        * Does the database support the concurrency type in combination
-        * with the given result set type?
-        *
-        * @param type - defined in java.sql.ResultSet
-        * @param concurrency - type defined in java.sql.ResultSet
-        * @return true if so; false otherwise
-        * @exception SQLException - if a database access error occurs
-       */
-       public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException
-       {
-               // These combinations are not supported!
-               if (type == java.sql.ResultSet.TYPE_SCROLL_SENSITIVE)
-                       return false;
-
-               // We do support Updateable ResultSets
-               if (concurrency == java.sql.ResultSet.CONCUR_UPDATABLE)
-                       return true;
-
-               // Everything else we do
-               return true;
-       }
-
-
-       /* lots of unsupported stuff... */
-       public boolean ownUpdatesAreVisible(int type) throws SQLException
-       {
-               return true;
-       }
-
-       public boolean ownDeletesAreVisible(int type) throws SQLException
-       {
-               return true;
-       }
-
-       public boolean ownInsertsAreVisible(int type) throws SQLException
-       {
-               // indicates that
-               return true;
-       }
-
-       public boolean othersUpdatesAreVisible(int type) throws SQLException
-       {
-               return false;
-       }
-
-       public boolean othersDeletesAreVisible(int i) throws SQLException
-       {
-               return false;
-       }
-
-       public boolean othersInsertsAreVisible(int type) throws SQLException
-       {
-               return false;
-       }
-
-       public boolean updatesAreDetected(int type) throws SQLException
-       {
-               return false;
-       }
-
-       public boolean deletesAreDetected(int i) throws SQLException
-       {
-               return false;
-       }
-
-       public boolean insertsAreDetected(int type) throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * Indicates whether the driver supports batch updates.
-        */
-       public boolean supportsBatchUpdates() throws SQLException
-       {
-               return true;
-       }
-
-       /*
-        * Return user defined types in a schema
-        */
-       public java.sql.ResultSet getUDTs(String catalog,
-                                                                         String schemaPattern,
-                                                                         String typeNamePattern,
-                                                                         int[] types
-                                                                        ) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-       /*
-        * Retrieves the connection that produced this metadata object.
-        *
-        * @return the connection that produced this metadata object
-        */
-       public java.sql.Connection getConnection() throws SQLException
-       {
-               return (java.sql.Connection)connection;
-       }
-
-       /* I don't find these in the spec!?! */
-
-       public boolean rowChangesAreDetected(int type) throws SQLException
-       {
-               return false;
-       }
-
-       public boolean rowChangesAreVisible(int type) throws SQLException
-       {
-               return false;
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
deleted file mode 100644 (file)
index 37d7f9c..0000000
+++ /dev/null
@@ -1,1548 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * AbstractJdbc2ResultSet.java
- *     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
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java,v 1.28 2003/12/12 18:34:14 davec Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.jdbc2;
-
-import java.io.CharArrayReader;
-import java.io.InputStream;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.sql.*;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import org.postgresql.Driver;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-import org.postgresql.core.Encoding;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-
-public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet
-{
-
-       //needed for updateable result set support
-       protected boolean updateable = false;
-       protected boolean doingUpdates = false;
-       protected boolean onInsertRow = false;
-       protected Hashtable updateValues = new Hashtable();
-       private boolean usingOID = false;       // are we using the OID for the primary key?
-       private Vector primaryKeys;    // list of primary keys
-       private int numKeys = 0;
-       private boolean singleTable = false;
-       protected String tableName = null;
-       protected PreparedStatement updateStatement = null;
-       protected PreparedStatement insertStatement = null;
-       protected PreparedStatement deleteStatement = null;
-       private PreparedStatement selectStatement = null;
-
-  
-       public AbstractJdbc2ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
-       {
-               super (statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
-       }
-
-       public java.net.URL getURL(int columnIndex) throws SQLException
-       {
-               return null;
-       }
-
-
-       public java.net.URL getURL(String columnName) throws SQLException
-       {
-               return null;
-       }
-
-
-       /*
-        * Get the value of a column in the current row as a Java object
-        *
-        * <p>This method will return the value of the given column as a
-        * Java object.  The type of the Java object will be the default
-        * Java Object type corresponding to the column's SQL type, following
-        * the mapping specified in the JDBC specification.
-        *
-        * <p>This method may also be used to read database specific abstract
-        * data types.
-        *
-        * @param columnIndex the first column is 1, the second is 2...
-        * @return a Object holding the column value
-        * @exception SQLException if a database access error occurs
-        */
-       public Object getObject(int columnIndex) throws SQLException
-       {
-               Field field;
-
-               checkResultSet( columnIndex );
-
-               wasNullFlag = (this_row[columnIndex - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               field = fields[columnIndex - 1];
-
-               // some fields can be null, mainly from those returned by MetaData methods
-               if (field == null)
-               {
-                       wasNullFlag = true;
-                       return null;
-               }
-
-               switch (field.getSQLType())
-               {
-                       case Types.BIT:
-                               return getBoolean(columnIndex) ? Boolean.TRUE : Boolean.FALSE;
-
-                       case Types.SMALLINT:
-                               return new Short(getShort(columnIndex));
-
-                       case Types.INTEGER:
-                               return new Integer(getInt(columnIndex));
-
-                       case Types.BIGINT:
-                               return new Long(getLong(columnIndex));
-
-                       case Types.NUMERIC:
-                               return getBigDecimal
-                                          (columnIndex, (field.getMod() == -1) ? -1 : ((field.getMod() - 4) & 0xffff));
-
-                       case Types.REAL:
-                               return new Float(getFloat(columnIndex));
-
-                       case Types.DOUBLE:
-                               return new Double(getDouble(columnIndex));
-
-                       case Types.CHAR:
-                       case Types.VARCHAR:
-                               return getString(columnIndex);
-
-                       case Types.DATE:
-                               return getDate(columnIndex);
-
-                       case Types.TIME:
-                               return getTime(columnIndex);
-
-                       case Types.TIMESTAMP:
-                               return getTimestamp(columnIndex);
-
-                       case Types.BINARY:
-                       case Types.VARBINARY:
-                               return getBytes(columnIndex);
-
-                       case Types.ARRAY:
-                               return getArray(columnIndex);
-
-                       default:
-                               String type = field.getPGType();
-
-                               // if the backend doesn't know the type then coerce to String
-                               if (type.equals("unknown"))
-                               {
-                                       return getString(columnIndex);
-                               }
-                                // Specialized support for ref cursors is neater.
-                                else if (type.equals("refcursor"))
-                                {
-                                        String cursorName = getString(columnIndex);
-                                        return statement.createRefCursorResultSet(cursorName);
-                                }
-                               else
-                               {
-                                       return connection.getObject(field.getPGType(), getString(columnIndex));
-                               }
-               }
-       }
-
-
-       public boolean absolute(int index) throws SQLException
-       {
-               // index is 1-based, but internally we use 0-based indices
-               int internalIndex;
-
-               if (index == 0)
-                       throw new SQLException("Cannot move to index of 0");
-
-               final int rows_size = rows.size();
-
-               //if index<0, count from the end of the result set, but check
-               //to be sure that it is not beyond the first index
-               if (index < 0)
-               {
-                       if (index >= -rows_size)
-                               internalIndex = rows_size + index;
-                       else
-                       {
-                               beforeFirst();
-                               return false;
-                       }
-               }
-               else
-               {
-                       //must be the case that index>0,
-                       //find the correct place, assuming that
-                       //the index is not too large
-                       if (index <= rows_size)
-                               internalIndex = index - 1;
-                       else
-                       {
-                               afterLast();
-                               return false;
-                       }
-               }
-
-               current_row = internalIndex;
-               this_row = (byte[][]) rows.elementAt(internalIndex);
-
-               rowBuffer = new byte[this_row.length][];
-               System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
-
-               return true;
-       }
-
-
-       public void afterLast() throws SQLException
-       {
-               final int rows_size = rows.size();
-               if (rows_size > 0)
-                       current_row = rows_size;
-       }
-
-
-       public void beforeFirst() throws SQLException
-       {
-               if (rows.size() > 0)
-                       current_row = -1;
-       }
-
-
-       public boolean first() throws SQLException
-       {
-               if (rows.size() <= 0)
-                       return false;
-
-               onInsertRow = false;
-               current_row = 0;
-               this_row = (byte[][]) rows.elementAt(current_row);
-
-               rowBuffer = new byte[this_row.length][];
-               System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
-
-               return true;
-       }
-
-
-       public java.sql.Array getArray(String colName) throws SQLException
-       {
-               return getArray(findColumn(colName));
-       }
-
-
-       public java.sql.Array getArray(int i) throws SQLException
-       {
-               checkResultSet( i );
-
-               wasNullFlag = (this_row[i - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               if (i < 1 || i > fields.length)
-                       throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
-               return (java.sql.Array) new org.postgresql.jdbc2.Array( connection, i, fields[i - 1], this );
-       }
-
-
-       public java.math.BigDecimal getBigDecimal(int columnIndex) throws SQLException
-       {
-               return getBigDecimal(columnIndex, -1);
-       }
-
-
-       public java.math.BigDecimal getBigDecimal(String columnName) throws SQLException
-       {
-               return getBigDecimal(findColumn(columnName));
-       }
-
-
-       public Blob getBlob(String columnName) throws SQLException
-       {
-               return getBlob(findColumn(columnName));
-       }
-
-
-       public abstract Blob getBlob(int i) throws SQLException;
-
-
-       public java.io.Reader getCharacterStream(String columnName) throws SQLException
-       {
-               return getCharacterStream(findColumn(columnName));
-       }
-
-
-       public java.io.Reader getCharacterStream(int i) throws SQLException
-       {
-               checkResultSet( i );
-               wasNullFlag = (this_row[i - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               if (((AbstractJdbc2Connection) connection).haveMinimumCompatibleVersion("7.2"))
-               {
-                       //Version 7.2 supports AsciiStream for all the PG text types
-                       //As the spec/javadoc for this method indicate this is to be used for
-                       //large text values (i.e. LONGVARCHAR)  PG doesn't have a separate
-                       //long string datatype, but with toast the text datatype is capable of
-                       //handling very large values.  Thus the implementation ends up calling
-                       //getString() since there is no current way to stream the value from the server
-                       return new CharArrayReader(getString(i).toCharArray());
-               }
-               else
-               {
-                       // In 7.1 Handle as BLOBS so return the LargeObject input stream
-                       Encoding encoding = connection.getEncoding();
-                       InputStream input = getBinaryStream(i);
-                       return encoding.getDecodingReader(input);
-               }
-       }
-
-
-       public Clob getClob(String columnName) throws SQLException
-       {
-               return getClob(findColumn(columnName));
-       }
-
-
-       public abstract Clob getClob(int i) throws SQLException;
-
-
-       public int getConcurrency() throws SQLException
-       {
-               if (statement == null)
-                       return java.sql.ResultSet.CONCUR_READ_ONLY;
-               return statement.getResultSetConcurrency();
-       }
-
-
-       public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException
-       {
-               // If I read the specs, this should use cal only if we don't
-               // store the timezone, and if we do, then act just like getDate()?
-               // for now...
-               return getDate(i);
-       }
-
-
-       public Time getTime(int i, java.util.Calendar cal) throws SQLException
-       {
-               // If I read the specs, this should use cal only if we don't
-               // store the timezone, and if we do, then act just like getTime()?
-               // for now...
-               return getTime(i);
-       }
-
-
-       public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException
-       {
-               // If I read the specs, this should use cal only if we don't
-               // store the timezone, and if we do, then act just like getDate()?
-               // for now...
-               return getTimestamp(i);
-       }
-
-
-       public java.sql.Date getDate(String c, java.util.Calendar cal) throws SQLException
-       {
-               return getDate(findColumn(c), cal);
-       }
-
-
-       public Time getTime(String c, java.util.Calendar cal) throws SQLException
-       {
-               return getTime(findColumn(c), cal);
-       }
-
-
-       public Timestamp getTimestamp(String c, java.util.Calendar cal) throws SQLException
-       {
-               return getTimestamp(findColumn(c), cal);
-       }
-
-
-       public int getFetchDirection() throws SQLException
-       {
-               //PostgreSQL normally sends rows first->last
-               return java.sql.ResultSet.FETCH_FORWARD;
-       }
-
-
-       public Object getObject(String columnName, java.util.Map map) throws SQLException
-       {
-               return getObject(findColumn(columnName), map);
-       }
-
-
-       /*
-        * This checks against map for the type of column i, and if found returns
-        * an object based on that mapping. The class must implement the SQLData
-        * interface.
-        */
-       public Object getObject(int i, java.util.Map map) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-       public Ref getRef(String columnName) throws SQLException
-       {
-               return getRef(findColumn(columnName));
-       }
-
-
-       public Ref getRef(int i) throws SQLException
-       {
-               //The backend doesn't yet have SQL3 REF types
-               throw new PSQLException("postgresql.psqlnotimp", PSQLState.NOT_IMPLEMENTED);
-       }
-
-
-       public int getRow() throws SQLException
-       {
-               final int rows_size = rows.size();
-
-               if (current_row < 0 || current_row >= rows_size)
-                       return 0;
-
-               return current_row + 1;
-       }
-
-
-       // This one needs some thought, as not all ResultSets come from a statement
-       public Statement getStatement() throws SQLException
-       {
-               return (Statement) statement;
-       }
-
-
-       public int getType() throws SQLException
-       {
-               // This implementation allows scrolling but is not able to
-               // see any changes. Sub-classes may overide this to return a more
-               // meaningful result.
-               return java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE;
-       }
-
-
-       public boolean isAfterLast() throws SQLException
-       {
-               final int rows_size = rows.size();
-               return (current_row >= rows_size && rows_size > 0);
-       }
-
-
-       public boolean isBeforeFirst() throws SQLException
-       {
-               return (current_row < 0 && rows.size() > 0);
-       }
-
-
-       public boolean isFirst() throws SQLException
-       {
-               return (current_row == 0 && rows.size() >= 0);
-       }
-
-
-       public boolean isLast() throws SQLException
-       {
-               final int rows_size = rows.size();
-               return (current_row == rows_size - 1 && rows_size > 0);
-       }
-
-
-       public boolean last() throws SQLException
-       {
-               final int rows_size = rows.size();
-               if (rows_size <= 0)
-                       return false;
-
-               current_row = rows_size - 1;
-               this_row = (byte[][]) rows.elementAt(current_row);
-
-               rowBuffer = new byte[this_row.length][];
-               System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
-
-               return true;
-       }
-
-
-       public boolean previous() throws SQLException
-       {
-               if (--current_row < 0)
-                       return false;
-               this_row = (byte[][]) rows.elementAt(current_row);
-               rowBuffer = new byte[this_row.length][];
-               System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
-               return true;
-       }
-
-
-       public boolean relative(int rows) throws SQLException
-       {
-               //have to add 1 since absolute expects a 1-based index
-               return absolute(current_row + 1 + rows);
-       }
-
-
-       public void setFetchDirection(int direction) throws SQLException
-       {
-               throw new PSQLException("postgresql.psqlnotimp", PSQLState.NOT_IMPLEMENTED);
-       }
-
-
-       public synchronized void cancelRowUpdates()
-       throws SQLException
-       {
-               if (doingUpdates)
-               {
-                       doingUpdates = false;
-
-                       clearRowBuffer(true);
-               }
-       }
-
-
-       public synchronized void deleteRow()
-       throws SQLException
-       {
-               if ( !isUpdateable() )
-               {
-                       throw new PSQLException( "postgresql.updateable.notupdateable" );
-               }
-
-               if (onInsertRow)
-               {
-                       throw new PSQLException( "postgresql.updateable.oninsertrow" );
-               }
-
-               if (rows.size() == 0)
-               {
-                       throw new PSQLException( "postgresql.updateable.emptydelete" );
-               }
-               if (isBeforeFirst())
-               {
-                       throw new PSQLException( "postgresql.updateable.beforestartdelete" );
-               }
-               if (isAfterLast())
-               {
-                       throw new PSQLException( "postgresql.updateable.afterlastdelete" );
-               }
-
-
-               int numKeys = primaryKeys.size();
-               if ( deleteStatement == null )
-               {
-
-
-                       StringBuffer deleteSQL = new StringBuffer("DELETE FROM " ).append(tableName).append(" where " );
-
-                       for ( int i = 0; i < numKeys; i++ )
-                       {
-                               deleteSQL.append( ((PrimaryKey) primaryKeys.get(i)).name ).append( " = ? " );
-                               if ( i < numKeys - 1 )
-                               {
-                                       deleteSQL.append( " and " );
-                               }
-                       }
-
-                       deleteStatement = ((java.sql.Connection) connection).prepareStatement(deleteSQL.toString());
-               }
-               deleteStatement.clearParameters();
-
-               for ( int i = 0; i < numKeys; i++ )
-               {
-                       deleteStatement.setObject(i + 1, ((PrimaryKey) primaryKeys.get(i)).getValue());
-               }
-
-
-               deleteStatement.executeUpdate();
-
-               rows.removeElementAt(current_row);
-       }
-
-
-       public synchronized void insertRow()
-       throws SQLException
-       {
-               if ( !isUpdateable() )
-               {
-                       throw new PSQLException( "postgresql.updateable.notupdateable" );
-               }
-
-               if (!onInsertRow)
-               {
-                       throw new PSQLException( "postgresql.updateable.notoninsertrow" );
-               }
-               else
-               {
-
-                       // loop through the keys in the insertTable and create the sql statement
-                       // we have to create the sql every time since the user could insert different
-                       // columns each time
-
-                       StringBuffer insertSQL = new StringBuffer("INSERT INTO ").append(tableName).append(" (");
-                       StringBuffer paramSQL = new StringBuffer(") values (" );
-
-                       Enumeration columnNames = updateValues.keys();
-                       int numColumns = updateValues.size();
-
-                       for ( int i = 0; columnNames.hasMoreElements(); i++ )
-                       {
-                               String columnName = (String) columnNames.nextElement();
-
-                               insertSQL.append( columnName );
-                               if ( i < numColumns - 1 )
-                               {
-                                       insertSQL.append(", ");
-                                       paramSQL.append("?,");
-                               }
-                               else
-                               {
-                                       paramSQL.append("?)");
-                               }
-
-                       }
-
-                       insertSQL.append(paramSQL.toString());
-                       insertStatement = ((java.sql.Connection) connection).prepareStatement(insertSQL.toString());
-
-                       Enumeration keys = updateValues.keys();
-
-                       for ( int i = 1; keys.hasMoreElements(); i++)
-                       {
-                               String key = (String) keys.nextElement();
-                               Object o = updateValues.get(key);
-                               if (o instanceof NullObject)
-                                       insertStatement.setNull(i,java.sql.Types.NULL);
-                               else
-                                       insertStatement.setObject(i, o);
-                       }
-
-                       insertStatement.executeUpdate();
-
-                       if ( usingOID )
-                       {
-                               // we have to get the last inserted OID and put it in the resultset
-
-                               long insertedOID = ((AbstractJdbc2Statement) insertStatement).getLastOID();
-
-                               updateValues.put("oid", new Long(insertedOID) );
-
-                       }
-
-                       // update the underlying row to the new inserted data
-                       updateRowBuffer();
-
-                       rows.addElement(rowBuffer);
-
-                       // we should now reflect the current data in this_row
-                       // that way getXXX will get the newly inserted data
-                       this_row = rowBuffer;
-
-                       // need to clear this in case of another insert
-                       clearRowBuffer(false);
-
-
-               }
-       }
-
-
-       public synchronized void moveToCurrentRow()
-       throws SQLException
-       {
-               if (!updateable)
-               {
-                       throw new PSQLException( "postgresql.updateable.notupdateable" );
-               }
-
-               if (current_row < 0) {
-                       this_row = null;
-                       rowBuffer = null;
-               } else {
-                       this_row = (byte[][]) rows.elementAt(current_row);
-
-                       rowBuffer = new byte[this_row.length][];
-                       System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
-               }
-
-               onInsertRow = false;
-               doingUpdates = false;
-       }
-
-
-       public synchronized void moveToInsertRow()
-       throws SQLException
-       {
-               if ( !isUpdateable() )
-               {
-                       throw new PSQLException( "postgresql.updateable.notupdateable" );
-               }
-
-               if (insertStatement != null)
-               {
-                       insertStatement = null;
-               }
-
-
-               // make sure the underlying data is null
-               clearRowBuffer(false);
-
-               onInsertRow = true;
-               doingUpdates = false;
-
-       }
-
-
-       private synchronized void clearRowBuffer(boolean copyCurrentRow)
-       throws SQLException
-       {
-               // rowBuffer is the temporary storage for the row
-               rowBuffer = new byte[fields.length][];
-
-               // inserts want an empty array while updates want a copy of the current row
-               if (copyCurrentRow) {
-                       System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
-               }
-
-               // clear the updateValues hashTable for the next set of updates
-               updateValues.clear();
-
-       }
-
-
-       public boolean rowDeleted() throws SQLException
-       {
-               // only sub-classes implement CONCURuPDATEABLE
-               throw Driver.notImplemented();
-       }
-
-
-       public boolean rowInserted() throws SQLException
-       {
-               // only sub-classes implement CONCURuPDATEABLE
-               throw Driver.notImplemented();
-       }
-
-
-       public boolean rowUpdated() throws SQLException
-       {
-               // only sub-classes implement CONCURuPDATEABLE
-               throw Driver.notImplemented();
-       }
-
-
-       public synchronized void updateAsciiStream(int columnIndex,
-                       java.io.InputStream x,
-                       int length
-                                                                                         )
-       throws SQLException
-       {
-               byte[] theData = null;
-               try
-               {
-                       x.read(theData, 0, length);
-               }
-               catch (NullPointerException ex )
-               {
-                       throw new PSQLException("postgresql.updateable.inputstream");
-               }
-               catch (IOException ie)
-               {
-                       throw new PSQLException("postgresql.updateable.ioerror", ie);
-               }
-
-               updateValue(columnIndex, theData);
-       }
-
-
-       public synchronized void updateBigDecimal(int columnIndex,
-                       java.math.BigDecimal x )
-       throws SQLException
-       {
-               updateValue(columnIndex, x);
-       }
-
-
-       public synchronized void updateBinaryStream(int columnIndex,
-                       java.io.InputStream x,
-                       int length
-                                                                                          )
-       throws SQLException
-       {
-               byte[] theData = null;
-               try
-               {
-                       x.read(theData, 0, length);
-
-               }
-               catch ( NullPointerException ex )
-               {
-                       throw new PSQLException("postgresql.updateable.inputstream");
-               }
-               catch (IOException ie)
-               {
-                       throw new PSQLException("postgresql.updateable.ioerror", ie);
-               }
-               updateValue(columnIndex, theData);
-       }
-
-
-       public synchronized void updateBoolean(int columnIndex, boolean x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("updating boolean " + fields[columnIndex - 1].getName() + "=" + x);
-               updateValue(columnIndex, new Boolean(x));
-       }
-
-
-       public synchronized void updateByte(int columnIndex, byte x)
-       throws SQLException
-       {
-               updateValue(columnIndex, String.valueOf(x));
-       }
-
-
-       public synchronized void updateBytes(int columnIndex, byte[] x)
-       throws SQLException
-       {
-               updateValue(columnIndex, x);
-       }
-
-
-       public synchronized void updateCharacterStream(int columnIndex,
-                       java.io.Reader x,
-                       int length
-                                                                                                 )
-       throws SQLException
-       {
-               char[] theData = null;
-               try
-               {
-                       x.read(theData, 0, length);
-
-               }
-               catch (NullPointerException ex)
-               {
-                       throw new PSQLException("postgresql.updateable.inputstream");
-               }
-               catch (IOException ie)
-               {
-                       throw new PSQLException("postgresql.updateable.ioerror", ie);
-               }
-               updateValue(columnIndex, theData);
-       }
-
-
-       public synchronized void updateDate(int columnIndex, java.sql.Date x)
-       throws SQLException
-       {
-               updateValue(columnIndex, x);
-       }
-
-
-       public synchronized void updateDouble(int columnIndex, double x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("updating double " + fields[columnIndex - 1].getName() + "=" + x);
-               updateValue(columnIndex, new Double(x));
-       }
-
-
-       public synchronized void updateFloat(int columnIndex, float x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("updating float " + fields[columnIndex - 1].getName() + "=" + x);
-               updateValue(columnIndex, new Float(x));
-       }
-
-
-       public synchronized void updateInt(int columnIndex, int x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("updating int " + fields[columnIndex - 1].getName() + "=" + x);
-               updateValue(columnIndex, new Integer(x));
-       }
-
-
-       public synchronized void updateLong(int columnIndex, long x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("updating long " + fields[columnIndex - 1].getName() + "=" + x);
-               updateValue(columnIndex, new Long(x));
-       }
-
-
-       public synchronized void updateNull(int columnIndex)
-       throws SQLException
-       {
-               updateValue(columnIndex, new NullObject());
-       }
-
-
-       public synchronized void updateObject(int columnIndex, Object x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("updating object " + fields[columnIndex - 1].getName() + " = " + x);
-               updateValue(columnIndex, x);
-       }
-
-
-       public synchronized void updateObject(int columnIndex, Object x, int scale)
-       throws SQLException
-       {
-               if ( !isUpdateable() )
-               {
-                       throw new PSQLException( "postgresql.updateable.notupdateable" );
-               }
-
-               this.updateObject(columnIndex, x);
-
-       }
-
-
-       public void refreshRow() throws SQLException
-       {
-               if ( !isUpdateable() )
-               {
-                       throw new PSQLException( "postgresql.updateable.notupdateable" );
-               }
-
-               try
-               {
-                       StringBuffer selectSQL = new StringBuffer( "select ");
-
-                       final int numColumns = java.lang.reflect.Array.getLength(fields);
-
-                       for (int i = 0; i < numColumns; i++ )
-                       {
-
-                               selectSQL.append( fields[i].getName() );
-
-                               if ( i < numColumns - 1 )
-                               {
-
-                                       selectSQL.append(", ");
-                               }
-
-                       }
-                       selectSQL.append(" from " ).append(tableName).append(" where ");
-
-                       int numKeys = primaryKeys.size();
-
-                       for ( int i = 0; i < numKeys; i++ )
-                       {
-
-                               PrimaryKey primaryKey = ((PrimaryKey) primaryKeys.get(i));
-                               selectSQL.append(primaryKey.name).append("= ?");
-
-                               if ( i < numKeys - 1 )
-                               {
-                                       selectSQL.append(" and ");
-                               }
-                       }
-                       if ( Driver.logDebug )
-                               Driver.debug("selecting " + selectSQL.toString());
-                       selectStatement = ((java.sql.Connection) connection).prepareStatement(selectSQL.toString());
-
-
-                       for ( int j = 0, i = 1; j < numKeys; j++, i++)
-                       {
-                               selectStatement.setObject( i, ((PrimaryKey) primaryKeys.get(j)).getValue() );
-                       }
-
-                       AbstractJdbc2ResultSet rs = (AbstractJdbc2ResultSet) selectStatement.executeQuery();
-
-                       if ( rs.first() )
-                       {
-                               rowBuffer = rs.rowBuffer;
-                       }
-
-                       rows.setElementAt( rowBuffer, current_row );
-                       this_row = rowBuffer;
-                       if ( Driver.logDebug )
-                               Driver.debug("done updates");
-
-                       rs.close();
-                       selectStatement.close();
-                       selectStatement = null;
-
-               }
-               catch (Exception e)
-               {
-                       if ( Driver.logDebug )
-                               Driver.debug(e.getClass().getName() + e);
-                       throw new SQLException( e.getMessage() );
-               }
-
-       }
-
-
-       public synchronized void updateRow()
-       throws SQLException
-       {
-               if ( !isUpdateable() )
-               {
-                       throw new PSQLException( "postgresql.updateable.notupdateable" );
-               }
-
-               if (doingUpdates)
-               {
-
-                       try
-                       {
-
-                               StringBuffer updateSQL = new StringBuffer("UPDATE " + tableName + " SET  ");
-
-                               int numColumns = updateValues.size();
-                               Enumeration columns = updateValues.keys();
-
-                               for (int i = 0; columns.hasMoreElements(); i++ )
-                               {
-
-                                       String column = (String) columns.nextElement();
-                                       updateSQL.append("\"");
-                                       updateSQL.append( column );
-                                       updateSQL.append("\" = ?");
-
-                                       if ( i < numColumns - 1 )
-                                       {
-
-                                               updateSQL.append(", ");
-                                       }
-
-                               }
-                               updateSQL.append( " WHERE " );
-
-                               int numKeys = primaryKeys.size();
-
-                               for ( int i = 0; i < numKeys; i++ )
-                               {
-
-                                       PrimaryKey primaryKey = ((PrimaryKey) primaryKeys.get(i));
-                                       updateSQL.append("\"");
-                                       updateSQL.append(primaryKey.name);
-                                       updateSQL.append("\" = ?");
-
-                                       if ( i < numKeys - 1 )
-                                       {
-                                               updateSQL.append(" and ");
-                                       }
-                               }
-                               if ( Driver.logDebug )
-                                       Driver.debug("updating " + updateSQL.toString());
-                               updateStatement = ((java.sql.Connection) connection).prepareStatement(updateSQL.toString());
-
-                               int i = 0;
-                               Iterator iterator = updateValues.values().iterator();
-                               for (; iterator.hasNext(); i++)
-                               {
-                                       Object o = iterator.next();
-                                       if (o instanceof NullObject)
-                                               updateStatement.setNull(i+1,java.sql.Types.NULL);
-                                       else
-                                               updateStatement.setObject( i + 1, o );
-
-                               }
-                               for ( int j = 0; j < numKeys; j++, i++)
-                               {
-                                       updateStatement.setObject( i + 1, ((PrimaryKey) primaryKeys.get(j)).getValue() );
-                               }
-
-                               updateStatement.executeUpdate();
-                               updateStatement.close();
-
-                               updateStatement = null;
-                               updateRowBuffer();
-
-
-                               if ( Driver.logDebug )
-                                       Driver.debug("copying data");
-                               System.arraycopy(rowBuffer, 0, this_row, 0, rowBuffer.length);
-
-                               rows.setElementAt( rowBuffer, current_row );
-                               if ( Driver.logDebug )
-                                       Driver.debug("done updates");
-                               updateValues.clear();
-                               doingUpdates = false;
-                       }
-                       catch (Exception e)
-                       {
-                               if ( Driver.logDebug )
-                                       Driver.debug(e.getClass().getName() + e);
-                               throw new SQLException( e.getMessage() );
-                       }
-
-               }
-
-       }
-
-
-       public synchronized void updateShort(int columnIndex, short x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("in update Short " + fields[columnIndex - 1].getName() + " = " + x);
-               updateValue(columnIndex, new Short(x));
-       }
-
-
-       public synchronized void updateString(int columnIndex, String x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("in update String " + fields[columnIndex - 1].getName() + " = " + x);
-               updateValue(columnIndex, x);
-       }
-
-
-       public synchronized void updateTime(int columnIndex, Time x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("in update Time " + fields[columnIndex - 1].getName() + " = " + x);
-               updateValue(columnIndex, x);
-       }
-
-
-       public synchronized void updateTimestamp(int columnIndex, Timestamp x)
-       throws SQLException
-       {
-               if ( Driver.logDebug )
-                       Driver.debug("updating Timestamp " + fields[columnIndex - 1].getName() + " = " + x);
-               updateValue(columnIndex, x);
-
-       }
-
-
-       public synchronized void updateNull(String columnName)
-       throws SQLException
-       {
-               updateNull(findColumn(columnName));
-       }
-
-
-       public synchronized void updateBoolean(String columnName, boolean x)
-       throws SQLException
-       {
-               updateBoolean(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateByte(String columnName, byte x)
-       throws SQLException
-       {
-               updateByte(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateShort(String columnName, short x)
-       throws SQLException
-       {
-               updateShort(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateInt(String columnName, int x)
-       throws SQLException
-       {
-               updateInt(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateLong(String columnName, long x)
-       throws SQLException
-       {
-               updateLong(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateFloat(String columnName, float x)
-       throws SQLException
-       {
-               updateFloat(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateDouble(String columnName, double x)
-       throws SQLException
-       {
-               updateDouble(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateBigDecimal(String columnName, BigDecimal x)
-       throws SQLException
-       {
-               updateBigDecimal(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateString(String columnName, String x)
-       throws SQLException
-       {
-               updateString(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateBytes(String columnName, byte x[])
-       throws SQLException
-       {
-               updateBytes(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateDate(String columnName, java.sql.Date x)
-       throws SQLException
-       {
-               updateDate(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateTime(String columnName, java.sql.Time x)
-       throws SQLException
-       {
-               updateTime(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateTimestamp(String columnName, java.sql.Timestamp x)
-       throws SQLException
-       {
-               updateTimestamp(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateAsciiStream(
-               String columnName,
-               java.io.InputStream x,
-               int length)
-       throws SQLException
-       {
-               updateAsciiStream(findColumn(columnName), x, length);
-       }
-
-
-       public synchronized void updateBinaryStream(
-               String columnName,
-               java.io.InputStream x,
-               int length)
-       throws SQLException
-       {
-               updateBinaryStream(findColumn(columnName), x, length);
-       }
-
-
-       public synchronized void updateCharacterStream(
-               String columnName,
-               java.io.Reader reader,
-               int length)
-       throws SQLException
-       {
-               updateCharacterStream(findColumn(columnName), reader, length);
-       }
-
-
-       public synchronized void updateObject(String columnName, Object x, int scale)
-       throws SQLException
-       {
-               updateObject(findColumn(columnName), x);
-       }
-
-
-       public synchronized void updateObject(String columnName, Object x)
-       throws SQLException
-       {
-               updateObject(findColumn(columnName), x);
-       }
-
-
-       /**
-        * Is this ResultSet updateable?
-        */
-
-       boolean isUpdateable() throws SQLException
-       {
-
-               if (updateable)
-                       return true;
-
-               if ( Driver.logDebug )
-                       Driver.debug("checking if rs is updateable");
-
-               parseQuery();
-
-               if ( singleTable == false )
-               {
-                       if ( Driver.logDebug )
-                               Driver.debug("not a single table");
-                       return false;
-               }
-
-               if ( Driver.logDebug )
-                       Driver.debug("getting primary keys");
-
-               //
-               // Contains the primary key?
-               //
-
-               primaryKeys = new Vector();
-
-               // this is not stricty jdbc spec, but it will make things much faster if used
-               // the user has to select oid, * from table and then we will just use oid
-
-
-               usingOID = false;
-               int oidIndex = 0;
-               try {
-                 oidIndex = findColumn( "oid" );
-               } catch (SQLException l_se) {
-                       //Ignore if column oid isn't selected
-               }
-               int i = 0;
-
-
-               // if we find the oid then just use it
-
-               //oidIndex will be >0 if the oid was in the select list
-               if ( oidIndex > 0 )
-               {
-                       i++;
-                       primaryKeys.add( new PrimaryKey( oidIndex, "oid" ) );
-                       usingOID = true;
-               }
-               else
-               {
-                       // otherwise go and get the primary keys and create a hashtable of keys
-                       String[] s = quotelessTableName(tableName);
-                       String quotelessTableName = s[0];
-                       String quotelessSchemaName = s[1];
-                       java.sql.ResultSet rs = ((java.sql.Connection) connection).getMetaData().getPrimaryKeys("", quotelessSchemaName, quotelessTableName);
-                       for (; rs.next(); i++ )
-                       {
-                               String columnName = rs.getString(4);    // get the columnName
-                               int index = findColumn( columnName );
-
-                               if ( index > 0 )
-                               {
-                                       primaryKeys.add( new PrimaryKey(index, columnName ) ); // get the primary key information
-                               }
-                       }
-
-                       rs.close();
-               }
-
-               numKeys = primaryKeys.size();
-
-               if ( Driver.logDebug )
-                       Driver.debug( "no of keys=" + i );
-
-               if ( i < 1 )
-               {
-                       throw new SQLException("No Primary Keys");
-               }
-
-               updateable = primaryKeys.size() > 0;
-
-               if ( Driver.logDebug )
-                       Driver.debug( "checking primary key " + updateable );
-
-               return updateable;
-       }
-
-       /** Cracks out the table name and schema (if it exists) from a fully
-        * qualified table name.
-        * @param fullname string that we are trying to crack.  Test cases:<pre>
-        * Table: table ()
-        * "Table": Table ()
-        * Schema.Table: table (schema)
-        * "Schema"."Table": Table (Schema)
-        * "Schema"."Dot.Table": Dot.Table (Schema)
-        * Schema."Dot.Table": Dot.Table (schema)
-        * </pre>
-        * @return String array with element zero always being the tablename and
-        * element 1 the schema name which may be a zero length string.
-        */
-       public static String[] quotelessTableName(String fullname) {
-               StringBuffer buf = new StringBuffer(fullname);
-               String[] parts = new String[] {null, ""};
-               StringBuffer acc = new StringBuffer();
-               boolean betweenQuotes = false;
-               for (int i = 0; i < buf.length(); i++) {
-                       char c = buf.charAt(i);
-                       switch (c) {
-                               case '"':
-                                       if ((i < buf.length() - 1) && (buf.charAt(i+1) == '"')) {
-                                               // two consecutive quotes - keep one
-                                               i++;
-                                               acc.append(c);  // keep the quote
-                                       }
-                                       else {  // Discard it
-                                               betweenQuotes = !betweenQuotes;
-                                       }
-                                       break;
-                               case '.':
-                                       if (betweenQuotes) {   // Keep it
-                                               acc.append(c);
-                                       }
-                                       else {     // Have schema name
-                                               parts[1] = acc.toString();
-                                               acc = new StringBuffer();
-                                       }
-                                       break;
-                               default:
-                                       acc.append((betweenQuotes) ? c : Character.toLowerCase(c));
-                                       break;
-                       }
-               }
-               // Always put table in slot 0
-               parts[0] = acc.toString();
-               return parts;
-       }
-       public void parseQuery()
-       {
-               String[] l_sqlFragments = ((AbstractJdbc2Statement)statement).getSqlFragments();
-               String l_sql = l_sqlFragments[0];
-               StringTokenizer st = new StringTokenizer(l_sql, " \r\t\n");
-               boolean tableFound = false, tablesChecked = false;
-               String name = "";
-
-               singleTable = true;
-
-               while ( !tableFound && !tablesChecked && st.hasMoreTokens() )
-               {
-                       name = st.nextToken();
-                       if ( !tableFound )
-                       {
-                               if (name.toLowerCase().equals("from"))
-                               {
-                                       tableName = st.nextToken();
-                                       tableFound = true;
-                               }
-                       }
-                       else
-                       {
-                               tablesChecked = true;
-                               // if the very next token is , then there are multiple tables
-                               singleTable = !name.equalsIgnoreCase(",");
-                       }
-               }
-       }
-
-
-       private void updateRowBuffer() throws SQLException
-       {
-
-               Enumeration columns = updateValues.keys();
-
-               while ( columns.hasMoreElements() )
-               {
-                       String columnName = (String) columns.nextElement();
-                       int columnIndex = findColumn( columnName ) - 1;
-
-                       Object valueObject = updateValues.get(columnName);
-                       if (valueObject instanceof NullObject) {
-                               rowBuffer[columnIndex] = null;
-                       }
-                       else
-                       {
-                               
-                               switch ( connection.getSQLType( fields[columnIndex].getPGType() ) )
-                               {
-
-                                       case Types.DECIMAL:
-                                       case Types.BIGINT:
-                                       case Types.DOUBLE:
-                                       case Types.BIT:
-                                       case Types.VARCHAR:
-                                       case Types.DATE:
-                                       case Types.TIME:
-                                       case Types.TIMESTAMP:
-                                       case Types.SMALLINT:
-                                       case Types.FLOAT:
-                                       case Types.INTEGER:
-                                       case Types.CHAR:
-                                       case Types.NUMERIC:
-                                       case Types.REAL:
-                                       case Types.TINYINT:
-
-                                               rowBuffer[columnIndex] = connection.getEncoding().encode(String.valueOf( valueObject));
-
-                                       case Types.NULL:
-                                               continue;
-
-                                       default:
-                                               rowBuffer[columnIndex] = (byte[]) valueObject;
-                               }
-
-                       }
-               }
-       }
-
-
-       public void setStatement(BaseStatement statement)
-       {
-               this.statement = statement;
-       }
-
-       protected void updateValue(int columnIndex, Object value) throws SQLException {
-               if ( !isUpdateable() )
-               {
-                       throw new PSQLException( "postgresql.updateable.notupdateable" );
-               }
-               doingUpdates = !onInsertRow;
-               if (value == null)
-                       updateNull(columnIndex);
-               else
-                       updateValues.put(fields[columnIndex - 1].getName(), value);
-       }
-
-       private class PrimaryKey
-       {
-               int index;                              // where in the result set is this primaryKey
-               String name;                    // what is the columnName of this primary Key
-
-               PrimaryKey( int index, String name)
-               {
-                       this.index = index;
-                       this.name = name;
-               }
-               Object getValue() throws SQLException
-               {
-                       return getObject(index);
-               }
-       };
-
-       class NullObject {
-       };
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
deleted file mode 100644 (file)
index d65634a..0000000
+++ /dev/null
@@ -1,553 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-import org.postgresql.core.Field;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Vector;
-
-public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc1.AbstractJdbc1ResultSetMetaData
-{
-
-       /*
-        *      Initialise for a result with a tuple set and
-        *      a field descriptor set
-        *
-        * @param rows the Vector of rows returned by the ResultSet
-        * @param fields the array of field descriptors
-        */
-       public AbstractJdbc2ResultSetMetaData(Vector rows, Field[] fields)
-       {
-               super(rows, fields);
-       }
-
-       /*
-        * Whats the number of columns in the ResultSet?
-        *
-        * @return the number
-        * @exception SQLException if a database access error occurs
-        */
-       public int getColumnCount() throws SQLException
-       {
-               return fields.length;
-       }
-
-       /*
-        * Is the column automatically numbered (and thus read-only)
-        * I believe that PostgreSQL does not support this feature.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isAutoIncrement(int column) throws SQLException
-       {
-               return false;
-       }
-
-       /*
-        * Does a column's case matter? ASSUMPTION: Any field that is
-        * not obviously case insensitive is assumed to be case sensitive
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isCaseSensitive(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               switch (sql_type)
-               {
-                       case Types.SMALLINT:
-                       case Types.INTEGER:
-                       case Types.FLOAT:
-                       case Types.REAL:
-                       case Types.DOUBLE:
-                       case Types.DATE:
-                       case Types.TIME:
-                       case Types.TIMESTAMP:
-                               return false;
-                       default:
-                               return true;
-               }
-       }
-
-       /*
-        * Can the column be used in a WHERE clause?  Basically for
-        * this, I split the functions into two types: recognised
-        * types (which are always useable), and OTHER types (which
-        * may or may not be useable).  The OTHER types, for now, I
-        * will assume they are useable.  We should really query the
-        * catalog to see if they are useable.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if they can be used in a WHERE clause
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isSearchable(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               // This switch is pointless, I know - but it is a set-up
-               // for further expansion.
-               switch (sql_type)
-               {
-                       case Types.OTHER:
-                               return true;
-                       default:
-                               return true;
-               }
-       }
-
-       /*
-        * Is the column a cash value?  6.1 introduced the cash/money
-        * type, which haven't been incorporated as of 970414, so I
-        * just check the type name for both 'cash' and 'money'
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if its a cash column
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isCurrency(int column) throws SQLException
-       {
-               String type_name = getField(column).getPGType();
-
-               return type_name.equals("cash") || type_name.equals("money");
-       }
-
-       /*
-        * Indicates the nullability of values in the designated column.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return one of the columnNullable values
-        * @exception SQLException if a database access error occurs
-        */
-       public int isNullable(int column) throws SQLException
-       {
-               /*
-                * TODO This needs a real implementation, taking into account columns
-                * defined with NOT NULL or PRIMARY KEY, CHECK constraints, views,
-                * functions etc.
-                */
-               return java.sql.ResultSetMetaData.columnNullableUnknown;
-       }
-
-       /*
-        * Is the column a signed number? In PostgreSQL, all numbers
-        * are signed, so this is trivial.      However, strings are not
-        * signed (duh!)
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isSigned(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               switch (sql_type)
-               {
-                       case Types.SMALLINT:
-                       case Types.INTEGER:
-                       case Types.FLOAT:
-                       case Types.REAL:
-                       case Types.DOUBLE:
-                               return true;
-                       case Types.DATE:
-                       case Types.TIME:
-                       case Types.TIMESTAMP:
-                               return false;   // I don't know about these?
-                       default:
-                               return false;
-               }
-       }
-
-       /*
-        * What is the column's normal maximum width in characters?
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the maximum width
-        * @exception SQLException if a database access error occurs
-        */
-       public int getColumnDisplaySize(int column) throws SQLException
-       {
-               Field f = getField(column);
-               String type_name = f.getPGType();
-               int typmod = f.getMod();
-
-               // I looked at other JDBC implementations and couldn't find a consistent
-               // interpretation of the "display size" for numeric values, so this is our's
-               // FIXME: currently, only types with a SQL92 or SQL3 pendant are implemented - jens@jens.de
-
-               // fixed length data types
-               if (type_name.equals( "int2" ))
-                       return 6;  // -32768 to +32768 (5 digits and a sign)
-               if (type_name.equals( "int4" )
-                               || type_name.equals( "oid" ))
-                       return 11; // -2147483648 to +2147483647
-               if (type_name.equals( "int8" ))
-                       return 20; // -9223372036854775808 to +9223372036854775807
-               if (type_name.equals( "money" ))
-                       return 12; // MONEY = DECIMAL(9,2)
-               if (type_name.equals( "float4" ))
-                       return 11; // i checked it out ans wasn't able to produce more than 11 digits
-               if (type_name.equals( "float8" ))
-                       return 20; // dito, 20
-               if (type_name.equals( "char" ))
-                       return 1;
-               if (type_name.equals( "bool" ))
-                       return 1;
-               if (type_name.equals( "date" ))
-                       return 14; // "01/01/4713 BC" - "31/12/32767 AD"
-               if (type_name.equals( "time" ))
-                       return 8;  // 00:00:00-23:59:59
-               if (type_name.equals( "timestamp" ))
-                       return 22; // hhmmm ... the output looks like this: 1999-08-03 22:22:08+02
-
-               // variable length fields
-               typmod -= 4;
-               if (type_name.equals( "bpchar" )
-                               || type_name.equals( "varchar" ))
-                       return typmod; // VARHDRSZ=sizeof(int32)=4
-               if (type_name.equals( "numeric" ))
-                       return ( (typmod >> 16) & 0xffff )
-                                  + 1 + ( typmod & 0xffff ); // DECIMAL(p,s) = (p digits).(s digits)
-
-               // if we don't know better
-               return f.getLength();
-       }
-
-       /*
-        * What is the suggested column title for use in printouts and
-        * displays?  We suggest the ColumnName!
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the column label
-        * @exception SQLException if a database access error occurs
-        */
-       public String getColumnLabel(int column) throws SQLException
-       {
-               return getColumnName(column);
-       }
-
-       /*
-        * What's a column's name?
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the column name
-        * @exception SQLException if a database access error occurs
-        */
-       public String getColumnName(int column) throws SQLException
-       {
-               Field f = getField(column);
-               if (f != null)
-                       return f.getName();
-               return "field" + column;
-       }
-
-       /*
-        * What is a column's table's schema?  This relies on us knowing
-        * the table name....which I don't know how to do as yet.  The 
-        * JDBC specification allows us to return "" if this is not
-        * applicable.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return the Schema
-        * @exception SQLException if a database access error occurs
-        */
-       public String getSchemaName(int column) throws SQLException
-       {
-               return "";
-       }
-
-       /*
-        * What is a column's number of decimal digits.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return the precision
-        * @exception SQLException if a database access error occurs
-        */
-       public int getPrecision(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               switch (sql_type)
-               {
-                       case Types.SMALLINT:
-                               return 5;
-                       case Types.INTEGER:
-                               return 10;
-                       case Types.REAL:
-                               return 8;
-                       case Types.FLOAT:
-                               return 16;
-                       case Types.DOUBLE:
-                               return 16;
-                       case Types.VARCHAR:
-                               return 0;
-                       case Types.NUMERIC:
-                               Field f = getField(column);
-                               if (f != null)
-                                       return ((0xFFFF0000)&f.getMod()) >> 16;
-                               else
-                                       return 0;
-                       default:
-                               return 0;
-               }
-       }
-
-       /*
-        * What is a column's number of digits to the right of the
-        * decimal point?
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return the scale
-        * @exception SQLException if a database access error occurs
-        */
-       public int getScale(int column) throws SQLException
-       {
-               int sql_type = getField(column).getSQLType();
-
-               switch (sql_type)
-               {
-                       case Types.SMALLINT:
-                               return 0;
-                       case Types.INTEGER:
-                               return 0;
-                       case Types.REAL:
-                               return 8;
-                       case Types.FLOAT:
-                               return 16;
-                       case Types.DOUBLE:
-                               return 16;
-                       case Types.VARCHAR:
-                               return 0;
-                       case Types.NUMERIC:
-                               Field f = getField(column);
-                               if (f != null)
-                                       return (((0x0000FFFF)&f.getMod()) - 4);
-                               else
-                                       return 0;
-                       default:
-                               return 0;
-               }
-       }
-
-       /*
-        * Whats a column's table's name?  How do I find this out?      Both
-        * getSchemaName() and getCatalogName() rely on knowing the table
-        * Name, so we need this before we can work on them.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return column name, or "" if not applicable
-        * @exception SQLException if a database access error occurs
-        */
-       public String getTableName(int column) throws SQLException
-       {
-               return "";
-       }
-
-       /*
-        * What's a column's table's catalog name?  As with getSchemaName(),
-        * we can say that if getTableName() returns n/a, then we can too -
-        * otherwise, we need to work on it.
-        *
-        * @param column the first column is 1, the second is 2...
-        * @return catalog name, or "" if not applicable
-        * @exception SQLException if a database access error occurs
-        */
-       public String getCatalogName(int column) throws SQLException
-       {
-               return "";
-       }
-
-       /*
-        * What is a column's SQL Type? (java.sql.Type int)
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the java.sql.Type value
-        * @exception SQLException if a database access error occurs
-        * @see org.postgresql.Field#getSQLType
-        * @see java.sql.Types
-        */
-       public int getColumnType(int column) throws SQLException
-       {
-               return getField(column).getSQLType();
-       }
-
-       /*
-        * Whats is the column's data source specific type name?
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return the type name
-        * @exception SQLException if a database access error occurs
-        */
-       public String getColumnTypeName(int column) throws SQLException
-       {
-               return getField(column).getPGType();
-       }
-
-       /**
-        * Is the column definitely not writable?  In reality, we would
-        * have to check the GRANT/REVOKE stuff for this to be effective,
-        * and I haven't really looked into that yet, so this will get
-        * re-visited.
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isReadOnly(int column) throws SQLException
-       {
-               return false;
-       }
-
-       /**
-        * Is it possible for a write on the column to succeed?  Again, we
-        * would in reality have to check the GRANT/REVOKE stuff, which
-        * I haven't worked with as yet.  However, if it isn't ReadOnly, then
-        * it is obviously writable.
-        *
-        * @param column the first column is 1, the second is 2, etc.
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isWritable(int column) throws SQLException
-       {
-               return !isReadOnly(column);
-       }
-
-       /**
-        * Will a write on this column definately succeed?      Hmmm...this
-        * is a bad one, since the two preceding functions have not been
-        * really defined.      I cannot tell is the short answer.      I thus
-        * return isWritable() just to give us an idea.
-        *
-        * @param column the first column is 1, the second is 2, etc..
-        * @return true if so
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean isDefinitelyWritable(int column) throws SQLException
-       {
-               return false;
-       }
-
-       // ********************************************************
-       //      END OF PUBLIC INTERFACE
-       // ********************************************************
-
-       /**
-        * For several routines in this package, we need to convert
-        * a columnIndex into a Field[] descriptor.  Rather than do
-        * the same code several times, here it is.
-        *
-        * @param columnIndex the first column is 1, the second is 2...
-        * @return the Field description
-        * @exception SQLException if a database access error occurs
-        */
-       private Field getField(int columnIndex) throws SQLException
-       {
-               if (columnIndex < 1 || columnIndex > fields.length)
-                       throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
-               return fields[columnIndex - 1];
-       }
-
-       // ** JDBC 2 Extensions **
-
-       // This can hook into our PG_Object mechanism
-       /**
-        * Returns the fully-qualified name of the Java class whose instances
-        * are manufactured if the method <code>ResultSet.getObject</code>
-        * is called to retrieve a value from the column.
-        *
-        * <code>ResultSet.getObject</code> may return a subclass of the class
-        * returned by this method.
-        *
-        * @param column the first column is 1, the second is 2, ...
-        * @return the fully-qualified name of the class in the Java programming
-        *                 language that would be used by the method
-        *                 <code>ResultSet.getObject</code> to retrieve the value in the specified
-        *                 column. This is the class name used for custom mapping.
-        * @exception SQLException if a database access error occurs
-        */
-       public String getColumnClassName(int column) throws SQLException
-       {
-               /*
-                       The following data type mapping came from ../Field.java.
-
-                       "int2",
-                       "int4","oid",
-                       "int8",
-                       "cash","money",
-                       "numeric",
-                       "float4",
-                       "float8",
-                       "bpchar","char","char2","char4","char8","char16",
-                       "varchar","text","name","filename",
-                       "bool",
-                       "date",
-                       "time",
-                       "abstime","timestamp"
-
-                       Types.SMALLINT,
-                       Types.INTEGER,Types.INTEGER,
-                       Types.BIGINT,
-                       Types.DOUBLE,Types.DOUBLE,
-                       Types.NUMERIC,
-                       Types.REAL,
-                       Types.DOUBLE,
-                       Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,Types.CHAR,
-                       Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,
-                       Types.BIT,
-                       Types.DATE,
-                       Types.TIME,
-                       Types.TIMESTAMP,Types.TIMESTAMP
-               */
-
-               Field field = getField(column);
-               int sql_type = field.getSQLType();
-
-               switch (sql_type)
-               {
-                       case Types.BIT:
-                               return ("java.lang.Boolean");
-                       case Types.SMALLINT:
-                               return ("java.lang.Short");
-                       case Types.INTEGER:
-                               return ("java.lang.Integer");
-                       case Types.BIGINT:
-                               return ("java.lang.Long");
-                       case Types.NUMERIC:
-                               return ("java.math.BigDecimal");
-                       case Types.REAL:
-                               return ("java.lang.Float");
-                       case Types.DOUBLE:
-                               return ("java.lang.Double");
-                       case Types.CHAR:
-                       case Types.VARCHAR:
-                               return ("java.lang.String");
-                       case Types.DATE:
-                               return ("java.sql.Date");
-                       case Types.TIME:
-                               return ("java.sql.Time");
-                       case Types.TIMESTAMP:
-                               return ("java.sql.Timestamp");
-                       case Types.BINARY:
-                       case Types.VARBINARY:
-                               return ("[B");
-                       case Types.ARRAY:
-                               return ("java.sql.Array");
-                       default:
-                               String type = field.getPGType();
-                               if ("unknown".equals(type))
-                               {
-                                       return ("java.lang.String");
-                               }
-                               return ("java.lang.Object");
-               }
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
deleted file mode 100644 (file)
index d96f0f9..0000000
+++ /dev/null
@@ -1,434 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-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;
-import org.postgresql.util.PSQLState;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v 1.18 2003/11/29 19:52:10 pgsql 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
- */
-public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.AbstractJdbc1Statement
-{
-
-       protected Vector batch = null;
-       protected int resultsettype;             // the resultset type to return
-       protected int concurrency;               // is it updateable or not?
-
-       public AbstractJdbc2Statement (AbstractJdbc2Connection c)
-       {
-               super(c);
-               resultsettype = ResultSet.TYPE_SCROLL_INSENSITIVE;
-               concurrency = ResultSet.CONCUR_READ_ONLY;
-       }
-
-       public AbstractJdbc2Statement(AbstractJdbc2Connection connection, String sql) throws SQLException
-       {
-               super(connection, sql);
-       }
-
-       /*
-        * Execute a SQL statement that may return multiple results. We
-        * don't have to worry about this since we do not support multiple
-        * ResultSets.   You can use getResultSet or getUpdateCount to
-        * retrieve the result.
-        *
-        * @param sql any SQL statement
-        * @return true if the next result is a ResulSet, false if it is
-        *      an update count or there are no more results
-        * @exception SQLException if a database access error occurs
-        */
-       public boolean execute() throws SQLException
-       {
-               boolean l_return = super.execute();
-               //Now do the jdbc2 specific stuff
-               //required for ResultSet.getStatement() to work and updateable resultsets
-               result.setStatement(this);
-
-               return l_return;
-       }
-
-       // ** JDBC 2 Extensions **
-
-       public void addBatch(String p_sql) throws SQLException
-       {
-               if (batch == null)
-                       batch = new Vector();
-        Object[] l_statement = new Object[] {new String[] {p_sql}, new Object[0], new String[0]};
-               batch.addElement(l_statement);
-       }
-
-       public void clearBatch() throws SQLException
-       {
-               batch = null;
-       }
-
-       public int[] executeBatch() throws SQLException
-       {
-               if (batch == null)
-                       batch = new Vector();
-               int size = batch.size();
-               int[] result = new int[size];
-               int i = 0;
-               try
-               {
-            //copy current state of statement
-                       String[] l_origSqlFragments = m_sqlFragments;
-                       Object[] l_origBinds = m_binds;
-                       String[] l_origBindTypes = m_bindTypes;
-
-                       for (i = 0;i < size;i++) {
-                               //set state from batch
-                               Object[] l_statement = (Object[])batch.elementAt(i);
-                               this.m_sqlFragments = (String[])l_statement[0];
-                               this.m_binds = (Object[])l_statement[1];
-                               this.m_bindTypes = (String[])l_statement[2];
-                               result[i] = this.executeUpdate();
-                       }
-
-                       //restore state of statement
-                       m_sqlFragments = l_origSqlFragments;
-                       m_binds = l_origBinds;
-                       m_bindTypes = l_origBindTypes;
-
-               }
-               catch (SQLException e)
-               {
-                       int[] resultSucceeded = new int[i];
-                       System.arraycopy(result, 0, resultSucceeded, 0, i);
-
-                       PBatchUpdateException updex =
-                               new PBatchUpdateException("postgresql.stat.batch.error",
-                                                                                 new Integer(i), m_sqlFragments[0], resultSucceeded);
-                       updex.setNextException(e);
-
-                       throw updex;
-               }
-               finally
-               {
-                       batch.removeAllElements();
-               }
-               return result;
-       }
-
-       public void cancel() throws SQLException
-       {
-               connection.cancelQuery();
-       }
-
-       public Connection getConnection() throws SQLException
-       {
-               return (Connection) connection;
-       }
-
-       public int getFetchDirection() throws SQLException
-       {
-               throw new PSQLException("postgresql.psqlnotimp", PSQLState.NOT_IMPLEMENTED);
-       }
-
-       public int getResultSetConcurrency() throws SQLException
-       {
-               return concurrency;
-       }
-
-       public int getResultSetType() throws SQLException
-       {
-               return resultsettype;
-       }
-
-       public void setFetchDirection(int direction) throws SQLException
-       {
-               // I don't think this should happen, since it's a hint it should just
-               // fail quietly.
-               //   throw Driver.notImplemented();
-       }
-
-       public void setFetchSize(int rows) throws SQLException
-       {
-               if (rows<0) throw new PSQLException("postgresql.input.fetch.gt0");
-               super.fetchSize = rows;
-       }
-
-       public void setResultSetConcurrency(int value) throws SQLException
-       {
-               concurrency = value;
-       }
-
-       public void setResultSetType(int value) throws SQLException
-       {
-               resultsettype = value;
-       }
-
-       public void addBatch() throws SQLException
-       {
-               if (batch == null)
-                       batch = new Vector();
-
-               //we need to create copies, otherwise the values can be changed
-               Object[] l_newSqlFragments = null;
-               if (m_sqlFragments != null) { 
-                       l_newSqlFragments = new String[m_sqlFragments.length];
-                       System.arraycopy(m_sqlFragments,0,l_newSqlFragments,0,m_sqlFragments.length);
-               }
-               Object[] l_newBinds = new Object[m_binds.length];
-        System.arraycopy(m_binds,0,l_newBinds,0,m_binds.length);
-               String[] l_newBindTypes = new String[m_bindTypes.length];
-        System.arraycopy(m_bindTypes,0,l_newBindTypes,0,m_bindTypes.length);
-        Object[] l_statement = new Object[] {l_newSqlFragments, l_newBinds, l_newBindTypes};
-               batch.addElement(l_statement);
-       }
-
-       public ResultSetMetaData getMetaData() throws SQLException
-       {
-               ResultSet rs = getResultSet();
-               if (rs != null)
-                       return rs.getMetaData();
-
-               // Does anyone really know what this method does?
-               return null;
-       }
-
-       public void setArray(int i, java.sql.Array x) throws SQLException
-       {
-               setString(i, x.toString());
-       }
-
-       public void setBlob(int i, Blob x) throws SQLException
-       {
-               InputStream l_inStream = x.getBinaryStream();
-               LargeObjectManager lom = connection.getLargeObjectAPI();
-               int oid = lom.create();
-               LargeObject lob = lom.open(oid);
-               OutputStream los = lob.getOutputStream();
-               byte[] buf = new byte[4096];
-               try
-               {
-                       // could be buffered, but then the OutputStream returned by LargeObject
-                       // is buffered internally anyhow, so there would be no performance
-                       // boost gained, if anything it would be worse!
-                       int bytesRemaining = (int)x.length();
-                       int numRead = l_inStream.read(buf, 0, Math.min(buf.length, bytesRemaining));
-                       while (numRead != -1 && bytesRemaining > 0)
-                       {
-                               bytesRemaining -= numRead;
-                               if ( numRead == buf.length )
-                                       los.write(buf); // saves a buffer creation and copy in LargeObject since it's full
-                               else
-                                       los.write(buf,0,numRead);
-                               numRead = l_inStream.read(buf, 0, Math.min(buf.length, bytesRemaining));
-                       }
-               }
-               catch (IOException se)
-               {
-                       throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, se);
-               }
-               finally
-               {
-                       try
-                       {
-                               los.close();
-                l_inStream.close();
-            }
-            catch( Exception e ) {}
-               }
-               setInt(i, oid);
-       }
-
-       public void setCharacterStream(int i, java.io.Reader x, int length) throws SQLException
-       {
-               if (connection.haveMinimumCompatibleVersion("7.2"))
-               {
-                       //Version 7.2 supports CharacterStream for for the PG text types
-                       //As the spec/javadoc for this method indicate this is to be used for
-                       //large text values (i.e. LONGVARCHAR)  PG doesn't have a separate
-                       //long varchar datatype, but with toast all the text datatypes are capable of
-                       //handling very large values.  Thus the implementation ends up calling
-                       //setString() since there is no current way to stream the value to the server
-                       char[] l_chars = new char[length];
-                       int l_charsRead;
-                       try
-                       {
-                               l_charsRead = x.read(l_chars, 0, length);
-                       }
-                       catch (IOException l_ioe)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, l_ioe);
-                       }
-                       setString(i, new String(l_chars, 0, l_charsRead));
-               }
-               else
-               {
-                       //Version 7.1 only supported streams for LargeObjects
-                       //but the jdbc spec indicates that streams should be
-                       //available for LONGVARCHAR instead
-                       LargeObjectManager lom = connection.getLargeObjectAPI();
-                       int oid = lom.create();
-                       LargeObject lob = lom.open(oid);
-                       OutputStream los = lob.getOutputStream();
-                       try
-                       {
-                               // could be buffered, but then the OutputStream returned by LargeObject
-                               // is buffered internally anyhow, so there would be no performance
-                               // boost gained, if anything it would be worse!
-                               int c = x.read();
-                               int p = 0;
-                               while (c > -1 && p < length)
-                               {
-                                       los.write(c);
-                                       c = x.read();
-                                       p++;
-                               }
-                               los.close();
-                       }
-                       catch (IOException se)
-                       {
-                               throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, se);
-                       }
-                       // lob is closed by the stream so don't call lob.close()
-                       setInt(i, oid);
-               }
-       }
-
-       public void setClob(int i, Clob x) throws SQLException
-       {
-               InputStream l_inStream = x.getAsciiStream();
-               int l_length = (int) x.length();
-               LargeObjectManager lom = connection.getLargeObjectAPI();
-               int oid = lom.create();
-               LargeObject lob = lom.open(oid);
-               OutputStream los = lob.getOutputStream();
-               try
-               {
-                       // could be buffered, but then the OutputStream returned by LargeObject
-                       // is buffered internally anyhow, so there would be no performance
-                       // boost gained, if anything it would be worse!
-                       int c = l_inStream.read();
-                       int p = 0;
-                       while (c > -1 && p < l_length)
-                       {
-                               los.write(c);
-                               c = l_inStream.read();
-                               p++;
-                       }
-                       los.close();
-               }
-               catch (IOException se)
-               {
-                       throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, se);
-               }
-               // lob is closed by the stream so don't call lob.close()
-               setInt(i, oid);
-       }
-
-       public void setNull(int i, int t, String s) throws SQLException
-       {
-               setNull(i, t);
-       }
-
-       public void setRef(int i, Ref x) throws SQLException
-       {
-               throw Driver.notImplemented();
-       }
-
-       public void setDate(int i, java.sql.Date d, java.util.Calendar cal) throws SQLException
-       {
-               if (cal == null)
-                       setDate(i, d);
-               else
-               {
-                       cal.setTime(d);
-                       setDate(i, new java.sql.Date(cal.getTime().getTime()));
-               }
-       }
-
-       public void setTime(int i, Time t, java.util.Calendar cal) throws SQLException
-       {
-               if (cal == null)
-                       setTime(i, t);
-               else
-               {
-                       cal.setTime(t);
-                       setTime(i, new java.sql.Time(cal.getTime().getTime()));
-               }
-       }
-
-       public void setTimestamp(int i, Timestamp t, java.util.Calendar cal) throws SQLException
-       {
-               if (cal == null)
-                       setTimestamp(i, t);
-               else
-               {
-                       cal.setTime(t);
-                       setTimestamp(i, new java.sql.Timestamp(cal.getTime().getTime()));
-               }
-       }
-
-       // ** JDBC 2 Extensions for CallableStatement**
-
-       public java.sql.Array getArray(int i) throws SQLException
-       {
-               throw 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 Driver.notImplemented();
-       }
-
-       public Clob getClob(int i) throws SQLException
-       {
-               throw Driver.notImplemented();
-       }
-
-       public Object getObject(int i, java.util.Map map) throws SQLException
-       {
-               throw Driver.notImplemented();
-       }
-
-       public Ref getRef(int i) throws SQLException
-       {
-               throw Driver.notImplemented();
-       }
-
-       public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException
-       {
-               throw Driver.notImplemented();
-       }
-
-       public Time getTime(int i, java.util.Calendar cal) throws SQLException
-       {
-               throw Driver.notImplemented();
-       }
-
-       public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException
-       {
-               throw Driver.notImplemented();
-       }
-
-       // no custom types allowed yet..
-       public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException
-       {
-               throw Driver.notImplemented();
-       }
-
-
-       //This is needed by AbstractJdbc2ResultSet to determine if the query is updateable or not
-       protected String[] getSqlFragments()
-       {
-               return m_sqlFragments;
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
deleted file mode 100644 (file)
index e38b0c9..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-package org.postgresql.jdbc2;
-
-import org.postgresql.core.BaseConnection;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-import org.postgresql.util.PSQLException;
-import org.postgresql.util.PSQLState;
-
-import java.math.BigDecimal;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Vector;
-
-/*
- * Array is used collect one column of query result data.
- *
- * <p>Read a field of type Array into either a natively-typed
- * Java array object or a ResultSet.  Accessor methods provide
- * the ability to capture array slices.
- *
- * <p>Other than the constructor all methods are direct implementations
- * of those specified for java.sql.Array.  Please refer to the javadoc
- * for java.sql.Array for detailed descriptions of the functionality
- * and parameters of the methods of this class.
- *
- * @see ResultSet#getArray
- */
-
-
-public class Array implements java.sql.Array
-{
-       private BaseConnection conn = null;
-       private Field field = null;
-       private BaseResultSet rs;
-       private int idx = 0;
-       private String rawString = null;
-
-       /*
-        * Create a new Array
-        *
-        * @param conn a database connection
-        * @param idx 1-based index of the query field to load into this 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(BaseConnection conn, int idx, Field field, BaseResultSet rs )
-       throws SQLException
-       {
-               this.conn = conn;
-               this.field = field;
-               this.rs = rs;
-               this.idx = idx;
-               this.rawString = rs.getFixedString(idx);
-       }
-
-       public Object getArray() throws SQLException
-       {
-               return getArray( 1, 0, null );
-       }
-
-       public Object getArray(long index, int count) throws SQLException
-       {
-               return getArray( index, count, null );
-       }
-
-       public Object getArray(Map map) throws SQLException
-       {
-               return getArray( 1, 0, map );
-       }
-
-       public Object getArray(long index, int count, Map map) throws SQLException
-       {
-               if ( map != null ) // For now maps aren't supported.
-                       throw org.postgresql.Driver.notImplemented();
-
-               if (index < 1)
-                       throw new PSQLException("postgresql.arr.range", PSQLState.DATA_ERROR);
-               Object retVal = null;
-
-               ArrayList array = new ArrayList();
-
-               /* Check if the String is also not an empty array
-                                          * otherwise there will be an exception thrown below
-                                          * in the ResultSet.toX with an empty string.
-                                          * -- Doug Fields <dfields-pg-jdbc@pexicom.com> Feb 20, 2002 */
-
-               if ( rawString != null && !rawString.equals("{}") )
-               {
-                       char[] chars = rawString.toCharArray();
-                       StringBuffer sbuf = new StringBuffer();
-                       boolean foundOpen = false;
-                       boolean insideString = false;
-                       for ( int i = 0; i < chars.length; i++ )
-                       {
-                               if ( chars[i] == '\\' )
-                                       //escape character that we need to skip
-                                       i++;
-                               else if (!insideString && chars[i] == '{' )
-                               {
-                                       if ( foundOpen )  // Only supports 1-D arrays for now
-                                               throw org.postgresql.Driver.notImplemented();
-                                       foundOpen = true;
-                                       continue;
-                               }
-                               else if (chars[i] == '"')
-                               {
-                                       insideString = !insideString;
-                                       continue;
-                               }
-                               else if (!insideString && (chars[i] == ',' || chars[i] == '}') || 
-                                                       i == chars.length - 1)
-                               {
-                                       if ( chars[i] != '"' && chars[i] != '}' && chars[i] != ',' )
-                                               sbuf.append(chars[i]);
-                                       array.add( sbuf.toString() );
-                                       sbuf = new StringBuffer();
-                                       continue;
-                               }
-                               sbuf.append( chars[i] );
-                       }
-               }
-               String[] arrayContents = (String[]) array.toArray( new String[array.size()] );
-               if ( count == 0 )
-                       count = arrayContents.length;
-               index--;
-               if ( index + count > arrayContents.length )
-                       throw new PSQLException("postgresql.arr.range", PSQLState.DATA_ERROR);
-
-               int i = 0;
-               switch ( getBaseType() )
-               {
-                       case Types.BIT:
-                               retVal = new boolean[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((boolean[])retVal)[i++] = AbstractJdbc2ResultSet.toBoolean( arrayContents[(int)index++] );
-                               break;
-                       case Types.SMALLINT:
-                       case Types.INTEGER:
-                               retVal = new int[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((int[])retVal)[i++] = AbstractJdbc2ResultSet.toInt( arrayContents[(int)index++] );
-                               break;
-                       case Types.BIGINT:
-                               retVal = new long[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((long[])retVal)[i++] = AbstractJdbc2ResultSet.toLong( arrayContents[(int)index++] );
-                               break;
-                       case Types.NUMERIC:
-                               retVal = new BigDecimal[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((BigDecimal[])retVal)[i++] = AbstractJdbc2ResultSet.toBigDecimal( arrayContents[(int)index++], 0 );
-                               break;
-                       case Types.REAL:
-                               retVal = new float[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((float[])retVal)[i++] = AbstractJdbc2ResultSet.toFloat( arrayContents[(int)index++] );
-                               break;
-                       case Types.DOUBLE:
-                               retVal = new double[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((double[])retVal)[i++] = AbstractJdbc2ResultSet.toDouble( arrayContents[(int)index++] );
-                               break;
-                       case Types.CHAR:
-                       case Types.VARCHAR:
-                               retVal = new String[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((String[])retVal)[i++] = arrayContents[(int)index++];
-                               break;
-                       case Types.DATE:
-                               retVal = new java.sql.Date[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((java.sql.Date[])retVal)[i++] = AbstractJdbc2ResultSet.toDate( arrayContents[(int)index++] );
-                               break;
-                       case Types.TIME:
-                               retVal = new java.sql.Time[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((java.sql.Time[])retVal)[i++] = AbstractJdbc2ResultSet.toTime( arrayContents[(int)index++], rs, getBaseTypeName() );
-                               break;
-                       case Types.TIMESTAMP:
-                               retVal = new Timestamp[ count ];
-                               for ( ; count > 0; count-- )
-                                       ((java.sql.Timestamp[])retVal)[i++] = AbstractJdbc2ResultSet.toTimestamp( arrayContents[(int)index++], rs, getBaseTypeName() );
-                               break;
-
-                               // Other datatypes not currently supported.  If you are really using other types ask
-                               // yourself if an array of non-trivial data types is really good database design.
-                       default:
-                               throw org.postgresql.Driver.notImplemented();
-               }
-               return retVal;
-       }
-
-       public int getBaseType() throws SQLException
-       {
-               return conn.getSQLType(getBaseTypeName());
-       }
-
-       public String getBaseTypeName() throws SQLException
-       {
-               String fType = field.getPGType();
-               if ( fType.charAt(0) == '_' )
-                       fType = fType.substring(1);
-               return fType;
-       }
-
-       public java.sql.ResultSet getResultSet() throws SQLException
-       {
-               return getResultSet( 1, 0, null );
-       }
-
-       public java.sql.ResultSet getResultSet(long index, int count) throws SQLException
-       {
-               return getResultSet( index, count, null );
-       }
-
-       public java.sql.ResultSet getResultSet(Map map) throws SQLException
-       {
-               return getResultSet( 1, 0, map );
-       }
-
-       public java.sql.ResultSet getResultSet(long index, int count, java.util.Map map) throws SQLException
-       {
-               Object array = getArray( index, count, map );
-               Vector rows = new Vector();
-               Field[] fields = new Field[2];
-               fields[0] = new Field(conn, "INDEX", conn.getPGType("int2"), 2);
-               switch ( getBaseType() )
-               {
-                       case Types.BIT:
-                               boolean[] booleanArray = (boolean[]) array;
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("bool"), 1);
-                               for ( int i = 0; i < booleanArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( (booleanArray[i] ? "YES" : "NO") ); // Value
-                                       rows.addElement(tuple);
-                               }
-                       case Types.SMALLINT:
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("int2"), 2);
-                       case Types.INTEGER:
-                               int[] intArray = (int[]) array;
-                               if ( fields[1] == null )
-                                       fields[1] = new Field(conn, "VALUE", conn.getPGType("int4"), 4);
-                               for ( int i = 0; i < intArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( Integer.toString(intArray[i]) ); // Value
-                                       rows.addElement(tuple);
-                               }
-                               break;
-                       case Types.BIGINT:
-                               long[] longArray = (long[]) array;
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("int8"), 8);
-                               for ( int i = 0; i < longArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( Long.toString(longArray[i]) ); // Value
-                                       rows.addElement(tuple);
-                               }
-                               break;
-                       case Types.NUMERIC:
-                               BigDecimal[] bdArray = (BigDecimal[]) array;
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("numeric"), -1);
-                               for ( int i = 0; i < bdArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( bdArray[i].toString() ); // Value
-                                       rows.addElement(tuple);
-                               }
-                               break;
-                       case Types.REAL:
-                               float[] floatArray = (float[]) array;
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("float4"), 4);
-                               for ( int i = 0; i < floatArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( Float.toString(floatArray[i]) ); // Value
-                                       rows.addElement(tuple);
-                               }
-                               break;
-                       case Types.DOUBLE:
-                               double[] doubleArray = (double[]) array;
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("float8"), 8);
-                               for ( int i = 0; i < doubleArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( Double.toString(doubleArray[i]) ); // Value
-                                       rows.addElement(tuple);
-                               }
-                               break;
-                       case Types.CHAR:
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("char"), 1);
-                       case Types.VARCHAR:
-                               String[] strArray = (String[]) array;
-                               if ( fields[1] == null )
-                                       fields[1] = new Field(conn, "VALUE", conn.getPGType("varchar"), -1);
-                               for ( int i = 0; i < strArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( strArray[i] ); // Value
-                                       rows.addElement(tuple);
-                               }
-                               break;
-                       case Types.DATE:
-                               java.sql.Date[] dateArray = (java.sql.Date[]) array;
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("date"), 4);
-                               for ( int i = 0; i < dateArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( dateArray[i].toString() ); // Value
-                                       rows.addElement(tuple);
-                               }
-                               break;
-                       case Types.TIME:
-                               java.sql.Time[] timeArray = (java.sql.Time[]) array;
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("time"), 8);
-                               for ( int i = 0; i < timeArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( timeArray[i].toString() ); // Value
-                                       rows.addElement(tuple);
-                               }
-                               break;
-                       case Types.TIMESTAMP:
-                               java.sql.Timestamp[] timestampArray = (java.sql.Timestamp[]) array;
-                               fields[1] = new Field(conn, "VALUE", conn.getPGType("timestamp"), 8);
-                               for ( int i = 0; i < timestampArray.length; i++ )
-                               {
-                                       byte[][] tuple = new byte[2][0];
-                                       tuple[0] = conn.getEncoding().encode( Integer.toString((int)index + i) ); // Index
-                                       tuple[1] = conn.getEncoding().encode( timestampArray[i].toString() ); // Value
-                                       rows.addElement(tuple);
-                               }
-                               break;
-
-                               // Other datatypes not currently supported.  If you are really using other types ask
-                               // yourself if an array of non-trivial data types is really good database design.
-                       default:
-                               throw org.postgresql.Driver.notImplemented();
-               }
-               BaseStatement stat = (BaseStatement) conn.createStatement();
-               return (ResultSet) stat.createResultSet(fields, rows, "OK", 1, 0, false);
-       }
-
-       public String toString()
-       {
-               return rawString;
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Blob.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Blob.java
deleted file mode 100644 (file)
index 5f5d28a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-public class Jdbc2Blob extends AbstractJdbc2Blob implements java.sql.Blob
-{
-
-       public Jdbc2Blob(org.postgresql.PGConnection conn, int oid) throws java.sql.SQLException
-       {
-               super(conn, oid);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2CallableStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2CallableStatement.java
deleted file mode 100644 (file)
index e10223e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.Field;
-
-public class Jdbc2CallableStatement extends org.postgresql.jdbc2.AbstractJdbc2Statement implements java.sql.CallableStatement
-{
-
-       public Jdbc2CallableStatement(Jdbc2Connection connection, String sql) throws SQLException
-       {
-               super(connection, sql);
-       }
-
-       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);
-       }
-
-       public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
-       {
-                return new Jdbc2RefCursorResultSet(this, cursorName);
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Clob.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Clob.java
deleted file mode 100644 (file)
index 71de2f5..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-public class Jdbc2Clob extends AbstractJdbc2Clob implements java.sql.Clob
-{
-
-       public Jdbc2Clob(org.postgresql.PGConnection conn, int oid) throws java.sql.SQLException
-       {
-               super(conn, oid);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java
deleted file mode 100644 (file)
index 50b66d2..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-import java.sql.*;
-import java.util.Vector;
-import java.util.Hashtable;
-import org.postgresql.core.Field;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java,v 1.8 2003/11/29 19:52:10 pgsql 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 class Jdbc2Connection extends org.postgresql.jdbc2.AbstractJdbc2Connection implements java.sql.Connection
-{
-
-       public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
-       {
-               Jdbc2Statement s = new Jdbc2Statement(this);
-               s.setResultSetType(resultSetType);
-               s.setResultSetConcurrency(resultSetConcurrency);
-               return s;
-       }
-
-
-       public java.sql.PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
-       {
-               Jdbc2PreparedStatement s = new Jdbc2PreparedStatement(this, sql);
-               s.setResultSetType(resultSetType);
-               s.setResultSetConcurrency(resultSetConcurrency);
-               return s;
-       }
-
-       public java.sql.CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
-       {
-               Jdbc2CallableStatement s = new org.postgresql.jdbc2.Jdbc2CallableStatement(this, sql);
-               s.setResultSetType(resultSetType);
-               s.setResultSetConcurrency(resultSetConcurrency);
-               return s;
-       }
-
-       public java.sql.DatabaseMetaData getMetaData() throws SQLException
-       {
-               if (metadata == null)
-                       metadata = new org.postgresql.jdbc2.Jdbc2DatabaseMetaData(this);
-               return metadata;
-       }
-
-}
-
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2DatabaseMetaData.java
deleted file mode 100644 (file)
index 7dbf8a0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-public class Jdbc2DatabaseMetaData extends org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData implements java.sql.DatabaseMetaData
-{
-       public Jdbc2DatabaseMetaData(Jdbc2Connection conn)
-       {
-               super(conn);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java
deleted file mode 100644 (file)
index 83023f0..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.Field;
-
-public class Jdbc2PreparedStatement extends org.postgresql.jdbc2.AbstractJdbc2Statement implements java.sql.PreparedStatement
-{
-
-       public Jdbc2PreparedStatement(Jdbc2Connection connection, String sql) throws SQLException
-       {
-               super(connection, sql);
-       }
-
-       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);
-       }
-
-       public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
-       {
-                return new Jdbc2RefCursorResultSet(this, cursorName);
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2RefCursorResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2RefCursorResultSet.java
deleted file mode 100644 (file)
index 08ec33d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-import org.postgresql.core.QueryExecutor;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.PGRefCursorResultSet;
-
-
-/** A real result set based on a ref cursor.
- *
- * @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
- */
-public class Jdbc2RefCursorResultSet extends Jdbc2ResultSet
-        implements PGRefCursorResultSet
-{
-        
-        String refCursorHandle;
-
-        // Indicates when the result set has activaly bound to the cursor.
-        boolean isInitialized = false;
-
-        Jdbc2RefCursorResultSet(BaseStatement statement, String refCursorName) throws java.sql.SQLException
-        {
-                super(statement, null, null, null, -1, 0L, false);
-                this.refCursorHandle = refCursorName;
-        }
-
-        public String getRefCursor ()
-        {
-                return refCursorHandle;
-        }
-
-        public boolean next () throws java.sql.SQLException
-        {
-                if (isInitialized)
-                        return super.next();    
-                // Initialize this res set with the rows from the cursor.
-                String[] toExec = { "FETCH ALL IN \"" + refCursorHandle + "\";" };
-                QueryExecutor.execute(toExec, new String[0], this);
-                isInitialized = true;
-                return super.next();
-        }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java
deleted file mode 100644 (file)
index a6132cb..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java,v 1.9 2003/11/29 19:52:10 pgsql 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 class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet implements java.sql.ResultSet
-{
-
-       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 ResultSetMetaData getMetaData() throws SQLException
-       {
-               return new Jdbc2ResultSetMetaData(rows, fields);
-       }
-
-       public java.sql.Clob getClob(int i) throws SQLException
-       {
-               wasNullFlag = (this_row[i - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               return new org.postgresql.jdbc2.Jdbc2Clob(connection, getInt(i));
-       }
-
-       public java.sql.Blob getBlob(int i) throws SQLException
-       {
-               wasNullFlag = (this_row[i - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               return new org.postgresql.jdbc2.Jdbc2Blob(connection, getInt(i));
-       }
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSetMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSetMetaData.java
deleted file mode 100644 (file)
index 97762a9..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.postgresql.jdbc2;
-
-import java.util.Vector;
-import org.postgresql.core.Field;
-
-public class Jdbc2ResultSetMetaData extends AbstractJdbc2ResultSetMetaData implements java.sql.ResultSetMetaData
-{
-       public Jdbc2ResultSetMetaData(Vector rows, Field[] fields)
-       {
-               super(rows, fields);
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Statement.java
deleted file mode 100644 (file)
index f786af5..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.postgresql.jdbc2;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.Field;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Statement.java,v 1.7 2003/11/29 19:52:10 pgsql 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
- */
-public class Jdbc2Statement extends org.postgresql.jdbc2.AbstractJdbc2Statement implements java.sql.Statement
-{
-
-       public Jdbc2Statement (Jdbc2Connection c)
-       {
-               super(c);
-       }
-
-       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);
-       }
-
-       public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
-       {
-                return new Jdbc2RefCursorResultSet(this, cursorName);
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/PBatchUpdateException.java b/src/interfaces/jdbc/org/postgresql/jdbc2/PBatchUpdateException.java
deleted file mode 100644 (file)
index 1b30e53..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.postgresql.jdbc2;
-
-import org.postgresql.util.MessageTranslator;
-
-/*
- * This class extends java.sql.BatchUpdateException, and provides our
- * internationalisation handling.
- */
-class PBatchUpdateException extends java.sql.BatchUpdateException
-{
-
-       private String message;
-
-       public PBatchUpdateException(
-               String error, Object arg1, Object arg2, int[] updateCounts )
-       {
-
-               super(updateCounts);
-
-               Object[] argv = new Object[2];
-               argv[0] = arg1;
-               argv[1] = arg2;
-               translate(error, argv);
-       }
-
-       private void translate(String error, Object[] args)
-       {
-               message = MessageTranslator.translate(error, args);
-       }
-
-       // Overides Throwable
-       public String getLocalizedMessage()
-       {
-               return message;
-       }
-
-       // Overides Throwable
-       public String getMessage()
-       {
-               return message;
-       }
-
-       // Overides Object
-       public String toString()
-       {
-               return message;
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Blob.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Blob.java
deleted file mode 100644 (file)
index c5f4e8b..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.*;
-
-public abstract class AbstractJdbc3Blob extends org.postgresql.jdbc2.AbstractJdbc2Blob
-{
-
-       public AbstractJdbc3Blob(org.postgresql.PGConnection conn, int oid) throws SQLException
-       {
-               super(conn, oid);
-       }
-
-       /**
-        * Writes the given array of bytes to the <code>BLOB</code> value that
-        * this <code>Blob</code> object represents, starting at position
-        * <code>pos</code>, and returns the number of bytes written.
-        *
-        * @param pos the position in the <code>BLOB</code> object at which
-        *                to start writing
-        * @param bytes the array of bytes to be written to the <code>BLOB</code>
-        *                value that this <code>Blob</code> object represents
-        * @return the number of bytes written
-        * @exception SQLException if there is an error accessing the
-        *                        <code>BLOB</code> value
-        * @see #getBytes
-        * @since 1.4
-        */
-       public int setBytes(long pos, byte[] bytes) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Writes all or part of the given <code>byte</code> array to the
-        * <code>BLOB</code> value that this <code>Blob</code> object represents
-        * and returns the number of bytes written.
-        * Writing starts at position <code>pos</code> in the <code>BLOB</code>
-        * value; <code>len</code> bytes from the given byte array are written.
-        *
-        * @param pos the position in the <code>BLOB</code> object at which
-        *                to start writing
-        * @param bytes the array of bytes to be written to this <code>BLOB</code>
-        *                object
-        * @param offset the offset into the array <code>bytes</code> at which
-        *                to start reading the bytes to be set
-        * @param len the number of bytes to be written to the <code>BLOB</code>
-        *                value from the array of bytes <code>bytes</code>
-        * @return the number of bytes written
-        * @exception SQLException if there is an error accessing the
-        *                        <code>BLOB</code> value
-        * @see #getBytes
-        * @since 1.4
-        */
-       public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves a stream that can be used to write to the <code>BLOB</code>
-        * value that this <code>Blob</code> object represents.  The stream begins
-        * at position <code>pos</code>.
-        *
-        * @param pos the position in the <code>BLOB</code> value at which
-        *                to start writing
-        * @return a <code>java.io.OutputStream</code> object to which data can
-        *                 be written
-        * @exception SQLException if there is an error accessing the
-        *                        <code>BLOB</code> value
-        * @see #getBinaryStream
-        * @since 1.4
-        */
-       public java.io.OutputStream setBinaryStream(long pos) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Truncates the <code>BLOB</code> value that this <code>Blob</code>
-        * object represents to be <code>len</code> bytes in length.
-        *
-        * @param len the length, in bytes, to which the <code>BLOB</code> value
-        *                that this <code>Blob</code> object represents should be truncated
-        * @exception SQLException if there is an error accessing the
-        *                        <code>BLOB</code> value
-        * @since 1.4
-        */
-       public void truncate(long len) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Clob.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Clob.java
deleted file mode 100644 (file)
index fb2eb8a..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.*;
-
-public abstract class AbstractJdbc3Clob extends org.postgresql.jdbc2.AbstractJdbc2Clob
-{
-
-       public AbstractJdbc3Clob(org.postgresql.PGConnection conn, int oid) throws SQLException
-       {
-               super(conn, oid);
-       }
-
-       /**
-        * Writes the given Java <code>String</code> to the <code>CLOB</code>
-        * value that this <code>Clob</code> object designates at the position
-        * <code>pos</code>.
-        *
-        * @param pos the position at which to start writing to the <code>CLOB</code>
-        *                 value that this <code>Clob</code> object represents
-        * @param str the string to be written to the <code>CLOB</code>
-        *                value that this <code>Clob</code> designates
-        * @return the number of characters written
-        * @exception SQLException if there is an error accessing the
-        *                        <code>CLOB</code> value
-        *
-        * @since 1.4
-        */
-       public int setString(long pos, String str) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Writes <code>len</code> characters of <code>str</code>, starting
-        * at character <code>offset</code>, to the <code>CLOB</code> value
-        * that this <code>Clob</code> represents.
-        *
-        * @param pos the position at which to start writing to this
-        *                <code>CLOB</code> object
-        * @param str the string to be written to the <code>CLOB</code>
-        *                value that this <code>Clob</code> object represents
-        * @param offset the offset into <code>str</code> to start reading
-        *                the characters to be written
-        * @param len the number of characters to be written
-        * @return the number of characters written
-        * @exception SQLException if there is an error accessing the
-        *                        <code>CLOB</code> value
-        *
-        * @since 1.4
-        */
-       public int setString(long pos, String str, int offset, int len) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves a stream to be used to write Ascii characters to the
-        * <code>CLOB</code> value that this <code>Clob</code> object represents,
-        * starting at position <code>pos</code>.
-        *
-        * @param pos the position at which to start writing to this
-        *                <code>CLOB</code> object
-        * @return the stream to which ASCII encoded characters can be written
-        * @exception SQLException if there is an error accessing the
-        *                        <code>CLOB</code> value
-        * @see #getAsciiStream
-        *
-        * @since 1.4
-        */
-       public java.io.OutputStream setAsciiStream(long pos) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves a stream to be used to write a stream of Unicode characters
-        * to the <code>CLOB</code> value that this <code>Clob</code> object
-        * represents, at position <code>pos</code>.
-        *
-        * @param  pos the position at which to start writing to the
-        *                <code>CLOB</code> value
-        *
-        * @return a stream to which Unicode encoded characters can be written
-        * @exception SQLException if there is an error accessing the
-        *                        <code>CLOB</code> value
-        * @see #getCharacterStream
-        *
-        * @since 1.4
-        */
-       public java.io.Writer setCharacterStream(long pos) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Truncates the <code>CLOB</code> value that this <code>Clob</code>
-        * designates to have a length of <code>len</code>
-        * characters.
-        * @param len the length, in bytes, to which the <code>CLOB</code> value
-        *                should be truncated
-        * @exception SQLException if there is an error accessing the
-        *                        <code>CLOB</code> value
-        *
-        * @since 1.4
-        */
-       public void truncate(long len) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java
deleted file mode 100644 (file)
index 9bb2903..0000000
+++ /dev/null
@@ -1,459 +0,0 @@
-package org.postgresql.jdbc3;
-
-import java.sql.*;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java,v 1.5 2003/11/29 19:52:10 pgsql Exp $
- * This class defines methods of the jdbc3 specification.  This class extends
- * org.postgresql.jdbc2.AbstractJdbc2Connection which provides the jdbc2
- * methods.  The real Connection class (for jdbc3) is org.postgresql.jdbc3.Jdbc3Connection
- */
-public abstract class AbstractJdbc3Connection extends org.postgresql.jdbc2.AbstractJdbc2Connection
-{
-
-       /**
-        * Changes the holdability of <code>ResultSet</code> objects
-        * created using this <code>Connection</code> object to the given
-        * holdability.
-        *
-        * @param holdability a <code>ResultSet</code> holdability constant; one of
-        *                <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
-        *                <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
-        * @throws SQLException if a database access occurs, the given parameter
-        *                 is not a <code>ResultSet</code> constant indicating holdability,
-        *                 or the given holdability is not supported
-        * @see #getHoldability
-        * @see ResultSet
-        * @since 1.4
-        */
-       public void setHoldability(int holdability) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the current holdability of <code>ResultSet</code> objects
-        * created using this <code>Connection</code> object.
-        *
-        * @return the holdability, one of
-        *                <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
-        *                <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
-        * @throws SQLException if a database access occurs
-        * @see #setHoldability
-        * @see ResultSet
-        * @since 1.4
-        */
-       public int getHoldability() throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Creates an unnamed savepoint in the current transaction and
-        * returns the new <code>Savepoint</code> object that represents it.
-        *
-        * @return the new <code>Savepoint</code> object
-        * @exception SQLException if a database access error occurs
-        *                        or this <code>Connection</code> object is currently in
-        *                        auto-commit mode
-        * @see Savepoint
-        * @since 1.4
-        */
-       public Savepoint setSavepoint() throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Creates a savepoint with the given name in the current transaction
-        * and returns the new <code>Savepoint</code> object that represents it.
-        *
-        * @param name a <code>String</code> containing the name of the savepoint
-        * @return the new <code>Savepoint</code> object
-        * @exception SQLException if a database access error occurs
-        *                        or this <code>Connection</code> object is currently in
-        *                        auto-commit mode
-        * @see Savepoint
-        * @since 1.4
-        */
-       public Savepoint setSavepoint(String name) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Undoes all changes made after the given <code>Savepoint</code> object
-        * was set.
-        * <P>
-        * This method should be used only when auto-commit has been disabled.
-        *
-        * @param savepoint the <code>Savepoint</code> object to roll back to
-        * @exception SQLException if a database access error occurs,
-        *                        the <code>Savepoint</code> object is no longer valid,
-        *                        or this <code>Connection</code> object is currently in
-        *                        auto-commit mode
-        * @see Savepoint
-        * @see #rollback
-        * @since 1.4
-        */
-       public void rollback(Savepoint savepoint) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-       /**
-        * Removes the given <code>Savepoint</code> object from the current
-        * transaction. Any reference to the savepoint after it have been removed
-        * will cause an <code>SQLException</code> to be thrown.
-        *
-        * @param savepoint the <code>Savepoint</code> object to be removed
-        * @exception SQLException if a database access error occurs or
-        *                        the given <code>Savepoint</code> object is not a valid
-        *                        savepoint in the current transaction
-        * @since 1.4
-        */
-       public void releaseSavepoint(Savepoint savepoint) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-       /**
-        * Creates a <code>Statement</code> object that will generate
-        * <code>ResultSet</code> objects with the given type, concurrency,
-        * and holdability.
-        * This method is the same as the <code>createStatement</code> method
-        * above, but it allows the default result set
-        * type, concurrency, and holdability to be overridden.
-        *
-        * @param resultSetType one of the following <code>ResultSet</code>
-        *                constants:
-        *                 <code>ResultSet.TYPE_FORWARD_ONLY</code>,
-        *                 <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
-        *                 <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
-        * @param resultSetConcurrency one of the following <code>ResultSet</code>
-        *                constants:
-        *                 <code>ResultSet.CONCUR_READ_ONLY</code> or
-        *                 <code>ResultSet.CONCUR_UPDATABLE</code>
-        * @param resultSetHoldability one of the following <code>ResultSet</code>
-        *                constants:
-        *                 <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
-        *                 <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
-        * @return a new <code>Statement</code> object that will generate
-        *                 <code>ResultSet</code> objects with the given type,
-        *                 concurrency, and holdability
-        * @exception SQLException if a database access error occurs
-        *                        or the given parameters are not <code>ResultSet</code>
-        *                        constants indicating type, concurrency, and holdability
-        * @see ResultSet
-        * @since 1.4
-        */
-       public Statement createStatement(int resultSetType, int resultSetConcurrency,
-                                                                        int resultSetHoldability) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-       /**
-        * Creates a <code>PreparedStatement</code> object that will generate
-        * <code>ResultSet</code> objects with the given type, concurrency,
-        * and holdability.
-        * <P>
-        * This method is the same as the <code>prepareStatement</code> method
-        * above, but it allows the default result set
-        * type, concurrency, and holdability to be overridden.
-        *
-        * @param sql a <code>String</code> object that is the SQL statement to
-        *                        be sent to the database; may contain one or more ? IN
-        *                        parameters
-        * @param resultSetType one of the following <code>ResultSet</code>
-        *                constants:
-        *                 <code>ResultSet.TYPE_FORWARD_ONLY</code>,
-        *                 <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
-        *                 <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
-        * @param resultSetConcurrency one of the following <code>ResultSet</code>
-        *                constants:
-        *                 <code>ResultSet.CONCUR_READ_ONLY</code> or
-        *                 <code>ResultSet.CONCUR_UPDATABLE</code>
-        * @param resultSetHoldability one of the following <code>ResultSet</code>
-        *                constants:
-        *                 <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
-        *                 <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
-        * @return a new <code>PreparedStatement</code> object, containing the
-        *                 pre-compiled SQL statement, that will generate
-        *                 <code>ResultSet</code> objects with the given type,
-        *                 concurrency, and holdability
-        * @exception SQLException if a database access error occurs
-        *                        or the given parameters are not <code>ResultSet</code>
-        *                        constants indicating type, concurrency, and holdability
-        * @see ResultSet
-        * @since 1.4
-        */
-       public PreparedStatement prepareStatement(String sql, int resultSetType,
-                       int resultSetConcurrency, int resultSetHoldability)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-       /**
-        * Creates a <code>CallableStatement</code> object that will generate
-        * <code>ResultSet</code> objects with the given type and concurrency.
-        * This method is the same as the <code>prepareCall</code> method
-        * above, but it allows the default result set
-        * type, result set concurrency type and holdability to be overridden.
-        *
-        * @param sql a <code>String</code> object that is the SQL statement to
-        *                        be sent to the database; may contain on or more ? parameters
-        * @param resultSetType one of the following <code>ResultSet</code>
-        *                constants:
-        *                 <code>ResultSet.TYPE_FORWARD_ONLY</code>,
-        *                 <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
-        *                 <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
-        * @param resultSetConcurrency one of the following <code>ResultSet</code>
-        *                constants:
-        *                 <code>ResultSet.CONCUR_READ_ONLY</code> or
-        *                 <code>ResultSet.CONCUR_UPDATABLE</code>
-        * @param resultSetHoldability one of the following <code>ResultSet</code>
-        *                constants:
-        *                 <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
-        *                 <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
-        * @return a new <code>CallableStatement</code> object, containing the
-        *                 pre-compiled SQL statement, that will generate
-        *                 <code>ResultSet</code> objects with the given type,
-        *                 concurrency, and holdability
-        * @exception SQLException if a database access error occurs
-        *                        or the given parameters are not <code>ResultSet</code>
-        *                        constants indicating type, concurrency, and holdability
-        * @see ResultSet
-        * @since 1.4
-        */
-       public CallableStatement prepareCall(String sql, int resultSetType,
-                                                                                int resultSetConcurrency,
-                                                                                int resultSetHoldability) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-
-       /**
-        * Creates a default <code>PreparedStatement</code> object that has
-        * the capability to retrieve auto-generated keys. The given constant
-        * tells the driver whether it should make auto-generated keys
-        * available for retrieval.  This parameter is ignored if the SQL
-        * statement is not an <code>INSERT</code> statement.
-        * <P>
-        * <B>Note:</B> This method is optimized for handling
-        * parametric SQL statements that benefit from precompilation. If
-        * the driver supports precompilation,
-        * the method <code>prepareStatement</code> will send
-        * the statement to the database for precompilation. Some drivers
-        * may not support precompilation. In this case, the statement may
-        * not be sent to the database until the <code>PreparedStatement</code>
-        * object is executed.  This has no direct effect on users; however, it does
-        * affect which methods throw certain SQLExceptions.
-        * <P>
-        * Result sets created using the returned <code>PreparedStatement</code>
-        * object will by default be type <code>TYPE_FORWARD_ONLY</code>
-        * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
-        *
-        * @param sql an SQL statement that may contain one or more '?' IN
-        *                parameter placeholders
-        * @param autoGeneratedKeys a flag indicating whether auto-generated keys
-        *                should be returned; one of the following <code>Statement</code>
-        *                constants:
-        * @param autoGeneratedKeys a flag indicating that auto-generated keys should be returned, one of
-        *                <code>Statement.RETURN_GENERATED_KEYS</code> or
-        *                <code>Statement.NO_GENERATED_KEYS</code>.
-        * @return a new <code>PreparedStatement</code> object, containing the
-        *                 pre-compiled SQL statement, that will have the capability of
-        *                 returning auto-generated keys
-        * @exception SQLException if a database access error occurs
-        *                 or the given parameter is not a <code>Statement</code>
-        *                 constant indicating whether auto-generated keys should be
-        *                 returned
-        * @since 1.4
-        */
-       public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-       /**
-        * Creates a default <code>PreparedStatement</code> object capable
-        * of returning the auto-generated keys designated by the given array.
-        * This array contains the indexes of the columns in the target
-        * table that contain the auto-generated keys that should be made
-        * available. This array is ignored if the SQL
-        * statement is not an <code>INSERT</code> statement.
-        * <P>
-        * An SQL statement with or without IN parameters can be
-        * pre-compiled and stored in a <code>PreparedStatement</code> object. This
-        * object can then be used to efficiently execute this statement
-        * multiple times.
-        * <P>
-        * <B>Note:</B> This method is optimized for handling
-        * parametric SQL statements that benefit from precompilation. If
-        * the driver supports precompilation,
-        * the method <code>prepareStatement</code> will send
-        * the statement to the database for precompilation. Some drivers
-        * may not support precompilation. In this case, the statement may
-        * not be sent to the database until the <code>PreparedStatement</code>
-        * object is executed.  This has no direct effect on users; however, it does
-        * affect which methods throw certain SQLExceptions.
-        * <P>
-        * Result sets created using the returned <code>PreparedStatement</code>
-        * object will by default be type <code>TYPE_FORWARD_ONLY</code>
-        * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
-        *
-        * @param sql an SQL statement that may contain one or more '?' IN
-        *                parameter placeholders
-        * @param columnIndexes an array of column indexes indicating the columns
-        *                that should be returned from the inserted row or rows
-        * @return a new <code>PreparedStatement</code> object, containing the
-        *                 pre-compiled statement, that is capable of returning the
-        *                 auto-generated keys designated by the given array of column
-        *                 indexes
-        * @exception SQLException if a database access error occurs
-        *
-        * @since 1.4
-        */
-       public PreparedStatement prepareStatement(String sql, int columnIndexes[])
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-       /**
-        * Creates a default <code>PreparedStatement</code> object capable
-        * of returning the auto-generated keys designated by the given array.
-        * This array contains the names of the columns in the target
-        * table that contain the auto-generated keys that should be returned.
-        * This array is ignored if the SQL
-        * statement is not an <code>INSERT</code> statement.
-        * <P>
-        * An SQL statement with or without IN parameters can be
-        * pre-compiled and stored in a <code>PreparedStatement</code> object. This
-        * object can then be used to efficiently execute this statement
-        * multiple times.
-        * <P>
-        * <B>Note:</B> This method is optimized for handling
-        * parametric SQL statements that benefit from precompilation. If
-        * the driver supports precompilation,
-        * the method <code>prepareStatement</code> will send
-        * the statement to the database for precompilation. Some drivers
-        * may not support precompilation. In this case, the statement may
-        * not be sent to the database until the <code>PreparedStatement</code>
-        * object is executed.  This has no direct effect on users; however, it does
-        * affect which methods throw certain SQLExceptions.
-        * <P>
-        * Result sets created using the returned <code>PreparedStatement</code>
-        * object will by default be type <code>TYPE_FORWARD_ONLY</code>
-        * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
-        *
-        * @param sql an SQL statement that may contain one or more '?' IN
-        *                parameter placeholders
-        * @param columnNames an array of column names indicating the columns
-        *                that should be returned from the inserted row or rows
-        * @return a new <code>PreparedStatement</code> object, containing the
-        *                 pre-compiled statement, that is capable of returning the
-        *                 auto-generated keys designated by the given array of column
-        *                 names
-        * @exception SQLException if a database access error occurs
-        *
-        * @since 1.4
-        */
-       public PreparedStatement prepareStatement(String sql, String columnNames[])
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /*
-        * This implemetation uses the jdbc3Types array to support the jdbc3
-        * datatypes.  Basically jdbc2 and jdbc3 are the same, except that
-        * jdbc3 adds some
-        */
-       public int getSQLType(String pgTypeName)
-       {
-               int sqlType = Types.OTHER; // default value
-               for (int i = 0;i < jdbc3Types.length;i++)
-               {
-                       if (pgTypeName.equals(jdbc3Types[i]))
-                       {
-                               sqlType = jdbc3Typei[i];
-                               break;
-                       }
-               }
-               return sqlType;
-       }
-
-       /*
-        * This table holds the org.postgresql names for the types supported.
-        * Any types that map to Types.OTHER (eg POINT) don't go into this table.
-        * They default automatically to Types.OTHER
-        *
-        * Note: This must be in the same order as below.
-        *
-        * Tip: keep these grouped together by the Types. value
-        */
-       private static final String jdbc3Types[] = {
-                               "int2",
-                               "int4", "oid",
-                               "int8",
-                               "cash", "money",
-                               "numeric",
-                               "float4",
-                               "float8",
-                               "bpchar", "char", "char2", "char4", "char8", "char16",
-                               "varchar", "text", "name", "filename",
-                               "bytea",
-                               "bool",
-                               "bit",
-                               "date",
-                               "time",
-                               "abstime", "timestamp", "timestamptz",
-                               "_bool", "_char", "_int2", "_int4", "_text",
-                               "_oid", "_varchar", "_int8", "_float4", "_float8",
-                               "_abstime", "_date", "_time", "_timestamp", "_numeric",
-                               "_bytea"
-                       };
-
-       /*
-        * This table holds the JDBC type for each entry above.
-        *
-        * Note: This must be in the same order as above
-        *
-        * Tip: keep these grouped together by the Types. value
-        */
-       private static final int jdbc3Typei[] = {
-                       Types.SMALLINT,
-                       Types.INTEGER, Types.INTEGER,
-                       Types.BIGINT,
-                       Types.DOUBLE, Types.DOUBLE,
-                       Types.NUMERIC,
-                       Types.REAL,
-                       Types.DOUBLE,
-                       Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR,
-                       Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
-                       Types.BINARY,
-                       Types.BIT,
-                       Types.BIT,
-                       Types.DATE,
-                       Types.TIME,
-                       Types.TIMESTAMP, Types.TIMESTAMP, Types.TIMESTAMP,
-                       Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY,
-                       Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY,
-                       Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY, Types.ARRAY,
-                       Types.ARRAY
-          };
-
-}
-
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
deleted file mode 100644 (file)
index 7ebdf38..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.*;
-
-public abstract class AbstractJdbc3DatabaseMetaData extends org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData
-{
-
-       public AbstractJdbc3DatabaseMetaData(AbstractJdbc3Connection conn)
-       {
-               super(conn);
-       }
-
-
-       /**
-        * Retrieves whether this database supports savepoints.
-        *
-        * @return <code>true</code> if savepoints are supported;
-        *                 <code>false</code> otherwise
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public boolean supportsSavepoints() throws SQLException
-       {
-               return false;
-       }
-
-       /**
-        * Retrieves whether this database supports named parameters to callable
-        * statements.
-        *
-        * @return <code>true</code> if named parameters are supported;
-        *                 <code>false</code> otherwise
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public boolean supportsNamedParameters() throws SQLException
-       {
-               return false;
-       }
-
-       /**
-        * Retrieves whether it is possible to have multiple <code>ResultSet</code> objects
-        * returned from a <code>CallableStatement</code> object
-        * simultaneously.
-        *
-        * @return <code>true</code> if a <code>CallableStatement</code> object
-        *                 can return multiple <code>ResultSet</code> objects
-        *                 simultaneously; <code>false</code> otherwise
-        * @exception SQLException if a datanase access error occurs
-        * @since 1.4
-        */
-       public boolean supportsMultipleOpenResults() throws SQLException
-       {
-               return false;
-       }
-
-       /**
-        * Retrieves whether auto-generated keys can be retrieved after
-        * a statement has been executed.
-        *
-        * @return <code>true</code> if auto-generated keys can be retrieved
-        *                 after a statement has executed; <code>false</code> otherwise
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public boolean supportsGetGeneratedKeys() throws SQLException
-       {
-               return false;
-       }
-
-       /**
-        * Retrieves a description of the user-defined type (UDT) hierarchies defined in a
-        * particular schema in this database. Only the immediate super type/
-        * sub type relationship is modeled.
-        * <P>
-        * Only supertype information for UDTs matching the catalog,
-        * schema, and type name is returned. The type name parameter
-        * may be a fully-qualified name. When the UDT name supplied is a
-        * fully-qualified name, the catalog and schemaPattern parameters are
-        * ignored.
-        * <P>
-        * If a UDT does not have a direct super type, it is not listed here.
-        * A row of the <code>ResultSet</code> object returned by this method
-        * describes the designated UDT and a direct supertype. A row has the following
-        * columns:
-        *      <OL>
-        *      <LI><B>TYPE_CAT</B> String => the UDT's catalog (may be <code>null</code>)
-        *      <LI><B>TYPE_SCHEM</B> String => UDT's schema (may be <code>null</code>)
-        *      <LI><B>TYPE_NAME</B> String => type name of the UDT
-        *      <LI><B>SUPERTYPE_CAT</B> String => the direct super type's catalog 
-        *                                                       (may be <code>null</code>)
-        *      <LI><B>SUPERTYPE_SCHEM</B> String => the direct super type's schema 
-        *                                                         (may be <code>null</code>)
-        *      <LI><B>SUPERTYPE_NAME</B> String => the direct super type's name
-        *      </OL>
-        *
-        * <P><B>Note:</B> If the driver does not support type hierarchies, an
-        * empty result set is returned.
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog;
-        *                <code>null</code> means drop catalog name from the selection criteria
-        * @param schemaPattern a schema name pattern; "" retrieves those
-        *                without a schema
-        * @param typeNamePattern a UDT name pattern; may be a fully-qualified
-        *                name
-        * @return a <code>ResultSet</code> object in which a row gives information
-        *                 about the designated UDT
-        * @throws SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public ResultSet getSuperTypes(String catalog, String schemaPattern,
-                                                                  String typeNamePattern) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves a description of the table hierarchies defined in a particular
-        * schema in this database.
-        *
-        * <P>Only supertable information for tables matching the catalog, schema
-        * and table name are returned. The table name parameter may be a fully-
-        * qualified name, in which case, the catalog and schemaPattern parameters
-        * are ignored. If a table does not have a super table, it is not listed here.
-        * Supertables have to be defined in the same catalog and schema as the
-        * sub tables. Therefore, the type description does not need to include
-        * this information for the supertable.
-        *
-        * <P>Each type description has the following columns:
-        *      <OL>
-        *      <LI><B>TABLE_CAT</B> String => the type's catalog (may be <code>null</code>)
-        *      <LI><B>TABLE_SCHEM</B> String => type's schema (may be <code>null</code>)
-        *      <LI><B>TABLE_NAME</B> String => type name
-        *      <LI><B>SUPERTABLE_NAME</B> String => the direct super type's name
-        *      </OL>
-        *
-        * <P><B>Note:</B> If the driver does not support type hierarchies, an
-        * empty result set is returned.
-        *
-        * @param catalog a catalog name; "" retrieves those without a catalog;
-        *                <code>null</code> means drop catalog name from the selection criteria
-        * @param schemaPattern a schema name pattern; "" retrieves those
-        *                without a schema
-        * @param tableNamePattern a table name pattern; may be a fully-qualified
-        *                name
-        * @return a <code>ResultSet</code> object in which each row is a type description
-        * @throws SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public ResultSet getSuperTables(String catalog, String schemaPattern,
-                                                                       String tableNamePattern) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves a description of the given attribute of the given type
-        * for a user-defined type (UDT) that is available in the given schema
-        * and catalog.
-        * <P>
-        * Descriptions are returned only for attributes of UDTs matching the
-        * catalog, schema, type, and attribute name criteria. They are ordered by
-        * TYPE_SCHEM, TYPE_NAME and ORDINAL_POSITION. This description
-        * does not contain inherited attributes.
-        * <P>
-        * The <code>ResultSet</code> object that is returned has the following
-        * columns:
-        * <OL>
-        *      <LI><B>TYPE_CAT</B> String => type catalog (may be <code>null</code>)
-        *      <LI><B>TYPE_SCHEM</B> String => type schema (may be <code>null</code>)
-        *      <LI><B>TYPE_NAME</B> String => type name
-        *      <LI><B>ATTR_NAME</B> String => attribute name
-        *      <LI><B>DATA_TYPE</B> short => attribute type SQL type from java.sql.Types
-        *      <LI><B>ATTR_TYPE_NAME</B> String => Data source dependent type name.
-        *      For a UDT, the type name is fully qualified. For a REF, the type name is
-        *      fully qualified and represents the target type of the reference type.
-        *      <LI><B>ATTR_SIZE</B> int => column size.  For char or date
-        *              types this is the maximum number of characters; for numeric or
-        *              decimal types this is precision.
-        *      <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits
-        *      <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2)
-        *      <LI><B>NULLABLE</B> int => whether NULL is allowed
-        *              <UL>
-        *              <LI> attributeNoNulls - might not allow NULL values
-        *              <LI> attributeNullable - definitely allows NULL values
-        *              <LI> attributeNullableUnknown - nullability unknown
-        *              </UL>
-        *      <LI><B>REMARKS</B> String => comment describing column (may be <code>null</code>)
-        *      <LI><B>ATTR_DEF</B> String => default value (may be <code>null</code>)
-        *      <LI><B>SQL_DATA_TYPE</B> int => unused
-        *      <LI><B>SQL_DATETIME_SUB</B> int => unused
-        *      <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the
-        *               maximum number of bytes in the column
-        *      <LI><B>ORDINAL_POSITION</B> int => index of column in table
-        *              (starting at 1)
-        *      <LI><B>IS_NULLABLE</B> String => "NO" means column definitely
-        *              does not allow NULL values; "YES" means the column might
-        *              allow NULL values.      An empty string means unknown.
-        *      <LI><B>SCOPE_CATALOG</B> String => catalog of table that is the
-        *              scope of a reference attribute (<code>null</code> if DATA_TYPE isn't REF)
-        *      <LI><B>SCOPE_SCHEMA</B> String => schema of table that is the
-        *              scope of a reference attribute (<code>null</code> if DATA_TYPE isn't REF)
-        *      <LI><B>SCOPE_TABLE</B> String => table name that is the scope of a
-        *              reference attribute (<code>null</code> if the DATA_TYPE isn't REF)
-        * <LI><B>SOURCE_DATA_TYPE</B> short => source type of a distinct type or user-generated
-        *              Ref type,SQL type from java.sql.Types (<code>null</code> if DATA_TYPE
-        *              isn't DISTINCT or user-generated REF)
-        *      </OL>
-        * @param catalog a catalog name; must match the catalog name as it
-        *                is stored in the database; "" retrieves those without a catalog;
-        *                <code>null</code> means that the catalog name should not be used to narrow
-        *                the search
-        * @param schemaPattern a schema name pattern; must match the schema name
-        *                as it is stored in the database; "" retrieves those without a schema;
-        *                <code>null</code> means that the schema name should not be used to narrow
-        *                the search
-        * @param typeNamePattern a type name pattern; must match the
-        *                type name as it is stored in the database
-        * @param attributeNamePattern an attribute name pattern; must match the attribute
-        *                name as it is declared in the database
-        * @return a <code>ResultSet</code> object in which each row is an
-        *                 attribute description
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public ResultSet getAttributes(String catalog, String schemaPattern,
-                                                                  String typeNamePattern, String attributeNamePattern)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves whether this database supports the given result set holdability.
-        *
-        * @param holdability one of the following constants:
-        *                      <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
-        *                      <code>ResultSet.CLOSE_CURSORS_AT_COMMIT<code>
-        * @return <code>true</code> if so; <code>false</code> otherwise
-        * @exception SQLException if a database access error occurs
-        * @see Connection
-        * @since 1.4
-        */
-       public boolean supportsResultSetHoldability(int holdability) throws SQLException
-       {
-               return true;
-       }
-
-       /**
-        * Retrieves the default holdability of this <code>ResultSet</code>
-        * object.
-        *
-        * @return the default holdability; either
-        *                 <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
-        *                 <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public int getResultSetHoldability() throws SQLException
-       {
-               return ResultSet.HOLD_CURSORS_OVER_COMMIT;
-       }
-
-       /**
-        * Retrieves the major version number of the underlying database.
-        *
-        * @return the underlying database's major version
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public int getDatabaseMajorVersion() throws SQLException
-       {
-               return connection.getServerMajorVersion();
-       }
-
-       /**
-        * Retrieves the minor version number of the underlying database.
-        *
-        * @return underlying database's minor version
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public int getDatabaseMinorVersion() throws SQLException
-       {
-               return connection.getServerMinorVersion();
-       }
-
-       /**
-        * Retrieves the major JDBC version number for this
-        * driver.
-        *
-        * @return JDBC version major number
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public int getJDBCMajorVersion() throws SQLException
-       {
-               return 3; // This class implements JDBC 3.0
-       }
-
-       /**
-        * Retrieves the minor JDBC version number for this
-        * driver.
-        *
-        * @return JDBC version minor number
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public int getJDBCMinorVersion() throws SQLException
-       {
-               return 0; // This class implements JDBC 3.0
-       }
-
-       /**
-        * Indicates whether the SQLSTATEs returned by <code>SQLException.getSQLState</code>
-        * is X/Open (now known as Open Group) SQL CLI or SQL99.
-        * @return the type of SQLSTATEs, one of:
-        *                sqlStateXOpen or
-        *                sqlStateSQL99
-        * @throws SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public int getSQLStateType() throws SQLException
-       {
-               return DatabaseMetaData.sqlStateSQL99;
-       }
-
-       /**
-        * Indicates whether updates made to a LOB are made on a copy or directly
-        * to the LOB.
-        * @return <code>true</code> if updates are made to a copy of the LOB;
-        *                 <code>false</code> if updates are made directly to the LOB
-        * @throws SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public boolean locatorsUpdateCopy() throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves weather this database supports statement pooling.
-        *
-        * @return <code>true</code> is so;
-               <code>false</code> otherwise
-        * @throws SQLExcpetion if a database access error occurs
-        * @since 1.4
-        */
-       public boolean supportsStatementPooling() throws SQLException
-       {
-               return false;
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
deleted file mode 100644 (file)
index 5818565..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java,v 1.5 2003/11/29 19:52:11 pgsql 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
- */
-public abstract class AbstractJdbc3ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet
-{
-
-       public AbstractJdbc3ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
-       {
-               super (statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
-       }
-
-       /**
-        * Retrieves the value of the designated column in the current row
-        * of this <code>ResultSet</code> object as a <code>java.net.URL</code>
-        * object in the Java programming language.
-        *
-        * @param columnIndex the index of the column 1 is the first, 2 is the second,...
-        * @return the column value as a <code>java.net.URL</code> object;
-        * if the value is SQL <code>NULL</code>,
-        * the value returned is <code>null</code> in the Java programming language
-        * @exception SQLException if a database access error occurs,
-        *                        or if a URL is malformed
-        * @since 1.4
-        */
-       public java.net.URL getURL(int columnIndex) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of the designated column in the current row
-        * of this <code>ResultSet</code> object as a <code>java.net.URL</code>
-        * object in the Java programming language.
-        *
-        * @param columnName the SQL name of the column
-        * @return the column value as a <code>java.net.URL</code> object;
-        * if the value is SQL <code>NULL</code>,
-        * the value returned is <code>null</code> in the Java programming language
-        * @exception SQLException if a database access error occurs
-        *                        or if a URL is malformed
-        * @since 1.4
-        */
-       public java.net.URL getURL(String columnName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Updates the designated column with a <code>java.sql.Ref</code> value.
-        * The updater methods are used to update column values in the
-        * current row or the insert row.  The updater methods do not
-        * update the underlying database; instead the <code>updateRow</code> or
-        * <code>insertRow</code> methods are called to update the database.
-        *
-        * @param columnIndex the first column is 1, the second is 2, ...
-        * @param x the new column value
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Updates the designated column with a <code>java.sql.Ref</code> value.
-        * The updater methods are used to update column values in the
-        * current row or the insert row.  The updater methods do not
-        * update the underlying database; instead the <code>updateRow</code> or
-        * <code>insertRow</code> methods are called to update the database.
-        *
-        * @param columnName the name of the column
-        * @param x the new column value
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void updateRef(String columnName, java.sql.Ref x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Updates the designated column with a <code>java.sql.Blob</code> value.
-        * The updater methods are used to update column values in the
-        * current row or the insert row.  The updater methods do not
-        * update the underlying database; instead the <code>updateRow</code> or
-        * <code>insertRow</code> methods are called to update the database.
-        *
-        * @param columnIndex the first column is 1, the second is 2, ...
-        * @param x the new column value
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Updates the designated column with a <code>java.sql.Blob</code> value.
-        * The updater methods are used to update column values in the
-        * current row or the insert row.  The updater methods do not
-        * update the underlying database; instead the <code>updateRow</code> or
-        * <code>insertRow</code> methods are called to update the database.
-        *
-        * @param columnName the name of the column
-        * @param x the new column value
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void updateBlob(String columnName, java.sql.Blob x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Updates the designated column with a <code>java.sql.Clob</code> value.
-        * The updater methods are used to update column values in the
-        * current row or the insert row.  The updater methods do not
-        * update the underlying database; instead the <code>updateRow</code> or
-        * <code>insertRow</code> methods are called to update the database.
-        *
-        * @param columnIndex the first column is 1, the second is 2, ...
-        * @param x the new column value
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Updates the designated column with a <code>java.sql.Clob</code> value.
-        * The updater methods are used to update column values in the
-        * current row or the insert row.  The updater methods do not
-        * update the underlying database; instead the <code>updateRow</code> or
-        * <code>insertRow</code> methods are called to update the database.
-        *
-        * @param columnName the name of the column
-        * @param x the new column value
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void updateClob(String columnName, java.sql.Clob x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Updates the designated column with a <code>java.sql.Array</code> value.
-        * The updater methods are used to update column values in the
-        * current row or the insert row.  The updater methods do not
-        * update the underlying database; instead the <code>updateRow</code> or
-        * <code>insertRow</code> methods are called to update the database.
-        *
-        * @param columnIndex the first column is 1, the second is 2, ...
-        * @param x the new column value
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void updateArray(int columnIndex, java.sql.Array x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Updates the designated column with a <code>java.sql.Array</code> value.
-        * The updater methods are used to update column values in the
-        * current row or the insert row.  The updater methods do not
-        * update the underlying database; instead the <code>updateRow</code> or
-        * <code>insertRow</code> methods are called to update the database.
-        *
-        * @param columnName the name of the column
-        * @param x the new column value
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void updateArray(String columnName, java.sql.Array x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java
deleted file mode 100644 (file)
index 742b6f3..0000000
+++ /dev/null
@@ -1,1374 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.math.BigDecimal;
-import java.sql.*;
-import java.util.Calendar;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Statement.java,v 1.4 2003/11/29 19:52:11 pgsql Exp $
- * This class defines methods of the jdbc3 specification.  This class extends
- * org.postgresql.jdbc2.AbstractJdbc2Statement which provides the jdbc2
- * methods.  The real Statement class (for jdbc2) is org.postgresql.jdbc3.Jdbc3Statement
- */
-public abstract class AbstractJdbc3Statement extends org.postgresql.jdbc2.AbstractJdbc2Statement
-{
-
-       public AbstractJdbc3Statement (AbstractJdbc3Connection c)
-       {
-               super(c);
-       }
-
-       public AbstractJdbc3Statement(AbstractJdbc3Connection connection, String sql) throws SQLException
-       {
-               super(connection, sql);
-       }
-
-       /**
-        * Moves to this <code>Statement</code> object's next result, deals with
-        * any current <code>ResultSet</code> object(s) according  to the instructions
-        * specified by the given flag, and returns
-        * <code>true</code> if the next result is a <code>ResultSet</code> object.
-        *
-        * <P>There are no more results when the following is true:
-        * <PRE>
-        *              <code>(!getMoreResults() && (getUpdateCount() == -1)</code>
-        * </PRE>
-        *
-        * @param current one of the following <code>Statement</code>
-        *                constants indicating what should happen to current
-        *                <code>ResultSet</code> objects obtained using the method
-        *                <code>getResultSet</code:
-        *                <code>CLOSE_CURRENT_RESULT</code>,
-        *                <code>KEEP_CURRENT_RESULT</code>, or
-        *                <code>CLOSE_ALL_RESULTS</code>
-        * @return <code>true</code> if the next result is a <code>ResultSet</code>
-        *                 object; <code>false</code> if it is an update count or there are no
-        *                 more results
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        * @see #execute
-        */
-       public boolean getMoreResults(int current) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves any auto-generated keys created as a result of executing this
-        * <code>Statement</code> object. If this <code>Statement</code> object did
-        * not generate any keys, an empty <code>ResultSet</code>
-        * object is returned.
-        *
-        * @return a <code>ResultSet</code> object containing the auto-generated key(s)
-        *                 generated by the execution of this <code>Statement</code> object
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public ResultSet getGeneratedKeys() throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Executes the given SQL statement and signals the driver with the
-        * given flag about whether the
-        * auto-generated keys produced by this <code>Statement</code> object
-        * should be made available for retrieval.
-        *
-        * @param sql must be an SQL <code>INSERT</code>, <code>UPDATE</code> or
-        *                <code>DELETE</code> statement or an SQL statement that
-        *                returns nothing
-        * @param autoGeneratedKeys a flag indicating whether auto-generated keys
-        *                should be made available for retrieval;
-        *                 one of the following constants:
-        *                 <code>Statement.RETURN_GENERATED_KEYS</code>
-        *                 <code>Statement.NO_GENERATED_KEYS</code>
-        * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>
-        *                 or <code>DELETE</code> statements, or <code>0</code> for SQL
-        *                 statements that return nothing
-        * @exception SQLException if a database access error occurs, the given
-        *                        SQL statement returns a <code>ResultSet</code> object, or
-        *                        the given constant is not one of those allowed
-        * @since 1.4
-        */
-       public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Executes the given SQL statement and signals the driver that the
-        * auto-generated keys indicated in the given array should be made available
-        * for retrieval.  The driver will ignore the array if the SQL statement
-        * is not an <code>INSERT</code> statement.
-        *
-        * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or
-        *                <code>DELETE</code> statement or an SQL statement that returns nothing,
-        *                such as an SQL DDL statement
-        * @param columnIndexes an array of column indexes indicating the columns
-        *                that should be returned from the inserted row
-        * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
-        *                 or <code>DELETE</code> statements, or 0 for SQL statements
-        *                 that return nothing
-        * @exception SQLException if a database access error occurs or the SQL
-        *                        statement returns a <code>ResultSet</code> object
-        * @since 1.4
-        */
-       public int executeUpdate(String sql, int columnIndexes[]) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Executes the given SQL statement and signals the driver that the
-        * auto-generated keys indicated in the given array should be made available
-        * for retrieval.  The driver will ignore the array if the SQL statement
-        * is not an <code>INSERT</code> statement.
-        *
-        * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or
-        *                <code>DELETE</code> statement or an SQL statement that returns nothing
-        * @param columnNames an array of the names of the columns that should be
-        *                returned from the inserted row
-        * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
-        *                 or <code>DELETE</code> statements, or 0 for SQL statements
-        *                 that return nothing
-        * @exception SQLException if a database access error occurs
-        *
-        * @since 1.4
-        */
-       public int executeUpdate(String sql, String columnNames[]) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Executes the given SQL statement, which may return multiple results,
-        * and signals the driver that any
-        * auto-generated keys should be made available
-        * for retrieval.  The driver will ignore this signal if the SQL statement
-        * is not an <code>INSERT</code> statement.
-        * <P>
-        * In some (uncommon) situations, a single SQL statement may return
-        * multiple result sets and/or update counts.  Normally you can ignore
-        * this unless you are (1) executing a stored procedure that you know may
-        * return multiple results or (2) you are dynamically executing an
-        * unknown SQL string.
-        * <P>
-        * The <code>execute</code> method executes an SQL statement and indicates the
-        * form of the first result.  You must then use the methods
-        * <code>getResultSet</code> or <code>getUpdateCount</code>
-        * to retrieve the result, and <code>getMoreResults</code> to
-        * move to any subsequent result(s).
-        *
-        * @param sql any SQL statement
-        * @param autoGeneratedKeys a constant indicating whether auto-generated
-        *                keys should be made available for retrieval using the method
-        *                <code>getGeneratedKeys</code>; one of the following constants:
-        *                <code>Statement.RETURN_GENERATED_KEYS</code> or
-        *                <code>Statement.NO_GENERATED_KEYS</code>
-        * @return <code>true</code> if the first result is a <code>ResultSet</code>
-        *                 object; <code>false</code> if it is an update count or there are
-        *                 no results
-        * @exception SQLException if a database access error occurs
-        * @see #getResultSet
-        * @see #getUpdateCount
-        * @see #getMoreResults
-        * @see #getGeneratedKeys
-        *
-        * @since 1.4
-        */
-       public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Executes the given SQL statement, which may return multiple results,
-        * and signals the driver that the
-        * auto-generated keys indicated in the given array should be made available
-        * for retrieval.  This array contains the indexes of the columns in the
-        * target table that contain the auto-generated keys that should be made
-        * available. The driver will ignore the array if the given SQL statement
-        * is not an <code>INSERT</code> statement.
-        * <P>
-        * Under some (uncommon) situations, a single SQL statement may return
-        * multiple result sets and/or update counts.  Normally you can ignore
-        * this unless you are (1) executing a stored procedure that you know may
-        * return multiple results or (2) you are dynamically executing an
-        * unknown SQL string.
-        * <P>
-        * The <code>execute</code> method executes an SQL statement and indicates the
-        * form of the first result.  You must then use the methods
-        * <code>getResultSet</code> or <code>getUpdateCount</code>
-        * to retrieve the result, and <code>getMoreResults</code> to
-        * move to any subsequent result(s).
-        *
-        * @param sql any SQL statement
-        * @param columnIndexes an array of the indexes of the columns in the
-        *                inserted row that should be  made available for retrieval by a
-        *                call to the method <code>getGeneratedKeys</code>
-        * @return <code>true</code> if the first result is a <code>ResultSet</code>
-        *                 object; <code>false</code> if it is an update count or there
-        *                 are no results
-        * @exception SQLException if a database access error occurs
-        * @see #getResultSet
-        * @see #getUpdateCount
-        * @see #getMoreResults
-        *
-        * @since 1.4
-        */
-       public boolean execute(String sql, int columnIndexes[]) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Executes the given SQL statement, which may return multiple results,
-        * and signals the driver that the
-        * auto-generated keys indicated in the given array should be made available
-        * for retrieval. This array contains the names of the columns in the
-        * target table that contain the auto-generated keys that should be made
-        * available. The driver will ignore the array if the given SQL statement
-        * is not an <code>INSERT</code> statement.
-        * <P>
-        * In some (uncommon) situations, a single SQL statement may return
-        * multiple result sets and/or update counts.  Normally you can ignore
-        * this unless you are (1) executing a stored procedure that you know may
-        * return multiple results or (2) you are dynamically executing an
-        * unknown SQL string.
-        * <P>
-        * The <code>execute</code> method executes an SQL statement and indicates the
-        * form of the first result.  You must then use the methods
-        * <code>getResultSet</code> or <code>getUpdateCount</code>
-        * to retrieve the result, and <code>getMoreResults</code> to
-        * move to any subsequent result(s).
-        *
-        * @param sql any SQL statement
-        * @param columnNames an array of the names of the columns in the inserted
-        *                row that should be made available for retrieval by a call to the
-        *                method <code>getGeneratedKeys</code>
-        * @return <code>true</code> if the next result is a <code>ResultSet</code>
-        *                 object; <code>false</code> if it is an update count or there
-        *                 are no more results
-        * @exception SQLException if a database access error occurs
-        * @see #getResultSet
-        * @see #getUpdateCount
-        * @see #getMoreResults
-        * @see #getGeneratedKeys
-        *
-        * @since 1.4
-        */
-       public boolean execute(String sql, String columnNames[]) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-         * Retrieves the result set holdability for <code>ResultSet</code> objects
-         * generated by this <code>Statement</code> object.
-         *
-         * @return either <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
-         *                     <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
-         * @exception SQLException if a database access error occurs
-         *
-         * @since 1.4
-         */
-       public int getResultSetHoldability() throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given <code>java.net.URL</code> value.
-        * The driver converts this to an SQL <code>DATALINK</code> value
-        * when it sends it to the database.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2, ...
-        * @param x the <code>java.net.URL</code> object to be set
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void setURL(int parameterIndex, java.net.URL x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the number, types and properties of this
-        * <code>PreparedStatement</code> object's parameters.
-        *
-        * @return a <code>ParameterMetaData</code> object that contains information
-        *                 about the number, types and properties of this
-        *                 <code>PreparedStatement</code> object's parameters
-        * @exception SQLException if a database access error occurs
-        * @see ParameterMetaData
-        * @since 1.4
-        */
-       public ParameterMetaData getParameterMetaData() throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Registers the OUT parameter named
-        * <code>parameterName</code> to the JDBC type
-        * <code>sqlType</code>.  All OUT parameters must be registered
-        * before a stored procedure is executed.
-        * <p>
-        * The JDBC type specified by <code>sqlType</code> for an OUT
-        * parameter determines the Java type that must be used
-        * in the <code>get</code> method to read the value of that parameter.
-        * <p>
-        * If the JDBC type expected to be returned to this output parameter
-        * is specific to this particular database, <code>sqlType</code>
-        * should be <code>java.sql.Types.OTHER</code>.  The method
-        * {@link #getObject} retrieves the value.
-        * @param parameterName the name of the parameter
-        * @param sqlType the JDBC type code defined by <code>java.sql.Types</code>.
-        * If the parameter is of JDBC type <code>NUMERIC</code>
-        * or <code>DECIMAL</code>, the version of
-        * <code>registerOutParameter</code> that accepts a scale value
-        * should be used.
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        * @see Types
-        */
-       public void registerOutParameter(String parameterName, int sqlType)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Registers the parameter named
-        * <code>parameterName</code> to be of JDBC type
-        * <code>sqlType</code>.  This method must be called
-        * before a stored procedure is executed.
-        * <p>
-        * The JDBC type specified by <code>sqlType</code> for an OUT
-        * parameter determines the Java type that must be used
-        * in the <code>get</code> method to read the value of that parameter.
-        * <p>
-        * This version of <code>registerOutParameter</code> should be
-        * used when the parameter is of JDBC type <code>NUMERIC</code>
-        * or <code>DECIMAL</code>.
-        * @param parameterName the name of the parameter
-        * @param sqlType SQL type code defined by <code>java.sql.Types</code>.
-        * @param scale the desired number of digits to the right of the
-        * decimal point.  It must be greater than or equal to zero.
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        * @see Types
-        */
-       public void registerOutParameter(String parameterName, int sqlType, int scale)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Registers the designated output parameter.  This version of
-        * the method <code>registerOutParameter</code>
-        * should be used for a user-named or REF output parameter.  Examples
-        * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and
-        * named array types.
-        *
-        * Before executing a stored procedure call, you must explicitly
-        * call <code>registerOutParameter</code> to register the type from
-        * <code>java.sql.Types</code> for each
-        * OUT parameter.  For a user-named parameter the fully-qualified SQL
-        * type name of the parameter should also be given, while a REF
-        * parameter requires that the fully-qualified type name of the
-        * referenced type be given.  A JDBC driver that does not need the
-        * type code and type name information may ignore it.   To be portable,
-        * however, applications should always provide these values for
-        * user-named and REF parameters.
-        *
-        * Although it is intended for user-named and REF parameters,
-        * this method may be used to register a parameter of any JDBC type.
-        * If the parameter does not have a user-named or REF type, the
-        * typeName parameter is ignored.
-        *
-        * <P><B>Note:</B> When reading the value of an out parameter, you
-        * must use the <code>getXXX</code> method whose Java type XXX corresponds to the
-        * parameter's registered SQL type.
-        *
-        * @param parameterName the name of the parameter
-        * @param sqlType a value from {@link java.sql.Types}
-        * @param typeName the fully-qualified name of an SQL structured type
-        * @exception SQLException if a database access error occurs
-        * @see Types
-        * @since 1.4
-        */
-       public void registerOutParameter (String parameterName, int sqlType, String typeName)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of the designated JDBC <code>DATALINK</code> parameter as a
-        * <code>java.net.URL</code> object.
-        *
-        * @param parameterIndex the first parameter is 1, the second is 2,...
-        * @return a <code>java.net.URL</code> object that represents the
-        *                 JDBC <code>DATALINK</code> value used as the designated
-        *                 parameter
-        * @exception SQLException if a database access error occurs,
-        *                        or if the URL being returned is
-        *                        not a valid URL on the Java platform
-        * @see #setURL
-        * @since 1.4
-        */
-       public java.net.URL getURL(int parameterIndex) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given <code>java.net.URL</code> object.
-        * The driver converts this to an SQL <code>DATALINK</code> value when
-        * it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param val the parameter value
-        * @exception SQLException if a database access error occurs,
-        *                        or if a URL is malformed
-        * @see #getURL
-        * @since 1.4
-        */
-       public void setURL(String parameterName, java.net.URL val) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to SQL <code>NULL</code>.
-        *
-        * <P><B>Note:</B> You must specify the parameter's SQL type.
-        *
-        * @param parameterName the name of the parameter
-        * @param sqlType the SQL type code defined in <code>java.sql.Types</code>
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void setNull(String parameterName, int sqlType) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given Java <code>boolean</code> value.
-        * The driver converts this
-        * to an SQL <code>BIT</code> value when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getBoolean
-        * @since 1.4
-        */
-       public void setBoolean(String parameterName, boolean x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given Java <code>byte</code> value.
-        * The driver converts this
-        * to an SQL <code>TINYINT</code> value when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getByte
-        * @since 1.4
-        */
-       public void setByte(String parameterName, byte x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given Java <code>short</code> value.
-        * The driver converts this
-        * to an SQL <code>SMALLINT</code> value when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getShort
-        * @since 1.4
-        */
-       public void setShort(String parameterName, short x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given Java <code>int</code> value.
-        * The driver converts this
-        * to an SQL <code>INTEGER</code> value when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getInt
-        * @since 1.4
-        */
-       public void setInt(String parameterName, int x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given Java <code>long</code> value.
-        * The driver converts this
-        * to an SQL <code>BIGINT</code> value when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getLong
-        * @since 1.4
-        */
-       public void setLong(String parameterName, long x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given Java <code>float</code> value.
-        * The driver converts this
-        * to an SQL <code>FLOAT</code> value when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getFloat
-        * @since 1.4
-        */
-       public void setFloat(String parameterName, float x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given Java <code>double</code> value.
-        * The driver converts this
-        * to an SQL <code>DOUBLE</code> value when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getDouble
-        * @since 1.4
-        */
-       public void setDouble(String parameterName, double x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given
-        * <code>java.math.BigDecimal</code> value.
-        * The driver converts this to an SQL <code>NUMERIC</code> value when
-        * it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getBigDecimal
-        * @since 1.4
-        */
-       public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given Java <code>String</code> value.
-        * The driver converts this
-        * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
-        * (depending on the argument's
-        * size relative to the driver's limits on <code>VARCHAR</code> values)
-        * when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getString
-        * @since 1.4
-        */
-       public void setString(String parameterName, String x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given Java array of bytes.
-        * The driver converts this to an SQL <code>VARBINARY</code> or
-        * <code>LONGVARBINARY</code> (depending on the argument's size relative 
-        * to the driver's limits on <code>VARBINARY</code> values) when it sends 
-        * it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getBytes
-        * @since 1.4
-        */
-       public void setBytes(String parameterName, byte x[]) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given <code>java.sql.Date</code> value.
-        * The driver converts this
-        * to an SQL <code>DATE</code> value when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getDate
-        * @since 1.4
-        */
-       public void setDate(String parameterName, java.sql.Date x)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given <code>java.sql.Time</code> value.
-        * The driver converts this
-        * to an SQL <code>TIME</code> value when it sends it to the database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getTime
-        * @since 1.4
-        */
-       public void setTime(String parameterName, java.sql.Time x)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.
-        * The driver
-        * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the
-        * database.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #getTimestamp
-        * @since 1.4
-        */
-       public void setTimestamp(String parameterName, java.sql.Timestamp x)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given input stream, which will have
-        * the specified number of bytes.
-        * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
-        * parameter, it may be more practical to send it via a
-        * <code>java.io.InputStream</code>. Data will be read from the stream
-        * as needed until end-of-file is reached.      The JDBC driver will
-        * do any necessary conversion from ASCII to the database char format.
-        *
-        * <P><B>Note:</B> This stream object can either be a standard
-        * Java stream object or your own subclass that implements the
-        * standard interface.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the Java input stream that contains the ASCII parameter value
-        * @param length the number of bytes in the stream
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void setAsciiStream(String parameterName, java.io.InputStream x, int length)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given input stream, which will have
-        * the specified number of bytes.
-        * When a very large binary value is input to a <code>LONGVARBINARY</code>
-        * parameter, it may be more practical to send it via a
-        * <code>java.io.InputStream</code> object. The data will be read from the stream
-        * as needed until end-of-file is reached.
-        *
-        * <P><B>Note:</B> This stream object can either be a standard
-        * Java stream object or your own subclass that implements the
-        * standard interface.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the java input stream which contains the binary parameter value
-        * @param length the number of bytes in the stream
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void setBinaryStream(String parameterName, java.io.InputStream x,
-                                                               int length) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the value of the designated parameter with the given object. The second
-        * argument must be an object type; for integral values, the
-        * <code>java.lang</code> equivalent objects should be used.
-        *
-        * <p>The given Java object will be converted to the given targetSqlType
-        * before being sent to the database.
-        *
-        * If the object has a custom mapping (is of a class implementing the
-        * interface <code>SQLData</code>),
-        * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it
-        * to the SQL data stream.
-        * If, on the other hand, the object is of a class implementing
-        * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
-        * or <code>Array</code>, the driver should pass it to the database as a
-        * value of the corresponding SQL type.
-        * <P>
-        * Note that this method may be used to pass datatabase-
-        * specific abstract data types.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the object containing the input parameter value
-        * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
-        * sent to the database. The scale argument may further qualify this type.
-        * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
-        *                      this is the number of digits after the decimal point.  For all other
-        *                      types, this value will be ignored.
-        * @exception SQLException if a database access error occurs
-        * @see Types
-        * @see #getObject
-        * @since 1.4
-        */
-       public void setObject(String parameterName, Object x, int targetSqlType, int scale)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the value of the designated parameter with the given object.
-        * This method is like the method <code>setObject</code>
-        * above, except that it assumes a scale of zero.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the object containing the input parameter value
-        * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
-        *                                              sent to the database
-        * @exception SQLException if a database access error occurs
-        * @see #getObject
-        * @since 1.4
-        */
-       public void setObject(String parameterName, Object x, int targetSqlType)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the value of the designated parameter with the given object.
-        * The second parameter must be of type <code>Object</code>; therefore, the
-        * <code>java.lang</code> equivalent objects should be used for built-in types.
-        *
-        * <p>The JDBC specification specifies a standard mapping from
-        * Java <code>Object</code> types to SQL types.  The given argument
-        * will be converted to the corresponding SQL type before being
-        * sent to the database.
-        *
-        * <p>Note that this method may be used to pass datatabase-
-        * specific abstract data types, by using a driver-specific Java
-        * type.
-        *
-        * If the object is of a class implementing the interface <code>SQLData</code>,
-        * the JDBC driver should call the method <code>SQLData.writeSQL</code>
-        * to write it to the SQL data stream.
-        * If, on the other hand, the object is of a class implementing
-        * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
-        * or <code>Array</code>, the driver should pass it to the database as a
-        * value of the corresponding SQL type.
-        * <P>
-        * This method throws an exception if there is an ambiguity, for example, if the
-        * object is of a class implementing more than one of the interfaces named above.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the object containing the input parameter value
-        * @exception SQLException if a database access error occurs or if the given
-        *                        <code>Object</code> parameter is ambiguous
-        * @see #getObject
-        * @since 1.4
-        */
-       public void setObject(String parameterName, Object x) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-
-       /**
-        * Sets the designated parameter to the given <code>Reader</code>
-        * object, which is the given number of characters long.
-        * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
-        * parameter, it may be more practical to send it via a
-        * <code>java.io.Reader</code> object. The data will be read from the stream
-        * as needed until end-of-file is reached.      The JDBC driver will
-        * do any necessary conversion from UNICODE to the database char format.
-        *
-        * <P><B>Note:</B> This stream object can either be a standard
-        * Java stream object or your own subclass that implements the
-        * standard interface.
-        *
-        * @param parameterName the name of the parameter
-        * @param reader the <code>java.io.Reader</code> object that
-        *                contains the UNICODE data used as the designated parameter
-        * @param length the number of characters in the stream
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void setCharacterStream(String parameterName,
-                                                                  java.io.Reader reader,
-                                                                  int length) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given <code>java.sql.Date</code> value,
-        * using the given <code>Calendar</code> object.  The driver uses
-        * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
-        * which the driver then sends to the database.  With a
-        * a <code>Calendar</code> object, the driver can calculate the date
-        * taking into account a custom timezone.  If no
-        * <code>Calendar</code> object is specified, the driver uses the default
-        * timezone, which is that of the virtual machine running the application.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @param cal the <code>Calendar</code> object the driver will use
-        *                        to construct the date
-        * @exception SQLException if a database access error occurs
-        * @see #getDate
-        * @since 1.4
-        */
-       public void setDate(String parameterName, java.sql.Date x, Calendar cal)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given <code>java.sql.Time</code> value,
-        * using the given <code>Calendar</code> object.  The driver uses
-        * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
-        * which the driver then sends to the database.  With a
-        * a <code>Calendar</code> object, the driver can calculate the time
-        * taking into account a custom timezone.  If no
-        * <code>Calendar</code> object is specified, the driver uses the default
-        * timezone, which is that of the virtual machine running the application.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @param cal the <code>Calendar</code> object the driver will use
-        *                        to construct the time
-        * @exception SQLException if a database access error occurs
-        * @see #getTime
-        * @since 1.4
-        */
-       public void setTime(String parameterName, java.sql.Time x, Calendar cal)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
-        * using the given <code>Calendar</code> object.  The driver uses
-        * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
-        * which the driver then sends to the database.  With a
-        * a <code>Calendar</code> object, the driver can calculate the timestamp
-        * taking into account a custom timezone.  If no
-        * <code>Calendar</code> object is specified, the driver uses the default
-        * timezone, which is that of the virtual machine running the application.
-        *
-        * @param parameterName the name of the parameter
-        * @param x the parameter value
-        * @param cal the <code>Calendar</code> object the driver will use
-        *                        to construct the timestamp
-        * @exception SQLException if a database access error occurs
-        * @see #getTimestamp
-        * @since 1.4
-        */
-       public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Sets the designated parameter to SQL <code>NULL</code>.
-        * This version of the method <code>setNull</code> should
-        * be used for user-defined types and REF type parameters.      Examples
-        * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
-        * named array types.
-        *
-        * <P><B>Note:</B> To be portable, applications must give the
-        * SQL type code and the fully-qualified SQL type name when specifying
-        * a NULL user-defined or REF parameter.  In the case of a user-defined type
-        * the name is the type name of the parameter itself.  For a REF
-        * parameter, the name is the type name of the referenced type.  If
-        * a JDBC driver does not need the type code or type name information,
-        * it may ignore it.
-        *
-        * Although it is intended for user-defined and Ref parameters,
-        * this method may be used to set a null parameter of any JDBC type.
-        * If the parameter does not have a user-defined or REF type, the given
-        * typeName is ignored.
-        *
-        *
-        * @param paramName the name of the parameter
-        * @param sqlType a value from <code>java.sql.Types</code>
-        * @param typeName the fully-qualified name of an SQL user-defined type;
-        *                ignored if the parameter is not a user-defined type or
-        *                SQL <code>REF</code> value
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public void setNull (String parameterName, int sqlType, String typeName)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>CHAR</code>, <code>VARCHAR</code>,
-        * or <code>LONGVARCHAR</code> parameter as a <code>String</code> in
-        * the Java programming language.
-        * <p>
-        * For the fixed-length type JDBC <code>CHAR</code>,
-        * the <code>String</code> object
-        * returned has exactly the same value the JDBC
-        * <code>CHAR</code> value had in the
-        * database, including any padding added by the database.
-        * @param parameterName the name of the parameter
-        * @return the parameter value. If the value is SQL <code>NULL</code>, the result
-        * is <code>null</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setString
-        * @since 1.4
-        */
-       public String getString(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>BIT</code> parameter as a
-        * <code>boolean</code> in the Java programming language.
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>, the result
-        * is <code>false</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setBoolean
-        * @since 1.4
-        */
-       public boolean getBoolean(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>TINYINT</code> parameter as a <code>byte</code>
-        * in the Java programming language.
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>, the result
-        * is <code>0</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setByte
-        * @since 1.4
-        */
-       public byte getByte(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>SMALLINT</code> parameter as a <code>short</code>
-        * in the Java programming language.
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>, the result
-        * is <code>0</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setShort
-        * @since 1.4
-        */
-       public short getShort(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>INTEGER</code> parameter as an <code>int</code>
-        * in the Java programming language.
-        *
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>,
-        *                 the result is <code>0</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setInt
-        * @since 1.4
-        */
-       public int getInt(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>BIGINT</code> parameter as a <code>long</code>
-        * in the Java programming language.
-        *
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>,
-        *                 the result is <code>0</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setLong
-        * @since 1.4
-        */
-       public long getLong(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>FLOAT</code> parameter as a <code>float</code>
-        * in the Java programming language.
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>,
-        *                 the result is <code>0</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setFloat
-        * @since 1.4
-        */
-       public float getFloat(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>DOUBLE</code> parameter as a <code>double</code>
-        * in the Java programming language.
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>,
-        *                 the result is <code>0</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setDouble
-        * @since 1.4
-        */
-       public double getDouble(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>BINARY</code> or <code>VARBINARY</code>
-        * parameter as an array of <code>byte</code> values in the Java
-        * programming language.
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>, the result is
-        *      <code>null</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setBytes
-        * @since 1.4
-        */
-       public byte[] getBytes(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>DATE</code> parameter as a
-        * <code>java.sql.Date</code> object.
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>, the result
-        * is <code>null</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setDate
-        * @since 1.4
-        */
-       public java.sql.Date getDate(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>TIME</code> parameter as a
-        * <code>java.sql.Time</code> object.
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>, the result
-        * is <code>null</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setTime
-        * @since 1.4
-        */
-       public java.sql.Time getTime(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>TIMESTAMP</code> parameter as a
-        * <code>java.sql.Timestamp</code> object.
-        * @param parameterName the name of the parameter
-        * @return the parameter value.  If the value is SQL <code>NULL</code>, the result
-        * is <code>null</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setTimestamp
-        * @since 1.4
-        */
-       public java.sql.Timestamp getTimestamp(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a parameter as an <code>Object</code> in the Java
-        * programming language. If the value is an SQL <code>NULL</code>, the
-        * driver returns a Java <code>null</code>.
-        * <p>
-        * This method returns a Java object whose type corresponds to the JDBC
-        * type that was registered for this parameter using the method
-        * <code>registerOutParameter</code>.  By registering the target JDBC
-        * type as <code>java.sql.Types.OTHER</code>, this method can be used
-        * to read database-specific abstract data types.
-        * @param parameterName the name of the parameter
-        * @return A <code>java.lang.Object</code> holding the OUT parameter value.
-        * @exception SQLException if a database access error occurs
-        * @see Types
-        * @see #setObject
-        * @since 1.4
-        */
-       public Object getObject(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>NUMERIC</code> parameter as a
-        * <code>java.math.BigDecimal</code> object with as many digits to the
-        * right of the decimal point as the value contains.
-        * @param parameterName the name of the parameter
-        * @return the parameter value in full precision.  If the value is
-        * SQL <code>NULL</code>, the result is <code>null</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setBigDecimal
-        * @since 1.4
-        */
-       public BigDecimal getBigDecimal(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Returns an object representing the value of OUT parameter
-        * <code>i</code> and uses <code>map</code> for the custom
-        * mapping of the parameter value.
-        * <p>
-        * This method returns a Java object whose type corresponds to the
-        * JDBC type that was registered for this parameter using the method
-        * <code>registerOutParameter</code>.  By registering the target
-        * JDBC type as <code>java.sql.Types.OTHER</code>, this method can
-        * be used to read database-specific abstract data types.
-        * @param parameterName the name of the parameter
-        * @param map the mapping from SQL type names to Java classes
-        * @return a <code>java.lang.Object</code> holding the OUT parameter value
-        * @exception SQLException if a database access error occurs
-        * @see #setObject
-        * @since 1.4
-        */
-       public Object getObject (String parameterName, java.util.Map map) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>REF(&lt;structured-type&gt;)</code>
-        * parameter as a {@link Ref} object in the Java programming language.
-        *
-        * @param parameterName the name of the parameter
-        * @return the parameter value as a <code>Ref</code> object in the
-        *                 Java programming language.  If the value was SQL <code>NULL</code>,
-        *                 the value <code>null</code> is returned.
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public Ref getRef (String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>BLOB</code> parameter as a
-        * {@link Blob} object in the Java programming language.
-        *
-        * @param parameterName the name of the parameter
-        * @return the parameter value as a <code>Blob</code> object in the
-        *                 Java programming language.  If the value was SQL <code>NULL</code>,
-        *                 the value <code>null</code> is returned.
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public Blob getBlob (String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>CLOB</code> parameter as a
-        * <code>Clob</code> object in the Java programming language.
-        * @param parameterName the name of the parameter
-        * @return the parameter value as a <code>Clob</code> object in the
-        *                 Java programming language.  If the value was SQL <code>NULL</code>,
-        *                 the value <code>null</code> is returned.
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public Clob getClob (String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>ARRAY</code> parameter as an
-        * {@link Array} object in the Java programming language.
-        *
-        * @param parameterName the name of the parameter
-        * @return the parameter value as an <code>Array</code> object in
-        *                 Java programming language.  If the value was SQL <code>NULL</code>,
-        *                 the value <code>null</code> is returned.
-        * @exception SQLException if a database access error occurs
-        * @since 1.4
-        */
-       public Array getArray (String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>DATE</code> parameter as a
-        * <code>java.sql.Date</code> object, using
-        * the given <code>Calendar</code> object
-        * to construct the date.
-        * With a <code>Calendar</code> object, the driver
-        * can calculate the date taking into account a custom timezone and locale.
-        * If no <code>Calendar</code> object is specified, the driver uses the
-        * default timezone and locale.
-        *
-        * @param parameterName the name of the parameter
-        * @param cal the <code>Calendar</code> object the driver will use
-        *                        to construct the date
-        * @return the parameter value.  If the value is SQL <code>NULL</code>,
-        * the result is <code>null</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setDate
-        * @since 1.4
-        */
-       public java.sql.Date getDate(String parameterName, Calendar cal)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>TIME</code> parameter as a
-        * <code>java.sql.Time</code> object, using
-        * the given <code>Calendar</code> object
-        * to construct the time.
-        * With a <code>Calendar</code> object, the driver
-        * can calculate the time taking into account a custom timezone and locale.
-        * If no <code>Calendar</code> object is specified, the driver uses the
-        * default timezone and locale.
-        *
-        * @param parameterName the name of the parameter
-        * @param cal the <code>Calendar</code> object the driver will use
-        *                        to construct the time
-        * @return the parameter value; if the value is SQL <code>NULL</code>, the result is
-        * <code>null</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setTime
-        * @since 1.4
-        */
-       public java.sql.Time getTime(String parameterName, Calendar cal)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>TIMESTAMP</code> parameter as a
-        * <code>java.sql.Timestamp</code> object, using
-        * the given <code>Calendar</code> object to construct
-        * the <code>Timestamp</code> object.
-        * With a <code>Calendar</code> object, the driver
-        * can calculate the timestamp taking into account a custom timezone and locale.
-        * If no <code>Calendar</code> object is specified, the driver uses the
-        * default timezone and locale.
-        *
-        *
-        * @param parameterName the name of the parameter
-        * @param cal the <code>Calendar</code> object the driver will use
-        *                        to construct the timestamp
-        * @return the parameter value.  If the value is SQL <code>NULL</code>, the result is
-        * <code>null</code>.
-        * @exception SQLException if a database access error occurs
-        * @see #setTimestamp
-        * @since 1.4
-        */
-       public java.sql.Timestamp getTimestamp(String parameterName, Calendar cal)
-       throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-
-       /**
-        * Retrieves the value of a JDBC <code>DATALINK</code> parameter as a
-        * <code>java.net.URL</code> object.
-        *
-        * @param parameterName the name of the parameter
-        * @return the parameter value as a <code>java.net.URL</code> object in the
-        * Java programming language.  If the value was SQL <code>NULL</code>, the
-        * value <code>null</code> is returned.
-        * @exception SQLException if a database access error occurs,
-        *                        or if there is a problem with the URL
-        * @see #setURL
-        * @since 1.4
-        */
-       public java.net.URL getURL(String parameterName) throws SQLException
-       {
-               throw org.postgresql.Driver.notImplemented();
-       }
-       
-       public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException
-       {
-               switch (targetSqlType)
-               {
-                       case Types.BOOLEAN:
-                               super.setObject(parameterIndex, x, Types.BIT, scale);
-                       default:
-                               super.setObject(parameterIndex, x, targetSqlType, scale);
-               }
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Blob.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Blob.java
deleted file mode 100644 (file)
index 9d08398..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.*;
-
-public class Jdbc3Blob extends org.postgresql.jdbc3.AbstractJdbc3Blob implements java.sql.Blob
-{
-
-       public Jdbc3Blob(org.postgresql.PGConnection conn, int oid) throws SQLException
-       {
-               super(conn, oid);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java
deleted file mode 100644 (file)
index 0008f0e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.Field;
-
-public class Jdbc3CallableStatement extends org.postgresql.jdbc3.AbstractJdbc3Statement implements java.sql.CallableStatement
-{
-
-       public Jdbc3CallableStatement(Jdbc3Connection connection, String sql) throws SQLException
-       {
-               super(connection, sql);
-       }
-
-       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);
-       }
-
-       public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
-       {
-                return new Jdbc3RefCursorResultSet(this, cursorName);
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Clob.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Clob.java
deleted file mode 100644 (file)
index b65ffc7..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-public class Jdbc3Clob extends org.postgresql.jdbc3.AbstractJdbc3Clob implements java.sql.Clob
-{
-
-       public Jdbc3Clob(org.postgresql.PGConnection conn, int oid) throws java.sql.SQLException
-       {
-               super(conn, oid);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java
deleted file mode 100644 (file)
index 8afafc9..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.SQLException;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java,v 1.6 2003/11/29 19:52:11 pgsql 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
- */
-public class Jdbc3Connection extends org.postgresql.jdbc3.AbstractJdbc3Connection implements java.sql.Connection
-{
-
-       public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
-       {
-               Jdbc3Statement s = new Jdbc3Statement(this);
-               s.setResultSetType(resultSetType);
-               s.setResultSetConcurrency(resultSetConcurrency);
-               return s;
-       }
-
-
-       public java.sql.PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
-       {
-               Jdbc3PreparedStatement s = new Jdbc3PreparedStatement(this, sql);
-               s.setResultSetType(resultSetType);
-               s.setResultSetConcurrency(resultSetConcurrency);
-               return s;
-       }
-
-       public java.sql.CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
-       {
-               Jdbc3CallableStatement s = new Jdbc3CallableStatement(this, sql);
-               s.setResultSetType(resultSetType);
-               s.setResultSetConcurrency(resultSetConcurrency);
-               return s;
-       }
-
-       public java.sql.DatabaseMetaData getMetaData() throws SQLException
-       {
-               if (metadata == null)
-                       metadata = new Jdbc3DatabaseMetaData(this);
-               return metadata;
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ConnectionPool.java
deleted file mode 100644 (file)
index 1f739d5..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.postgresql.jdbc3;
-
-import org.postgresql.jdbc2.optional.ConnectionPool;
-
-import javax.sql.PooledConnection;
-import javax.naming.Reference;
-import java.sql.SQLException;
-
-/**
- * Jdbc3 implementation of ConnectionPoolDataSource.  This is
- * typically the interface used by an app server to interact
- * with connection pools provided by a JDBC driver.  PostgreSQL
- * does not support XADataSource, the other common connection
- * pooling interface (for connections supporting the two-phase
- * commit protocol).
- *
- * @author Aaron Mulder (ammulder@alumni.princeton.edu)
- * @version $Revision: 1.1 $
- */
-public class Jdbc3ConnectionPool extends ConnectionPool
-{
-    /**
-     * Gets a description of this DataSource.
-     */
-    public String getDescription()
-    {
-        return "Jdbc3ConnectionPool from " + org.postgresql.Driver.getVersion();
-    }
-
-    /**
-     * Gets a connection which may be pooled by the app server or middleware
-     * implementation of DataSource.
-     *
-     * @throws java.sql.SQLException
-     *            Occurs when the physical database connection cannot be established.
-     */
-    public PooledConnection getPooledConnection() throws SQLException
-    {
-        return new Jdbc3PooledConnection(getConnection(), isDefaultAutoCommit());
-    }
-
-    /**
-     * Gets a connection which may be pooled by the app server or middleware
-     * implementation of DataSource.
-     *
-     * @throws java.sql.SQLException
-     *            Occurs when the physical database connection cannot be established.
-     */
-    public PooledConnection getPooledConnection(String user, String password) throws SQLException
-    {
-        return new Jdbc3PooledConnection(getConnection(user, password), isDefaultAutoCommit());
-    }
-
-    /**
-     * Generates a JDBC object factory reference.
-     */
-    protected Reference createReference()
-    {
-        return new Reference(getClass().getName(), Jdbc3ObjectFactory.class.getName(), null);
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3DatabaseMetaData.java
deleted file mode 100644 (file)
index 24fe763..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-public class Jdbc3DatabaseMetaData extends org.postgresql.jdbc3.AbstractJdbc3DatabaseMetaData implements java.sql.DatabaseMetaData
-{
-
-       public Jdbc3DatabaseMetaData(Jdbc3Connection conn)
-       {
-               super(conn);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ObjectFactory.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ObjectFactory.java
deleted file mode 100644 (file)
index 53151b8..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.postgresql.jdbc3;
-
-import java.util.*;
-import javax.naming.*;
-import org.postgresql.jdbc2.optional.PGObjectFactory;
-
-/**
- * JDBC3 version of the Object Factory used to recreate objects
- * from their JNDI references.
- *
- * @author Aaron Mulder (ammulder@alumni.princeton.edu)
- * @version $Revision: 1.1 $
- */
-public class Jdbc3ObjectFactory extends PGObjectFactory
-{
-    /**
-     * Dereferences a PostgreSQL DataSource.  Other types of references are
-     * ignored.
-     */
-    public Object getObjectInstance(Object obj, Name name, Context nameCtx,
-                                    Hashtable environment) throws Exception
-    {
-        Reference ref = (Reference) obj;
-        if (ref.getClassName().equals(Jdbc3SimpleDataSource.class.getName()))
-        {
-            return loadSimpleDataSource(ref);
-        }
-        else if (ref.getClassName().equals(Jdbc3ConnectionPool.class.getName()))
-        {
-            return loadConnectionPool(ref);
-        }
-        else if (ref.getClassName().equals(Jdbc3PoolingDataSource.class.getName()))
-        {
-            return loadPoolingDataSource(ref);
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    private Object loadPoolingDataSource(Reference ref)
-    {
-        // If DataSource exists, return it
-        String name = getProperty(ref, "dataSourceName");
-        Jdbc3PoolingDataSource pds = Jdbc3PoolingDataSource.getDataSource(name);
-        if (pds != null)
-        {
-            return pds;
-        }
-        // Otherwise, create a new one
-        pds = new Jdbc3PoolingDataSource();
-        pds.setDataSourceName(name);
-        loadBaseDataSource(pds, ref);
-        String min = getProperty(ref, "initialConnections");
-        if (min != null)
-        {
-            pds.setInitialConnections(Integer.parseInt(min));
-        }
-        String max = getProperty(ref, "maxConnections");
-        if (max != null)
-        {
-            pds.setMaxConnections(Integer.parseInt(max));
-        }
-        return pds;
-    }
-
-    private Object loadSimpleDataSource(Reference ref)
-    {
-        Jdbc3SimpleDataSource ds = new Jdbc3SimpleDataSource();
-        return loadBaseDataSource(ds, ref);
-    }
-
-    private Object loadConnectionPool(Reference ref)
-    {
-        Jdbc3ConnectionPool cp = new Jdbc3ConnectionPool();
-        return loadBaseDataSource(cp, ref);
-    }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PooledConnection.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PooledConnection.java
deleted file mode 100644 (file)
index cac966d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.postgresql.jdbc3;
-
-import org.postgresql.jdbc2.optional.PooledConnectionImpl;
-
-import java.sql.Connection;
-
-/**
- * JDBC3 implementation of PooledConnection, which manages
- * a connection in a connection pool.
- *
- * @author Aaron Mulder (ammulder@alumni.princeton.edu)
- * @version $Revision: 1.1 $
- */
-public class Jdbc3PooledConnection extends PooledConnectionImpl
-{
-    Jdbc3PooledConnection(Connection con, boolean autoCommit)
-    {
-        super(con, autoCommit);
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PoolingDataSource.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PoolingDataSource.java
deleted file mode 100644 (file)
index df3e50a..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.postgresql.jdbc3;
-
-import java.util.*;
-import org.postgresql.jdbc2.optional.PoolingDataSource;
-import org.postgresql.jdbc2.optional.ConnectionPool;
-
-import javax.naming.Reference;
-
-/**
- * JDBC 3 implementation of a pooling DataSource.  This is best
- * used outside of an application server environment.  Application
- * servers generally prefer to deal with instances of
- * ConnectionPoolDataSource (see ConnectionPool) or XADataSource
- * (not available for PostgreSQL).
- *
- * @author Aaron Mulder (ammulder@alumni.princeton.edu)
- * @version $Revision: 1.1 $
- */
-public class Jdbc3PoolingDataSource extends PoolingDataSource
-{
-    /**
-     * Store JDBC3 DataSources in different bucket than JDBC2 DataSources
-     */
-    private static Map dataSources = new HashMap();
-
-    /**
-     * Store JDBC3 DataSources in different bucket than JDBC2 DataSources
-     */
-    static Jdbc3PoolingDataSource getDataSource(String name)
-    {
-        return (Jdbc3PoolingDataSource) dataSources.get(name);
-    }
-
-    /**
-     * Store JDBC3 DataSources in different bucket than JDBC2 DataSources
-     */
-    protected void removeStoredDataSource()
-    {
-        synchronized (dataSources)
-        {
-            dataSources.remove(dataSourceName);
-        }
-    }
-
-    /**
-     * Store JDBC3 DataSources in different bucket than JDBC2 DataSources
-     */
-    public void setDataSourceName(String dataSourceName)
-    {
-        if (isInitialized())
-        {
-            throw new IllegalStateException("Cannot set Data Source properties after DataSource has been used");
-        }
-        if (this.dataSourceName != null && dataSourceName != null && dataSourceName.equals(this.dataSourceName))
-        {
-            return;
-        }
-        synchronized (dataSources)
-        {
-            if (getDataSource(dataSourceName) != null)
-            {
-                throw new IllegalArgumentException("DataSource with name '" + dataSourceName + "' already exists!");
-            }
-            if (this.dataSourceName != null)
-            {
-                dataSources.remove(this.dataSourceName);
-            }
-            this.dataSourceName = dataSourceName;
-            dataSources.put(dataSourceName, this);
-        }
-    }
-
-    /**
-     * Generates a JDBC3 object factory reference.
-     */
-    protected Reference createReference()
-    {
-        return new Reference(getClass().getName(), Jdbc3ObjectFactory.class.getName(), null);
-    }
-
-    /**
-     * Creates a JDBC3 ConnectionPool to use with this DataSource.
-     */
-    protected ConnectionPool createConnectionPool()
-    {
-        return new Jdbc3ConnectionPool();
-    }
-
-    /**
-     * Gets a description of this DataSource.
-     */
-    public String getDescription()
-    {
-        return "JDBC3 Pooling DataSource from " + org.postgresql.Driver.getVersion();
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java
deleted file mode 100644 (file)
index e9e25f7..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.*;
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-
-public class Jdbc3PreparedStatement extends org.postgresql.jdbc3.AbstractJdbc3Statement implements java.sql.PreparedStatement
-{
-
-       public Jdbc3PreparedStatement(Jdbc3Connection connection, String sql) throws SQLException
-       {
-               super(connection, sql);
-       }
-
-       public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
-       {
-                return new Jdbc3ResultSet((BaseStatement)this, fields, tuples, status, updateCount, insertOID, binaryCursor);
-       }
-         
-       public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
-       {
-                return new Jdbc3RefCursorResultSet(this, cursorName);
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3RefCursorResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3RefCursorResultSet.java
deleted file mode 100644 (file)
index f6c0451..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.postgresql.jdbc3;
-
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseStatement;
-import org.postgresql.core.Field;
-import org.postgresql.core.QueryExecutor;
-import java.util.Vector;
-
-/** A real result set based on a ref cursor.
- *
- * @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
- */
-public class Jdbc3RefCursorResultSet extends Jdbc3ResultSet implements PGRefCursorResultSet
-{
-
-       String refCursorHandle;
-
-       // Indicates when the result set has activaly bound to the cursor.
-       boolean isInitialized = false;
-
-       Jdbc3RefCursorResultSet(java.sql.Statement statement, String refCursorName) throws java.sql.SQLException
-       {
-                // This casting is a GCJ requirement.
-                super((BaseStatement)statement,
-                      (Field[])null,
-                      (Vector)null,
-                      (String)null, -1, 0L, false);
-                this.refCursorHandle = refCursorName;
-       }
-
-       public String getRefCursor ()
-       {
-               return refCursorHandle;
-       }
-
-       public boolean next () throws java.sql.SQLException
-       {
-               if (isInitialized)
-                       return super.next();
-               // Initialize this res set with the rows from the cursor.
-               String[] toExec = { "FETCH ALL IN \"" + refCursorHandle + "\";" };
-                QueryExecutor.execute(toExec, new String[0], this);
-               isInitialized = true;
-               return super.next();
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java
deleted file mode 100644 (file)
index 903618a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.core.Field;
-import org.postgresql.core.BaseStatement;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java,v 1.6 2003/11/29 19:52:11 pgsql 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
- */
-public class Jdbc3ResultSet extends org.postgresql.jdbc3.AbstractJdbc3ResultSet implements java.sql.ResultSet
-{
-
-       public Jdbc3ResultSet(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
-       {
-               return new Jdbc3ResultSetMetaData(rows, fields);
-       }
-
-       public java.sql.Clob getClob(int i) throws SQLException
-       {
-               wasNullFlag = (this_row[i - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               return new Jdbc3Clob(connection, getInt(i));
-       }
-
-       public java.sql.Blob getBlob(int i) throws SQLException
-       {
-               wasNullFlag = (this_row[i - 1] == null);
-               if (wasNullFlag)
-                       return null;
-
-               return new Jdbc3Blob(connection, getInt(i));
-       }
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java
deleted file mode 100644 (file)
index 742c062..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-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, Field[] fields)
-       {
-               super(rows, fields);
-       }
-
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3SimpleDataSource.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3SimpleDataSource.java
deleted file mode 100644 (file)
index d8dff03..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.postgresql.jdbc3;
-
-import org.postgresql.jdbc2.optional.SimpleDataSource;
-
-import javax.naming.Reference;
-
-/**
- * JDBC3 implementation of a non-pooling DataSource.
- *
- * @author Aaron Mulder (ammulder@alumni.princeton.edu)
- * @version $Revision: 1.1 $
- */
-public class Jdbc3SimpleDataSource extends SimpleDataSource
-{
-    /**
-     * Generates a JDBC3 object factory reference.
-     */
-    protected Reference createReference()
-    {
-        return new Reference(getClass().getName(), Jdbc3ObjectFactory.class.getName(), null);
-    }
-
-    /**
-     * Gets a description of this DataSource.
-     */
-    public String getDescription()
-    {
-        return "JDBC3 Non-Pooling DataSource from " + org.postgresql.Driver.getVersion();
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Statement.java
deleted file mode 100644 (file)
index 095217d..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.postgresql.jdbc3;
-
-
-import java.sql.*;
-import java.util.Vector;
-import org.postgresql.PGRefCursorResultSet;
-import org.postgresql.core.BaseResultSet;
-import org.postgresql.core.Field;
-
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Statement.java,v 1.6 2003/11/29 19:52:11 pgsql 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
- */
-public class Jdbc3Statement extends org.postgresql.jdbc3.AbstractJdbc3Statement implements java.sql.Statement
-{
-
-       public Jdbc3Statement (Jdbc3Connection c)
-       {
-               super(c);
-       }
-
-       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);
-       }
-
-       public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
-       {
-                return new Jdbc3RefCursorResultSet(this, cursorName);
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/README b/src/interfaces/jdbc/org/postgresql/test/README
deleted file mode 100644 (file)
index b65c2a9..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-PostgreSQL/JDBC Test Suite Howto
-================================
-1 Introduction
-2 Installation
-3 Configuration
-4 Running the test suite
-5 Extending the test suite with new tests
-6 Guidelines for developing new tests
-7 Example
-8 Running the JDBC 2 test suite from Sun against PostgreSQL
-9 Credits, feedback
-
-
-1 Introduction
---------------
-The PostgreSQL source tree contains an automated test suite for
-the JDBC driver. This document explains how to install,
-configure and run this test suite. Furthermore, it offers
-guidelines and an example for developers to add new test cases.
-
-Sun provides two standard JDBC test suites that you may also 
-find useful.
-http://java.sun.com/products/jdbc/download2.html (JDBC 1)
-http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html (JDBC
-2, including J2EE requirements)
-The JDBC 2 test suite is covered in section 8 below. The JDBC 1 
-test suite is not currently covered in this document.
-
-2 Installation
---------------
-Of course, you need to have a Java 2 JDK or JRE installed. The
-standard JDK from Sun is OK. You can download it from
-http://java.sun.com/.
-
-You need to install the Ant build utility. You can download it
-from http://jakarta.apache.org/ant/.
-
-You also need to install the JUnit testing framework. You can
-download it from http://www.junit.org/. Add junit.jar to your
-CLASSPATH before you perform the following steps. Ant will
-dynamically detect that JUnit is present and then build the JDBC
-test suite.
-
-You need to install and build the PostgreSQL source tree. You
-can download it from http://www.postgresql.org/devel-corner/.
-See README and INSTALL in the top of the tree for more
-information.
-
-You should run ./configure with the command line option
---with-java. You may also want to use --with-pgport to compile a
-non-standard default port number (e.g. 5433) into all 
-components. This will cause the server to listen on this
-non-standard port and it will cause the JDBC driver to connect
-to this port by default. In this way your testing environment is
-easily separated from other PostgreSQL applications on the same
-system.
-
-In this Howto we'll use $JDBC_SRC to refer to the directory 
-src/interfaces/jdbc of the PostgreSQL source tree in your 
-environment. The test suite is located in the subdirectory 
-$JDBC_SRC/org/postgresql/test.
-
-3 Configuration
----------------
-The test suite requires a PostgreSQL database to run the tests 
-against and a user to login as. For a full regression test of 
-the entire PostgreSQL system, you should run the test against a 
-server built from the same source tree as the driver you're 
-testing. The tests will create and drop many objects in this 
-database, so it should not contain production tables to avoid 
-loss of data. We recommend you assign the following names:
-
-  database: test
-  username: test
-  password: password
-
-These names correspond with the default names set for the test
-suite in $JDBC_SRC/build.xml. If you have chosen other names you
-need to edit this file and change the properties "database",
-"username" and "password" accordingly.
-
-4 Running the test suite
-------------------------
-%cd $JDBC_SRC
-%make
-%make check
-
-This will run the command line version of JUnit. If you'd like
-to see an animated coloured progress bar as the tests are
-executed, you may want to use one of the GUI versions of the
-test runner. See the JUnit documentation for more information.
-
-If the test suite reports errors or failures that you cannot
-explain, please post the relevant parts of the output to the
-mailing list pgsql-jdbc@postgresql.org.
-
-5 Extending the test suite with new tests
------------------------------------------
-If you're not familiar with JUnit, we recommend that you 
-first read the introductory article "JUnit Test Infected:
-Programmers Love Writing Tests" on
-http://junit.sourceforge.net/doc/testinfected/testing.htm.
-Before continuing, you should ensure you understand the
-following concepts: test suite, test case, test, fixture,
-assertion, failure.
-
-The test suite consists of test cases, which consist of tests. 
-A test case is a collection of tests that test a particular
-feature. The test suite is a collection of test cases that
-together test the driver - and to an extent the PostgreSQL
-backend - as a whole.
-
-If you decide to add a test to an existing test case, all you
-need to do is add a method with a name that begins with "test"
-and which takes no arguments. JUnit will dynamically find this
-method using reflection and run it when it runs the test case.
-In your test method you can use the fixture that is setup for it
-by the test case.
-
-If you decide to add a new test case, you should do two things:
-1) Add a class that extends junit.framework.TestCase. It should
-contain setUp() and tearDown() methods that create and destroy
-the fixture respectively.
-2) Edit $JDBC_SRC/org/postgresql/test/JDBC2Tests.java and add a
-suite.addTestSuite() call for your class. This will make the
-test case part of the test suite.
-
-6 Guidelines for developing new tests
--------------------------------------
-Every test should create and drop its own tables. We suggest to
-consider database objects (e.g. tables) part of the fixture for
-the tests in the test case. The test should also succeed when a
-table by the same name already exists in the test database, e.g.
-by dropping the table before running the test (ignoring errors).
-The recommended pattern for creating and dropping tables can be
-found in the example in section 7 below.
-
-Please note that JUnit provides several convenience methods to
-check for conditions. See the TestCase class in the Javadoc
-documentation of JUnit, which is installed on your system. For
-example, you can compare two integers using
-TestCase.assertEquals(int expected, int actual). This method
-will print both values in case of a failure.
-
-To simply report a failure use TestCase.fail().
-
-The JUnit FAQ explains how to test for a thrown exception.
-
-Avoid the use of the deprecated TestCase.assert(), since it will
-collide with the new assert keyword in the Java 2 platform
-version 1.4.
-
-As a rule, the test suite should succeed. Any errors or failures
-- which may be caused by bugs in the JDBC driver, the backend or
-the test suite - should be fixed ASAP. Don't let a test fail
-just to make it clear that something needs to be fixed somewhere.
-That's what the TODO lists are for.
-
-Add some comments to your tests to explain to others what it is 
-you're testing. A long sequence of JDBC method calls and JUnit
-assertions can be hard to comprehend.
-
-For example, in the comments you can explain where a certain test 
-condition originates from. Is it a JDBC requirement, PostgreSQL 
-behaviour or the intended implementation of a feature?
-
-7 Example (incomplete)
-----------------------
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-
-/*
- * Test case for ...
- */
-public class FooTest extends TestCase {
-
-    private Connection con;
-    private Statement stmt;
-
-    public FooTest(String name) {
-        super(name);
-    }
-
-    protected void setUp() throws Exception {
-        con = TestUtil.openDB();
-        stmt = con.createStatement();
-
-        // Drop the test table if it already exists for some
-        // reason. It is not an error if it doesn't exist.
-        try {
-            stmt.executeUpdate("DROP TABLE testfoo");
-        } catch (SQLException e) {
-             // Intentionally ignore. We cannot distinguish
-             // "table does not exist" from other errors, since
-             // PostgreSQL doesn't support error codes yet.
-        }
-
-        stmt.executeUpdate(
-           "CREATE TABLE testfoo(pk INTEGER, col1 INTEGER)");
-        stmt.executeUpdate("INSERT INTO testfoo VALUES(1, 0)");
-        
-        // You may want to call con.setAutoCommit(false) at 
-        // this point, if most tests in this test case require
-        // the use of transactions.
-    }
-   
-    protected void tearDown() throws Exception {
-        con.setAutoCommit(true);
-        if (stmt != null) {
-            stmt.executeUpdate("DROP TABLE testfoo");
-            stmt.close();
-        }
-        if (con != null) {
-              TestUtil.closeDB(con);
-        }
-    }
-       
-    public void testFoo() {
-        // Use the assert methods in junit.framework.TestCase
-        // for the actual tests
-        
-        // Just some silly examples
-        assertNotNull(con);
-        if (stmt == null) {
-               fail("Where is my statement?");
-        }
-    }
-    
-    public void testBar() {
-       // Another test.
-    }
-}
-
-8. Running the JDBC 2 test suite from Sun against PostgreSQL
-------------------------------------------------------------
-Download the test suite from 
-http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html
-This is the JDBC 2 test suite that includes J2EE requirements.
-
-1. Configure PostgreSQL so that it accepts TCP/IP connections and
-   start the server. Prepare PostgreSQL by creating two users (cts1
-   and cts2) and two databases (DB1 and DB2) in the cluster that is
-   going to be used for JDBC testing.
-
-2. Download the latest release versions of the J2EE, J2SE, and JDBC
-   test suite from Sun's Java site (http://java.sun.com), and install
-   according to Sun's documentation.
-
-3. The following environment variables should be set:
-
-      CTS_HOME=<path where JDBC test suite installed (eg: /usr/local/jdbccts)>
-      J2EE_HOME=<path where J2EE installed (eg: /usr/local/j2sdkee1.2.1)>
-      JAVA_HOME=<path where J2SE installed (eg: /usr/local/jdk1.3.1)>
-      NO_JAVATEST=Y
-      LOCAL_CLASSES=<path to PostgreSQL JDBC driver jar>
-
-4. In $J2EE_HOME/config/default.properties:
-
-      jdbc.drivers=org.postgresql.Driver
-      jdbc.datasources=jdbc/DB1|jdbc:postgresql://localhost:5432/DB1|jdbc/DB2|jdbc:postgresq://localhost:5432/DB2
-
-   Of course, if PostgreSQL is running on a computer different from
-   the one running the application server, localhost should be changed
-   to the proper host. Also, 5432 should be changed to whatever port
-   PostgreSQL is listening on (5432 is the default).
-
-   In $J2EE_HOME/bin/userconfig.sh:
-
-      Add $CTS_HOME/lib/harness.jar, $CTS_HOME/lib/moo.jar,
-      $CTS_HOME/lib/util.jar to J2EE_CLASSPATH. Also add the path to
-      the PostgreSQL JDBC jar to J2EE_CLASSPATH. Set the JAVA_HOME
-      variable to where you installed the J2SE. You should end up with
-      something like this:
-
-      CTS_HOME=/home/liams/linux/java/jdbccts
-      J2EE_CLASSPATH=/home/liams/work/inst/postgresql-7.1.2/share/java/postgresql.jar:$CTS_HOME/lib/harness.jar:$CTS_HOME/lib/moo.jar:$CTS_HOME/lib/util.jar
-      export J2EE_CLASSPATH
-
-      JAVA_HOME=/home/liams/linux/java/jdk1.3.1
-      export JAVA_HOME
-
-   In $CTS_HOME/bin/cts.jte:
-
-      webServerHost=localhost
-      webServerPort=8000
-      servletServerHost=localhost
-      servletServerPort=8000
-
-5. Start the application server (j2ee):
-
-      $ cd $J2EE_HOME
-      $ bin/j2ee -verbose
-
-   The server can be stopped after the tests have finished:
-
-     $ cd $J2EE_HOME
-     $ bin/j2ee -stop
-
-6. Run the JDBC tests:
-
-     $ cd $CTS_HOME/tests/jdbc/ee
-     $ make jdbc-tests
-    
-At the time of writing of this document, a great number of tests 
-in this test suite fail.
-
-9 Credits, feedback
--------------------
-The parts of this document describing the PostgreSQL test suite 
-were originally written by Rene Pijlman. Liam Stewart contributed 
-the section on the Sun JDBC 2 test suite.
-
-Please send your questions about the JDBC test suites or suggestions
-for improvement to the pgsql-jdbc@postgresql.org mailing list.
-
-The source of this document is maintained in 
-src/interfaces/jdbc/org/postgresql/test/README in CVS. Patches for
-improvement can be send to the mailing list 
-pgsql-patches@postgresql.org.
-
diff --git a/src/interfaces/jdbc/org/postgresql/test/TestUtil.java b/src/interfaces/jdbc/org/postgresql/test/TestUtil.java
deleted file mode 100644 (file)
index 9ef0c7d..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-package org.postgresql.test;
-
-import java.sql.*;
-import junit.framework.TestCase;
-import java.util.Properties;
-
-/*
- * Utility class for JDBC tests
- */
-public class TestUtil
-{
-       /*
-        * Returns the Test database JDBC URL
-        */
-       public static String getURL()
-       {
-               return "jdbc:postgresql://"+getServer()+":"+getPort()+"/"+getDatabase();
-       }
-
-       /*
-        * Returns the Test server
-        */
-       public static String getServer()
-       {
-               return System.getProperty("server");
-       }
-
-       /*
-        * Returns the Test port
-        */
-       public static int getPort()
-       {
-               return Integer.parseInt(System.getProperty("port"));
-       }
-
-       /*
-        * Returns the Test database
-        */
-       public static String getDatabase()
-       {
-               return System.getProperty("database");
-       }
-
-       /*
-        * Returns the Postgresql username
-        */
-       public static String getUser()
-       {
-               return System.getProperty("username");
-       }
-
-       /*
-        * Returns the user's password
-        */
-       public static String getPassword()
-       {
-               return System.getProperty("password");
-       }
-
-       /*
-        * Helper - opens a connection.
-        */
-       public static java.sql.Connection openDB()
-       {
-               return openDB(new Properties());
-       }
-
-       /*
-        * Helper - opens a connection with the allowance for passing
-        * additional parameters, like "compatible".
-        */
-       public static java.sql.Connection openDB(Properties props)
-       {
-               props.setProperty("user",getUser());
-               props.setProperty("password",getPassword());
-               try
-               {
-                       Class.forName("org.postgresql.Driver");
-                       return java.sql.DriverManager.getConnection(getURL(), props);
-               }
-               catch (ClassNotFoundException ex)
-               {
-                       TestCase.fail(ex.getMessage());
-               }
-               catch (SQLException ex)
-               {
-                       TestCase.fail(ex.getMessage());
-               }
-               return null;
-       }
-
-       /*
-        * Helper - closes an open connection. This rewrites SQLException to a failed
-        * assertion. It's static so other classes can use it.
-        */
-       public static void closeDB(Connection con)
-       {
-               try
-               {
-                       if (con != null)
-                               con.close();
-               }
-               catch (SQLException ex)
-               {
-                       TestCase.fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Helper - creates a test table for use by a test
-        */
-       public static void createTable(Connection con,
-                                                                  String table,
-                                                                  String columns)
-       {
-               try
-               {
-                       Statement st = con.createStatement();
-                       try
-                       {
-                               // Drop the table
-                               dropTable(con, table);
-
-                               // Now create the table
-                               st.executeUpdate("create table " + table + " (" + columns + ")");
-                       }
-                       finally
-                       {
-                               st.close();
-                       }
-               }
-               catch (SQLException ex)
-               {
-                       TestCase.fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Helper - drops a table
-        */
-       public static void dropTable(Connection con, String table)
-       {
-               try
-               {
-                       Statement stmt = con.createStatement();
-                       try
-                       {
-                               String sql = "DROP TABLE " + table;
-                               if (haveMinimumServerVersion(con,"7.3")) {
-                                       sql += " CASCADE ";
-                               }
-                               stmt.executeUpdate(sql);
-                       }
-                       catch (SQLException ex)
-                       {
-                               // Since every create table issues a drop table
-                               // it's easy to get a table doesn't exist error.
-                               // we want to ignore these, but if we're in a
-                               // transaction we need to restart.
-                               // If the test case wants to catch this error
-                               // itself it should issue the drop SQL directly.
-                               if (ex.getMessage().indexOf("does not exist") != -1) {
-                                       if (!con.getAutoCommit()) {
-                                               con.rollback();
-                                       }
-
-                               }
-                       }
-               }
-               catch (SQLException ex)
-               {
-                       TestCase.fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Helper - generates INSERT SQL - very simple
-        */
-       public static String insertSQL(String table, String values)
-       {
-               return insertSQL(table, null, values);
-       }
-
-       public static String insertSQL(String table, String columns, String values)
-       {
-               String s = "INSERT INTO " + table;
-
-               if (columns != null)
-                       s = s + " (" + columns + ")";
-
-               return s + " VALUES (" + values + ")";
-       }
-
-       /*
-        * Helper - generates SELECT SQL - very simple
-        */
-       public static String selectSQL(String table, String columns)
-       {
-               return selectSQL(table, columns, null, null);
-       }
-
-       public static String selectSQL(String table, String columns, String where)
-       {
-               return selectSQL(table, columns, where, null);
-       }
-
-       public static String selectSQL(String table, String columns, String where, String other)
-       {
-               String s = "SELECT " + columns + " FROM " + table;
-
-               if (where != null)
-                       s = s + " WHERE " + where;
-               if (other != null)
-                       s = s + " " + other;
-
-               return s;
-       }
-
-       /*
-        * Helper to prefix a number with leading zeros - ugly but it works...
-        * @param v value to prefix
-        * @param l number of digits (0-10)
-        */
-       public static String fix(int v, int l)
-       {
-               String s = "0000000000".substring(0, l) + Integer.toString(v);
-               return s.substring(s.length() - l);
-       }
-
-       /**
-        * Determine if the given connection is connected to a server with
-        * a version of at least the given version.
-        * This is convenient because we are working with a java.sql.Connection,
-        * not an Postgres connection.
-        */
-       public static boolean haveMinimumServerVersion(Connection con, String version) throws SQLException {
-               if (con instanceof org.postgresql.jdbc1.AbstractJdbc1Connection) {
-                       return ((org.postgresql.jdbc1.AbstractJdbc1Connection)con).haveMinimumServerVersion(version);
-               }
-               return false;
-       }
-
-       /**
-        * Print a ResultSet to System.out.
-        * This is useful for debugging tests.
-        */
-       public static void printResultSet(ResultSet rs) throws SQLException {
-               ResultSetMetaData rsmd = rs.getMetaData();
-               for (int i=1; i<=rsmd.getColumnCount(); i++) {
-                       if (i != 1) {
-                               System.out.print(", ");
-                       }
-                       System.out.print(rsmd.getColumnName(i));
-               }
-               System.out.println();
-               while (rs.next()) {
-                       for (int i=1; i<=rsmd.getColumnCount(); i++) {
-                               if (i != 1) {
-                                       System.out.print(", ");
-                               }
-                               System.out.print(rs.getString(i));
-                       }
-                       System.out.println();
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/ANTTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/ANTTest.java
deleted file mode 100644 (file)
index b503ff4..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import junit.framework.TestCase;
-
-public class ANTTest extends TestCase
-{
-       public ANTTest(String name)
-       {
-               super(name);
-       }
-
-       /*
-        * This tests the acceptsURL() method with a couple of good and badly formed
-        * jdbc urls
-        */
-       public void testANT()
-       {
-               String url = System.getProperty("database");
-               String usr = System.getProperty("username");
-               String psw = System.getProperty("password");
-
-               assertNotNull(url);
-               assertNotNull(usr);
-               assertNotNull(psw);
-
-               assertTrue(! url.equals(""));
-               assertTrue(! usr.equals(""));
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/BatchExecuteTest.java
deleted file mode 100644 (file)
index e7f27ed..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-
-/* TODO tests that can be added to this test case
- * - SQLExceptions chained to a BatchUpdateException
- * - test PreparedStatement as thoroughly as Statement
- */
-
-/*
- * Test case for Statement.batchExecute()
- */
-public class BatchExecuteTest extends TestCase
-{
-
-       private Connection con;
-
-       public BatchExecuteTest(String name)
-       {
-               super(name);
-       }
-
-       // Set up the fixture for this testcase: a connection to a database with
-       // a table for this test.
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               Statement stmt = con.createStatement();
-
-               // Drop the test table if it already exists for some reason. It is
-               // not an error if it doesn't exist.
-               TestUtil.createTable(con, "testbatch", "pk INTEGER, col1 INTEGER");
-
-               stmt.executeUpdate("INSERT INTO testbatch VALUES (1, 0)");
-
-               // Generally recommended with batch updates. By default we run all
-               // tests in this test case with autoCommit disabled.
-               con.setAutoCommit(false);
-       }
-
-       // Tear down the fixture for this test case.
-       protected void tearDown() throws Exception
-       {
-               con.setAutoCommit(true);
-
-               TestUtil.dropTable(con, "testbatch");
-               TestUtil.closeDB(con);
-       }
-
-       public void testSupportsBatchUpdates() throws Exception
-       {
-               DatabaseMetaData dbmd = con.getMetaData();
-               assertTrue(dbmd.supportsBatchUpdates());
-       }
-
-       private void assertCol1HasValue(int expected) throws Exception
-       {
-               Statement getCol1 = con.createStatement();
-
-               ResultSet rs =
-                       getCol1.executeQuery("SELECT col1 FROM testbatch WHERE pk = 1");
-               assertTrue(rs.next());
-
-               int actual = rs.getInt("col1");
-
-               assertEquals(expected, actual);
-
-               assertEquals(false, rs.next());
-
-               rs.close();
-               getCol1.close();
-       }
-
-       public void testExecuteEmptyBatch() throws Exception
-       {
-               Statement stmt = con.createStatement();
-               int[] updateCount = stmt.executeBatch();
-               assertEquals(0, updateCount.length);
-
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 1 WHERE pk = 1");
-               stmt.clearBatch();
-               updateCount = stmt.executeBatch();
-               assertEquals(0, updateCount.length);
-               stmt.close();
-       }
-
-       public void testClearBatch() throws Exception
-       {
-               Statement stmt = con.createStatement();
-
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 1 WHERE pk = 1");
-               assertCol1HasValue(0);
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 2 WHERE pk = 1");
-               assertCol1HasValue(0);
-               stmt.clearBatch();
-               assertCol1HasValue(0);
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 4 WHERE pk = 1");
-               assertCol1HasValue(0);
-               stmt.executeBatch();
-               assertCol1HasValue(4);
-               con.commit();
-               assertCol1HasValue(4);
-
-               stmt.close();
-       }
-
-       public void testSelectThrowsException() throws Exception
-       {
-               Statement stmt = con.createStatement();
-
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 1 WHERE pk = 1");
-               stmt.addBatch("SELECT col1 FROM testbatch WHERE pk = 1");
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 2 WHERE pk = 1");
-
-               try
-               {
-                       stmt.executeBatch();
-                       fail("Should raise a BatchUpdateException because of the SELECT");
-               }
-               catch (BatchUpdateException e)
-               {
-                       int [] updateCounts = e.getUpdateCounts();
-                       assertEquals(1, updateCounts.length);
-                       assertEquals(1, updateCounts[0]);
-               }
-               catch (SQLException e)
-               {
-                       fail( "Should throw a BatchUpdateException instead of " +
-                                 "a generic SQLException: " + e);
-               }
-
-               stmt.close();
-       }
-
-       public void testPreparedStatement() throws Exception
-       {
-               PreparedStatement pstmt = con.prepareStatement(
-                                                                         "UPDATE testbatch SET col1 = col1 + ? WHERE PK = ?" );
-
-               // Note that the first parameter changes for every statement in the
-               // batch, whereas the second parameter remains constant.
-               pstmt.setInt(1, 1);
-               pstmt.setInt(2, 1);
-               pstmt.addBatch();
-               assertCol1HasValue(0);
-
-               pstmt.setInt(1, 2);
-               pstmt.addBatch();
-               assertCol1HasValue(0);
-
-               pstmt.setInt(1, 4);
-               pstmt.addBatch();
-               assertCol1HasValue(0);
-
-               pstmt.executeBatch();
-               assertCol1HasValue(7);
-
-               //now test to see that we can still use the statement after the execute
-               pstmt.setInt(1, 3);
-               pstmt.addBatch();
-               assertCol1HasValue(7);
-
-               pstmt.executeBatch();
-               assertCol1HasValue(10);
-
-               con.commit();
-               assertCol1HasValue(10);
-
-               con.rollback();
-               assertCol1HasValue(10);
-
-               pstmt.close();
-       }
-
-       public void testTransactionalBehaviour() throws Exception
-       {
-               Statement stmt = con.createStatement();
-
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 1 WHERE pk = 1");
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 2 WHERE pk = 1");
-               stmt.executeBatch();
-               con.rollback();
-               assertCol1HasValue(0);
-
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 4 WHERE pk = 1");
-               stmt.addBatch("UPDATE testbatch SET col1 = col1 + 8 WHERE pk = 1");
-
-               // The statement has been added to the batch, but it should not yet
-               // have been executed.
-               assertCol1HasValue(0);
-
-               int[] updateCounts = stmt.executeBatch();
-               assertEquals(2, updateCounts.length);
-               assertEquals(1, updateCounts[0]);
-               assertEquals(1, updateCounts[1]);
-
-               assertCol1HasValue(12);
-               con.commit();
-               assertCol1HasValue(12);
-               con.rollback();
-               assertCol1HasValue(12);
-
-               stmt.close();
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/BlobTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/BlobTest.java
deleted file mode 100644 (file)
index 3032fc2..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.io.*;
-import java.sql.*;
-
-import org.postgresql.largeobject.*;
-
-/*
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/BlobTest.java,v 1.10 2003/11/29 22:41:23 pgsql Exp $
- *
- * Some simple tests based on problems reported by users. Hopefully these will
- * help prevent previous problems from re-occuring ;-)
- *
- */
-public class BlobTest extends TestCase
-{
-
-       private Connection con;
-
-       private static final int LOOP = 0; // LargeObject API using loop
-       private static final int NATIVE_STREAM = 1; // LargeObject API using OutputStream
-       private static final int JDBC_STREAM = 2; // JDBC API using OutputStream
-
-       public BlobTest(String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               TestUtil.createTable(con, "testblob", "id name,lo oid");
-       }
-
-       protected void tearDown() throws Exception
-       {
-               TestUtil.dropTable(con, "testblob");
-               TestUtil.closeDB(con);
-       }
-
-       /*
-        * Tests one method of uploading a blob to the database
-        */
-       public void testUploadBlob_LOOP()
-       {
-               try
-               {
-                       con.setAutoCommit(false);
-                       assertTrue(!con.getAutoCommit());
-
-                       assertTrue(uploadFile("build.xml", LOOP) > 0);
-
-                       // Now compare the blob & the file. Note this actually tests the
-                       // InputStream implementation!
-                       assertTrue(compareBlobsLOAPI());
-                       assertTrue(compareBlobs());
-                       assertTrue(compareClobs());
-
-                       con.setAutoCommit(true);
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Tests one method of uploading a blob to the database
-        */
-       public void testUploadBlob_NATIVE()
-       {
-               try
-               {
-                       con.setAutoCommit(false);
-                       assertTrue(!con.getAutoCommit());
-
-                       assertTrue(uploadFile("build.xml", NATIVE_STREAM) > 0);
-
-                       // Now compare the blob & the file. Note this actually tests the
-                       // InputStream implementation!
-                       assertTrue(compareBlobs());
-
-                       con.setAutoCommit(true);
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Helper - uploads a file into a blob using old style methods. We use this
-        * because it always works, and we can use it as a base to test the new
-        * methods.
-        */
-       private int uploadFile(String file, int method) throws Exception
-       {
-               LargeObjectManager lom = ((org.postgresql.PGConnection)con).getLargeObjectAPI();
-
-               FileInputStream fis = new FileInputStream(file);
-
-               int oid = lom.create(LargeObjectManager.READWRITE);
-               LargeObject blob = lom.open(oid);
-
-               int s, t;
-               byte buf[];
-               OutputStream os;
-
-               switch (method)
-               {
-                       case LOOP:
-                               buf = new byte[2048];
-                               t = 0;
-                               while ((s = fis.read(buf, 0, buf.length)) > 0)
-                               {
-                                       t += s;
-                                       blob.write(buf, 0, s);
-                               }
-                               break;
-
-                       case NATIVE_STREAM:
-                               os = blob.getOutputStream();
-                               s = fis.read();
-                               while (s > -1)
-                               {
-                                       os.write(s);
-                                       s = fis.read();
-                               }
-                               os.close();
-                               break;
-
-                       case JDBC_STREAM:
-                               File f = new File(file);
-                               PreparedStatement ps = con.prepareStatement(TestUtil.insertSQL("testblob", "?"));
-                               ps.setBinaryStream(1, fis, (int) f.length());
-                               ps.execute();
-                               break;
-
-                       default:
-                               assertTrue("Unknown method in uploadFile", false);
-               }
-
-               blob.close();
-               fis.close();
-
-               // Insert into the table
-               Statement st = con.createStatement();
-               st.executeUpdate(TestUtil.insertSQL("testblob", "id,lo", "'" + file + "'," + oid));
-               con.commit();
-               st.close();
-
-               return oid;
-       }
-
-       /*
-        * Helper - compares the blobs in a table with a local file. Note this uses
-        * the postgresql specific Large Object API
-        */
-       private boolean compareBlobsLOAPI() throws Exception
-       {
-               boolean result = true;
-
-               LargeObjectManager lom = ((org.postgresql.PGConnection)con).getLargeObjectAPI();
-
-               Statement st = con.createStatement();
-               ResultSet rs = st.executeQuery(TestUtil.selectSQL("testblob", "id,lo"));
-               assertNotNull(rs);
-
-               while (rs.next())
-               {
-                       String file = rs.getString(1);
-                       int oid = rs.getInt(2);
-
-                       FileInputStream fis = new FileInputStream(file);
-                       LargeObject blob = lom.open(oid);
-                       InputStream bis = blob.getInputStream();
-
-                       int f = fis.read();
-                       int b = bis.read();
-                       int c = 0;
-                       while (f >= 0 && b >= 0 & result)
-                       {
-                               result = (f == b);
-                               f = fis.read();
-                               b = bis.read();
-                               c++;
-                       }
-                       result = result && f == -1 && b == -1;
-
-                       if (!result)
-                               assertTrue("Large Object API Blob compare failed at " + c + " of " + blob.size(), false);
-
-                       blob.close();
-                       fis.close();
-               }
-               rs.close();
-               st.close();
-
-               return result;
-       }
-
-       /*
-        * Helper - compares the blobs in a table with a local file. This uses the 
-        * jdbc java.sql.Blob api
-        */
-       private boolean compareBlobs() throws Exception
-       {
-               boolean result = true;
-
-               Statement st = con.createStatement();
-               ResultSet rs = st.executeQuery(TestUtil.selectSQL("testblob", "id,lo"));
-               assertNotNull(rs);
-
-               while (rs.next())
-               {
-                       String file = rs.getString(1);
-                       Blob blob = rs.getBlob(2);
-
-                       FileInputStream fis = new FileInputStream(file);
-                       InputStream bis = blob.getBinaryStream();
-
-                       int f = fis.read();
-                       int b = bis.read();
-                       int c = 0;
-                       while (f >= 0 && b >= 0 & result)
-                       {
-                               result = (f == b);
-                               f = fis.read();
-                               b = bis.read();
-                               c++;
-                       }
-                       result = result && f == -1 && b == -1;
-
-                       if (!result)
-                               assertTrue("JDBC API Blob compare failed at " + c + " of " + blob.length(), false);
-
-                       bis.close();
-                       fis.close();
-               }
-               rs.close();
-               st.close();
-
-               return result;
-       }
-
-       /*
-        * Helper - compares the clobs in a table with a local file. 
-        */
-       private boolean compareClobs() throws Exception
-       {
-               boolean result = true;
-
-               Statement st = con.createStatement();
-               ResultSet rs = st.executeQuery(TestUtil.selectSQL("testblob", "id,lo"));
-               assertNotNull(rs);
-
-               while (rs.next())
-               {
-                       String file = rs.getString(1);
-                       Clob clob = rs.getClob(2);
-
-                       FileInputStream fis = new FileInputStream(file);
-                       InputStream bis = clob.getAsciiStream();
-
-                       int f = fis.read();
-                       int b = bis.read();
-                       int c = 0;
-                       while (f >= 0 && b >= 0 & result)
-                       {
-                               result = (f == b);
-                               f = fis.read();
-                               b = bis.read();
-                               c++;
-                       }
-                       result = result && f == -1 && b == -1;
-
-                       if (!result)
-                               assertTrue("Clob compare failed at " + c + " of " + clob.length(), false);
-
-                       bis.close();
-                       fis.close();
-               }
-               rs.close();
-               st.close();
-
-               return result;
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/CallableStmtTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/CallableStmtTest.java
deleted file mode 100644 (file)
index 3f4538e..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-
-import junit.framework.TestCase;
-
-/*
- * CallableStatement tests.
- * @author Paul Bethe
- */
-public class CallableStmtTest extends TestCase
-{
-       private Connection con;
-
-       public CallableStmtTest (String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               Statement stmt = con.createStatement ();
-               stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getString (varchar) " +
-                                         "RETURNS varchar AS ' DECLARE inString alias for $1; begin " +
-                                         "return ''bob''; end; ' LANGUAGE 'plpgsql';");
-               stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getDouble (float) " +
-                                         "RETURNS float AS ' DECLARE inString alias for $1; begin " +
-                                         "return 42.42; end; ' LANGUAGE 'plpgsql';");
-               stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getInt (int) RETURNS int " +
-                                         " AS 'DECLARE inString alias for $1; begin " +
-                                         "return 42; end;' LANGUAGE 'plpgsql';");
-               stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getNumeric (numeric) " +
-                                         "RETURNS numeric AS ' DECLARE inString alias for $1; " +
-                                         "begin        return 42; end; ' LANGUAGE 'plpgsql';");
-               stmt.close ();
-       }
-
-       protected void tearDown() throws Exception
-       {
-               Statement stmt = con.createStatement ();
-               stmt.execute ("drop FUNCTION testspg__getString (varchar);");
-               stmt.execute ("drop FUNCTION testspg__getDouble (float);");
-               stmt.execute ("drop FUNCTION testspg__getInt (int);");
-               stmt.execute ("drop FUNCTION testspg__getNumeric (numeric);");
-               TestUtil.closeDB(con);
-       }
-
-
-       final String func = "{ ? = call ";
-       final String pkgName = "testspg__";
-       //      protected void runTest () throws Throwable {
-       //testGetString ();
-       //}
-
-       public void testGetDouble () throws Throwable
-       {
-               CallableStatement call = con.prepareCall (func + pkgName + "getDouble (?) }");
-               call.setDouble (2, (double)3.04);
-               call.registerOutParameter (1, Types.DOUBLE);
-               call.execute ();
-               double result = call.getDouble (1);
-               assertTrue ("correct return from getString ()", result == 42.42);
-       }
-
-       public void testGetInt () throws Throwable
-       {
-               CallableStatement call = con.prepareCall (func + pkgName + "getInt (?) }");
-               call.setInt (2, 4);
-               call.registerOutParameter (1, Types.INTEGER);
-               call.execute ();
-               int result = call.getInt (1);
-               assertTrue ("correct return from getString ()", result == 42);
-       }
-
-       public void testGetNumeric () throws Throwable
-       {
-               CallableStatement call = con.prepareCall (func + pkgName + "getNumeric (?) }");
-               call.setBigDecimal (2, new java.math.BigDecimal(4));
-               call.registerOutParameter (1, Types.NUMERIC);
-               call.execute ();
-               java.math.BigDecimal result = call.getBigDecimal (1);
-               assertTrue ("correct return from getString ()",
-                                       result.equals (new java.math.BigDecimal(42)));
-       }
-
-       public void testGetString () throws Throwable
-       {
-               CallableStatement call = con.prepareCall (func + pkgName + "getString (?) }");
-               call.setString (2, "foo");
-               call.registerOutParameter (1, Types.VARCHAR);
-               call.execute ();
-               String result = call.getString (1);
-               assertTrue ("correct return from getString ()", result.equals ("bob"));
-
-       }
-
-       public void testBadStmt () throws Throwable
-       {
-               tryOneBadStmt ("{ ?= " + pkgName + "getString (?) }");
-               tryOneBadStmt ("{ ?= call getString (?) ");
-               tryOneBadStmt ("{ = ? call getString (?); }");
-       }
-
-       protected void tryOneBadStmt (String sql) throws Throwable
-       {
-               boolean wasCaught = false;
-               try
-               {
-                       CallableStatement call = con.prepareCall (sql);
-               }
-               catch (SQLException e)
-               {
-                       wasCaught = true; // good -> this statement was missing something
-               }
-               assertTrue ("bad statment ('" + sql + "')was not caught", wasCaught);
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java
deleted file mode 100644 (file)
index 7460f7d..0000000
+++ /dev/null
@@ -1,350 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-
-/*
- * TestCase to test the internal functionality of org.postgresql.jdbc2.Connection
- * and it's superclass.
- *
- * PS: Do you know how difficult it is to type on a train? ;-)
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java,v 1.11 2003/11/29 22:41:23 pgsql Exp $
- */
-
-public class ConnectionTest extends TestCase
-{
-
-       /*
-        * Constructor
-        */
-       public ConnectionTest(String name)
-       {
-               super(name);
-       }
-
-       // Set up the fixture for this testcase: the tables for this test.
-       protected void setUp() throws Exception
-       {
-               Connection con = TestUtil.openDB();
-
-               TestUtil.createTable(con, "test_a", "imagename name,image oid,id int4");
-               TestUtil.createTable(con, "test_c", "source text,cost money,imageid int4");
-
-               TestUtil.closeDB(con);
-       }
-
-       // Tear down the fixture for this test case.
-       protected void tearDown() throws Exception
-       {
-               Connection con = TestUtil.openDB();
-
-               TestUtil.dropTable(con, "test_a");
-               TestUtil.dropTable(con, "test_c");
-
-               TestUtil.closeDB(con);
-       }
-
-       /*
-        * Tests the two forms of createStatement()
-        */
-       public void testCreateStatement()
-       {
-               try
-               {
-                       java.sql.Connection conn = TestUtil.openDB();
-
-                       // A standard Statement
-                       java.sql.Statement stat = conn.createStatement();
-                       assertNotNull(stat);
-                       stat.close();
-
-                       // Ask for Updateable ResultSets
-                       stat = conn.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_UPDATABLE);
-                       assertNotNull(stat);
-                       stat.close();
-
-               }
-               catch (SQLException ex)
-               {
-                       assertTrue(ex.getMessage(), false);
-               }
-       }
-
-       /*
-        * Tests the two forms of prepareStatement()
-        */
-       public void testPrepareStatement()
-       {
-               try
-               {
-                       java.sql.Connection conn = TestUtil.openDB();
-
-                       String sql = "select source,cost,imageid from test_c";
-
-                       // A standard Statement
-                       java.sql.PreparedStatement stat = conn.prepareStatement(sql);
-                       assertNotNull(stat);
-                       stat.close();
-
-                       // Ask for Updateable ResultSets
-                       stat = conn.prepareStatement(sql, java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_UPDATABLE);
-                       assertNotNull(stat);
-                       stat.close();
-
-               }
-               catch (SQLException ex)
-               {
-                       assertTrue(ex.getMessage(), false);
-               }
-       }
-
-       /*
-        * Put the test for createPrepareCall here
-        */
-       public void testPrepareCall()
-       {}
-
-       /*
-        * Test nativeSQL
-        */
-       public void testNativeSQL()
-       {
-               // For now do nothing as it returns itself
-       }
-
-       /*
-        * Test autoCommit (both get & set)
-        */
-       public void testTransactions()
-       {
-               try
-               {
-                       java.sql.Connection con = TestUtil.openDB();
-                       java.sql.Statement st;
-                       java.sql.ResultSet rs;
-
-                       // Turn it off
-                       con.setAutoCommit(false);
-                       assertTrue(!con.getAutoCommit());
-
-                       // Turn it back on
-                       con.setAutoCommit(true);
-                       assertTrue(con.getAutoCommit());
-
-                       // Now test commit
-                       st = con.createStatement();
-                       st.executeUpdate("insert into test_a (imagename,image,id) values ('comttest',1234,5678)");
-
-                       con.setAutoCommit(false);
-
-                       // Now update image to 9876 and commit
-                       st.executeUpdate("update test_a set image=9876 where id=5678");
-                       con.commit();
-                       rs = st.executeQuery("select image from test_a where id=5678");
-                       assertTrue(rs.next());
-                       assertEquals(9876, rs.getInt(1));
-                       rs.close();
-
-                       // Now try to change it but rollback
-                       st.executeUpdate("update test_a set image=1111 where id=5678");
-                       con.rollback();
-                       rs = st.executeQuery("select image from test_a where id=5678");
-                       assertTrue(rs.next());
-                       assertEquals(9876, rs.getInt(1)); // Should not change!
-                       rs.close();
-
-                       TestUtil.closeDB(con);
-               }
-               catch (SQLException ex)
-               {
-                       assertTrue(ex.getMessage(), false);
-               }
-       }
-
-       /*
-        * Simple test to see if isClosed works.
-        */
-       public void testIsClosed()
-       {
-               try
-               {
-                       Connection con = TestUtil.openDB();
-
-                       // Should not say closed
-                       assertTrue(!con.isClosed());
-
-                       TestUtil.closeDB(con);
-
-                       // Should now say closed
-                       assertTrue(con.isClosed());
-
-               }
-               catch (SQLException ex)
-               {
-                       assertTrue(ex.getMessage(), false);
-               }
-       }
-
-       /*
-        * Test the warnings system
-        */
-       public void testWarnings()
-       {
-               try
-               {
-                       Connection con = TestUtil.openDB();
-
-                       String testStr = "This Is OuR TeSt message";
-
-                       // The connection must be ours!
-                       assertTrue(con instanceof org.postgresql.PGConnection);
-
-                       // Clear any existing warnings
-                       con.clearWarnings();
-
-                       // Set the test warning
-                       ((org.postgresql.jdbc2.AbstractJdbc2Connection)con).addWarning(testStr);
-
-                       // Retrieve it
-                       SQLWarning warning = con.getWarnings();
-                       assertNotNull(warning);
-                       assertEquals(testStr, warning.getMessage());
-
-                       // Finally test clearWarnings() this time there must be something to delete
-                       con.clearWarnings();
-                       assertTrue(con.getWarnings() == null);
-
-                       TestUtil.closeDB(con);
-               }
-               catch (SQLException ex)
-               {
-                       assertTrue(ex.getMessage(), false);
-               }
-       }
-
-       /*
-        * Transaction Isolation Levels
-        */
-       public void testTransactionIsolation()
-       {
-               try
-               {
-                       Connection con = TestUtil.openDB();
-
-                       // PostgreSQL defaults to READ COMMITTED
-                       assertEquals(Connection.TRANSACTION_READ_COMMITTED,
-                                                con.getTransactionIsolation());
-
-                       // Begin a transaction
-                       con.setAutoCommit(false);
-
-                       // The isolation level should not have changed
-                       assertEquals(Connection.TRANSACTION_READ_COMMITTED,
-                                                con.getTransactionIsolation());
-
-
-                       // Note the behavior on when a transaction starts is different
-                       // under 7.3 than previous versions.  In 7.3 a transaction 
-                       // starts with the first sql command, whereas previously 
-                       // you were always in a transaction in autocommit=false
-            // so we issue a select to ensure we are in a transaction
-            Statement stmt = con.createStatement();
-            stmt.executeQuery("select 1");
-
-                       // Now change the default for future transactions
-                       con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
-
-                       // Since the call to setTransactionIsolation() above was made
-                       // inside the transaction, the isolation level of the current
-                       // transaction did not change. It affects only future ones.
-                       // This behaviour is recommended by the JDBC spec.
-                       assertEquals(Connection.TRANSACTION_READ_COMMITTED,
-                                                con.getTransactionIsolation());
-
-                       // Begin a new transaction
-                       con.commit();
-            stmt.executeQuery("select 1");
-
-                       // Now we should see the new isolation level
-                       assertEquals(Connection.TRANSACTION_SERIALIZABLE,
-                                                con.getTransactionIsolation());
-
-                       // Repeat the steps above with the transition back to
-                       // READ COMMITTED.
-                       con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
-                       assertEquals(Connection.TRANSACTION_SERIALIZABLE,
-                                                con.getTransactionIsolation());
-                       con.commit();
-                       assertEquals(Connection.TRANSACTION_READ_COMMITTED,
-                                                con.getTransactionIsolation());
-
-                       // Now run some tests with autocommit enabled.
-                       con.setAutoCommit(true);
-
-                       assertEquals(Connection.TRANSACTION_READ_COMMITTED,
-                                                con.getTransactionIsolation());
-
-                       con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
-                       assertEquals(Connection.TRANSACTION_SERIALIZABLE,
-                                                con.getTransactionIsolation());
-
-                       con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
-                       assertEquals(Connection.TRANSACTION_READ_COMMITTED, con.getTransactionIsolation());
-
-                       // Test if a change of isolation level before beginning the
-                       // transaction affects the isolation level inside the transaction.
-                       con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
-                       assertEquals(Connection.TRANSACTION_SERIALIZABLE,
-                                                con.getTransactionIsolation());
-                       con.setAutoCommit(false);
-                       assertEquals(Connection.TRANSACTION_SERIALIZABLE,
-                                                con.getTransactionIsolation());
-                       con.setAutoCommit(true);
-                       assertEquals(Connection.TRANSACTION_SERIALIZABLE,
-                                                con.getTransactionIsolation());
-                       con.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
-                       assertEquals(Connection.TRANSACTION_READ_COMMITTED,
-                                                con.getTransactionIsolation());
-                       con.setAutoCommit(false);
-                       assertEquals(Connection.TRANSACTION_READ_COMMITTED,
-                                                con.getTransactionIsolation());
-
-                       TestUtil.closeDB(con);
-               }
-               catch ( SQLException ex )
-               {
-                       fail( ex.getMessage() );
-               }
-       }
-
-       /*
-        * JDBC2 Type mappings
-        */
-       public void testTypeMaps()
-       {
-               try
-               {
-                       Connection con = TestUtil.openDB();
-
-                       // preserve the current map
-                       java.util.Map oldmap = con.getTypeMap();
-
-                       // now change it for an empty one
-                       java.util.Map newmap = new java.util.HashMap();
-                       con.setTypeMap(newmap);
-                       assertEquals(newmap, con.getTypeMap());
-
-                       // restore the old one
-                       con.setTypeMap(oldmap);
-                       assertEquals(oldmap, con.getTypeMap());
-
-                       TestUtil.closeDB(con);
-               }
-               catch (SQLException ex)
-               {
-                       assertTrue(ex.getMessage(), false);
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/CursorFetchTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/CursorFetchTest.java
deleted file mode 100644 (file)
index 716a2cb..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-package org.postgresql.test.jdbc2;
-import java.sql.*;
-import junit.framework.TestCase;
-import org.postgresql.test.TestUtil;
-/*
- *  Tests for using non-zero setFetchSize().
- */
-public class CursorFetchTest extends TestCase
-{
-       private Connection con;
-       public CursorFetchTest(String name)
-       {
-               super(name);
-       }
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               TestUtil.createTable(con, "test_fetch", "value integer");
-               con.setAutoCommit(false);
-       }
-       protected void tearDown() throws Exception
-       {
-               con.rollback();
-               con.setAutoCommit(true);
-               TestUtil.dropTable(con, "test_fetch");
-               TestUtil.closeDB(con);
-       }
-       protected void createRows(int count) throws Exception
-       {
-               PreparedStatement stmt = con.prepareStatement("insert into test_fetch(value) values(?)");
-               for (int i = 0; i < count; ++i) {
-                       stmt.setInt(1,i);
-                       stmt.executeUpdate();
-               }
-       }
-
-       // Test various fetchsizes.
-       public void testBasicFetch() throws Exception
-       {
-               createRows(100);
-               PreparedStatement stmt = con.prepareStatement("select * from test_fetch order by value");
-               int[] testSizes = { 0, 1, 49, 50, 51, 99, 100, 101 };
-               for (int i = 0; i < testSizes.length; ++i) {
-                       stmt.setFetchSize(testSizes[i]);
-                       assertEquals(testSizes[i], stmt.getFetchSize());
-
-                       ResultSet rs = stmt.executeQuery();
-                       assertEquals(testSizes[i], rs.getFetchSize());
-                       int count = 0;
-                       while (rs.next()) {
-                               assertEquals("query value error with fetch size " + testSizes[i], count, rs.getInt(1));
-                               ++count;
-                       }
-                       assertEquals("total query size error with fetch size " + testSizes[i], 100, count);
-               }
-       }
-
-       //
-       // Tests for ResultSet.setFetchSize().
-       //
-
-       // test one:
-       //   set fetchsize = 0
-       //   run query (all rows should be fetched)
-       //   set fetchsize = 50 (should have no effect)
-       //   process results
-       public void testResultSetFetchSizeOne() throws Exception
-       {
-               createRows(100);
-
-               PreparedStatement stmt = con.prepareStatement("select * from test_fetch order by value");
-               stmt.setFetchSize(0);
-               ResultSet rs = stmt.executeQuery();
-               rs.setFetchSize(50); // Should have no effect.
-
-               int count = 0;          
-               while (rs.next()) {
-                       assertEquals(count, rs.getInt(1));
-                       ++count;
-               }
-
-               assertEquals(100, count);
-       }
-
-       // test two:
-       //   set fetchsize = 25
-       //   run query (25 rows fetched)
-       //   set fetchsize = 0
-       //   process results:
-       //     process 25 rows
-       //     should do a FETCH ALL to get more data
-       //     process 75 rows
-       public void testResultSetFetchSizeTwo() throws Exception
-       {
-               createRows(100);
-
-               PreparedStatement stmt = con.prepareStatement("select * from test_fetch order by value");
-               stmt.setFetchSize(25);
-               ResultSet rs = stmt.executeQuery();
-               rs.setFetchSize(0);
-
-               int count = 0;
-               while (rs.next()) {
-                       assertEquals(count, rs.getInt(1));
-                       ++count;
-               }
-
-               assertEquals(100, count);
-       }
-
-       // test three:
-       //   set fetchsize = 25
-       //   run query (25 rows fetched)
-       //   set fetchsize = 50
-       //   process results:
-       //     process 25 rows. should NOT hit end-of-results here.
-       //     do a FETCH FORWARD 50
-       //     process 50 rows
-       //     do a FETCH FORWARD 50
-       //     process 25 rows. end of results.
-       public void testResultSetFetchSizeThree() throws Exception
-       {
-               createRows(100);
-
-               PreparedStatement stmt = con.prepareStatement("select * from test_fetch order by value");
-               stmt.setFetchSize(25);
-               ResultSet rs = stmt.executeQuery();
-               rs.setFetchSize(50);
-
-               int count = 0;
-               while (rs.next()) {
-                       assertEquals(count, rs.getInt(1));
-                       ++count;
-               }
-
-               assertEquals(100, count);
-       }
-
-       // test four:
-       //   set fetchsize = 50
-       //   run query (50 rows fetched)
-       //   set fetchsize = 25
-       //   process results:
-       //     process 50 rows.
-       //     do a FETCH FORWARD 25
-       //     process 25 rows
-       //     do a FETCH FORWARD 25
-       //     process 25 rows. end of results.
-       public void testResultSetFetchSizeFour() throws Exception
-       {
-               createRows(100);
-
-               PreparedStatement stmt = con.prepareStatement("select * from test_fetch order by value");
-               stmt.setFetchSize(50);
-               ResultSet rs = stmt.executeQuery();
-               rs.setFetchSize(25);
-
-               int count = 0;
-               while (rs.next()) {
-                       assertEquals(count, rs.getInt(1));
-                       ++count;
-               }
-
-               assertEquals(100, count);
-       }
-
-       // Test odd queries that should not be transformed into cursor-based fetches.
-       public void TODO_FAILS_testInsert() throws Exception
-       {
-               // INSERT should not be transformed.
-               PreparedStatement stmt = con.prepareStatement("insert into test_fetch(value) values(1)");
-               stmt.setFetchSize(100); // Should be meaningless.
-               stmt.executeUpdate();
-       }
-
-       public void TODO_FAILS_testMultistatement() throws Exception
-       {
-               // Queries with multiple statements should not be transformed.
-
-               createRows(100); // 0 .. 99
-               PreparedStatement stmt = con.prepareStatement("insert into test_fetch(value) values(100); select * from test_fetch order by value");
-               stmt.setFetchSize(10);
-               ResultSet rs = stmt.executeQuery();
-               
-               int count = 0;
-               while (rs.next()) {
-                       assertEquals(count, rs.getInt(1));
-                       ++count;
-               }
-               assertEquals(101, count);
-       }       
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataPropertiesTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataPropertiesTest.java
deleted file mode 100644 (file)
index adf1dea..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-
-/*
- * TestCase to test the internal functionality of
- * org.postgresql.jdbc2.DatabaseMetaData's various properties.
- * Methods which return a ResultSet are tested elsewhere.
- * This avoids a complicated setUp/tearDown for something like
- * assertTrue(dbmd.nullPlusNonNullIsNull());
- */
-
-public class DatabaseMetaDataPropertiesTest extends TestCase
-{
-
-       private Connection con;
-       /*
-        * Constructor
-        */
-       public DatabaseMetaDataPropertiesTest(String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-       }
-       protected void tearDown() throws Exception
-       {
-               TestUtil.closeDB( con );
-       }
-
-       /*
-        * The spec says this may return null, but we always do!
-        */
-       public void testGetMetaData()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Test default capabilities
-        */
-       public void testCapabilities()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       assertTrue(dbmd.allProceduresAreCallable());
-                       assertTrue(dbmd.allTablesAreSelectable()); // not true all the time
-
-                       // This should always be false for postgresql (at least for 7.x)
-                       assertTrue(!dbmd.isReadOnly());
-
-                       // does the backend support this yet? The protocol does...
-                       assertTrue(!dbmd.supportsMultipleResultSets());
-
-                       // yes, as multiple backends can have transactions open
-                       assertTrue(dbmd.supportsMultipleTransactions());
-
-                       assertTrue(dbmd.supportsMinimumSQLGrammar());
-                       assertTrue(!dbmd.supportsCoreSQLGrammar());
-                       assertTrue(!dbmd.supportsExtendedSQLGrammar());
-                       if (TestUtil.haveMinimumServerVersion(con,"7.3"))
-                               assertTrue(dbmd.supportsANSI92EntryLevelSQL());
-                       else
-                               assertTrue(!dbmd.supportsANSI92EntryLevelSQL());
-                       assertTrue(!dbmd.supportsANSI92IntermediateSQL());
-                       assertTrue(!dbmd.supportsANSI92FullSQL());
-
-                       assertTrue(dbmd.supportsIntegrityEnhancementFacility());
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-
-       public void testJoins()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       assertTrue(dbmd.supportsOuterJoins());
-                       assertTrue(dbmd.supportsFullOuterJoins());
-                       assertTrue(dbmd.supportsLimitedOuterJoins());
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testCursors()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       assertTrue(!dbmd.supportsPositionedDelete());
-                       assertTrue(!dbmd.supportsPositionedUpdate());
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testValues()
-       {
-               try {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       int indexMaxKeys = dbmd.getMaxColumnsInIndex();
-                       if (TestUtil.haveMinimumServerVersion(con,"7.3")) {
-                               assertEquals(indexMaxKeys,32);
-                       } else {
-                               assertEquals(indexMaxKeys,16);
-                       }
-               } catch (SQLException sqle) {
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testNulls()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       assertTrue(!dbmd.nullsAreSortedAtStart());
-                       assertTrue( dbmd.nullsAreSortedAtEnd() != TestUtil.haveMinimumServerVersion(con,"7.2"));
-                       assertTrue( dbmd.nullsAreSortedHigh() == TestUtil.haveMinimumServerVersion(con,"7.2"));
-                       assertTrue(!dbmd.nullsAreSortedLow());
-
-                       assertTrue(dbmd.nullPlusNonNullIsNull());
-
-                       assertTrue(dbmd.supportsNonNullableColumns());
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testLocalFiles()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       assertTrue(!dbmd.usesLocalFilePerTable());
-                       assertTrue(!dbmd.usesLocalFiles());
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testIdentifiers()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       assertTrue(!dbmd.supportsMixedCaseIdentifiers()); // always false
-                       assertTrue(dbmd.supportsMixedCaseQuotedIdentifiers());  // always true
-
-                       assertTrue(!dbmd.storesUpperCaseIdentifiers());   // always false
-                       assertTrue(dbmd.storesLowerCaseIdentifiers());    // always true
-                       assertTrue(!dbmd.storesUpperCaseQuotedIdentifiers()); // always false
-                       assertTrue(!dbmd.storesLowerCaseQuotedIdentifiers()); // always false
-                       assertTrue(!dbmd.storesMixedCaseQuotedIdentifiers()); // always false
-
-                       assertTrue(dbmd.getIdentifierQuoteString().equals("\""));
-
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testTables()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       // we can add columns
-                       assertTrue(dbmd.supportsAlterTableWithAddColumn());
-
-                       // we can only drop columns in >= 7.3
-                       if (TestUtil.haveMinimumServerVersion(con,"7.3")) {
-                               assertTrue(dbmd.supportsAlterTableWithDropColumn());
-                       } else {
-                               assertTrue(!dbmd.supportsAlterTableWithDropColumn());
-                       }
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testSelect()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       // yes we can?: SELECT col a FROM a;
-                       assertTrue(dbmd.supportsColumnAliasing());
-
-                       // yes we can have expressions in ORDERBY
-                       assertTrue(dbmd.supportsExpressionsInOrderBy());
-
-                       // Yes, an ORDER BY clause can contain columns that are not in the
-                       // SELECT clause.
-                       assertTrue(dbmd.supportsOrderByUnrelated());
-
-                       assertTrue(dbmd.supportsGroupBy());
-                       assertTrue(dbmd.supportsGroupByUnrelated());
-                       assertTrue(dbmd.supportsGroupByBeyondSelect()); // needs checking
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testDBParams()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       assertTrue(dbmd.getURL().equals(TestUtil.getURL()));
-                       assertTrue(dbmd.getUserName().equals(TestUtil.getUser()));
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testDbProductDetails()
-       {
-               try
-               {
-                       assertTrue(con instanceof org.postgresql.PGConnection);
-                       org.postgresql.jdbc2.AbstractJdbc2Connection pc = (org.postgresql.jdbc2.AbstractJdbc2Connection) con;
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       assertTrue(dbmd.getDatabaseProductName().equals("PostgreSQL"));
-                       //The test below doesn't make sense to me, it tests that
-                       //the version of the driver = the version of the database it is connected to
-                       //since the driver should be backwardly compatible this test is commented out
-                       //assertTrue(dbmd.getDatabaseProductVersion().startsWith(
-                       //                 Integer.toString(pc.getDriver().getMajorVersion())
-                       //                 + "."
-                       //                 + Integer.toString(pc.getDriver().getMinorVersion())));
-                       assertTrue(dbmd.getDriverName().equals("PostgreSQL Native Driver"));
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testDriverVersioning()
-       {
-               try
-               {
-                       assertTrue(con instanceof org.postgresql.PGConnection);
-                       org.postgresql.jdbc2.AbstractJdbc2Connection pc = (org.postgresql.jdbc2.AbstractJdbc2Connection) con;
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       assertTrue(dbmd.getDriverVersion().equals(org.postgresql.Driver.getVersion()));
-                       assertTrue(dbmd.getDriverMajorVersion() == pc.getDriver().getMajorVersion());
-                       assertTrue(dbmd.getDriverMinorVersion() == pc.getDriver().getMinorVersion());
-
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-}
-
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
deleted file mode 100644 (file)
index dd7bef0..0000000
+++ /dev/null
@@ -1,527 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-
-/*
- * TestCase to test the internal functionality of org.postgresql.jdbc2.DatabaseMetaData
- *
- * PS: Do you know how difficult it is to type on a train? ;-)
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.22 2003/12/12 18:30:27 davec Exp $
- */
-
-public class DatabaseMetaDataTest extends TestCase
-{
-
-       private Connection con;
-       /*
-        * Constructor
-        */
-       public DatabaseMetaDataTest(String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               TestUtil.createTable( con, "testmetadata", "id int4, name text, updated timestamp" );
-               Statement stmt = con.createStatement();
-               //we add the following comments to ensure the joins to the comments
-               //are done correctly. This ensures we correctly test that case.
-               stmt.execute("comment on table testmetadata is 'this is a table comment'");
-               stmt.execute("comment on column testmetadata.id is 'this is a column comment'");
-       }
-       protected void tearDown() throws Exception
-       {
-               TestUtil.dropTable( con, "testmetadata" );
-
-               TestUtil.closeDB( con );
-       }
-
-       public void testTables()
-       {
-               try
-               {
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       ResultSet rs = dbmd.getTables( null, null, "testmetadat%", new String[] {"TABLE"});
-                       assertTrue( rs.next() );
-                       String tableName = rs.getString("TABLE_NAME");
-                       assertEquals( "testmetadata", tableName );
-                       String tableType = rs.getString("TABLE_TYPE");
-                       assertEquals( "TABLE", tableType );
-            //There should only be one row returned 
-            assertTrue( "getTables() returned too many rows", rs.next() == false);
-                       rs.close();
-
-                       rs = dbmd.getColumns("", "", "test%", "%" );
-                       assertTrue( rs.next() );
-                       assertEquals( "testmetadata", rs.getString("TABLE_NAME") );
-                       assertEquals( "id", rs.getString("COLUMN_NAME") );
-                       assertEquals( java.sql.Types.INTEGER, rs.getInt("DATA_TYPE") );
-
-                       assertTrue( rs.next() );
-                       assertEquals( "testmetadata", rs.getString("TABLE_NAME") );
-                       assertEquals( "name", rs.getString("COLUMN_NAME") );
-                       assertEquals( java.sql.Types.VARCHAR, rs.getInt("DATA_TYPE") );
-
-                       assertTrue( rs.next() );
-                       assertEquals( "testmetadata", rs.getString("TABLE_NAME") );
-                       assertEquals( "updated", rs.getString("COLUMN_NAME") );
-                       assertEquals( java.sql.Types.TIMESTAMP, rs.getInt("DATA_TYPE") );
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testCrossReference()
-       {
-               try
-               {
-                       Connection con1 = TestUtil.openDB();
-
-                       TestUtil.createTable( con1, "vv", "a int not null, b int not null, primary key ( a, b )" );
-
-                       TestUtil.createTable( con1, "ww", "m int not null, n int not null, primary key ( m, n ), foreign key ( m, n ) references vv ( a, b )" );
-
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       ResultSet rs = dbmd.getCrossReference(null, "", "vv", null, "", "ww" );
-
-                       for (int j = 1; rs.next(); j++ )
-                       {
-
-                               String pkTableName = rs.getString( "PKTABLE_NAME" );
-                               assertEquals ( "vv", pkTableName );
-
-                               String pkColumnName = rs.getString( "PKCOLUMN_NAME" );
-                               assertTrue( pkColumnName.equals("a") || pkColumnName.equals("b"));
-
-                               String fkTableName = rs.getString( "FKTABLE_NAME" );
-                               assertEquals( "ww", fkTableName );
-
-                               String fkColumnName = rs.getString( "FKCOLUMN_NAME" );
-                               assertTrue( fkColumnName.equals( "m" ) || fkColumnName.equals( "n" ) ) ;
-
-                               String fkName = rs.getString( "FK_NAME" );
-                               if (TestUtil.haveMinimumServerVersion(con1,"7.3")) {
-                                       assertTrue(fkName.startsWith("$1"));
-                               } else {
-                                       assertTrue( fkName.startsWith( "<unnamed>") );
-                               }
-
-                               String pkName = rs.getString( "PK_NAME" );
-                               assertEquals( "vv_pkey", pkName );
-
-                               int keySeq = rs.getInt( "KEY_SEQ" );
-                               assertEquals( j, keySeq );
-                       }
-
-
-                       TestUtil.dropTable( con1, "vv" );
-                       TestUtil.dropTable( con1, "ww" );
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testForeignKeyActions()
-       {
-               try {
-                       Connection conn = TestUtil.openDB();
-                       TestUtil.createTable(conn, "pkt", "id int primary key");
-                       TestUtil.createTable(conn, "fkt1", "id int references pkt on update restrict on delete cascade");
-                       TestUtil.createTable(conn, "fkt2", "id int references pkt on update set null on delete set default");
-                       DatabaseMetaData dbmd = conn.getMetaData();
-
-                       ResultSet rs = dbmd.getImportedKeys(null,"","fkt1");
-                       assertTrue(rs.next());
-                       assertTrue(rs.getInt("UPDATE_RULE") == DatabaseMetaData.importedKeyRestrict);
-                       assertTrue(rs.getInt("DELETE_RULE") == DatabaseMetaData.importedKeyCascade);
-                       rs.close();
-
-                       rs = dbmd.getImportedKeys(null,"","fkt2");
-                       assertTrue(rs.next());
-                       assertTrue(rs.getInt("UPDATE_RULE") == DatabaseMetaData.importedKeySetNull);
-                       assertTrue(rs.getInt("DELETE_RULE") == DatabaseMetaData.importedKeySetDefault);
-                       rs.close();
-
-                       TestUtil.dropTable(conn,"fkt2");
-                       TestUtil.dropTable(conn,"fkt1");
-                       TestUtil.dropTable(conn,"pkt");
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testForeignKeysToUniqueIndexes()
-       {
-               try
-               {
-                       if (!TestUtil.haveMinimumServerVersion(con,"7.4"))
-                               return;
-               
-                       Connection con1 = TestUtil.openDB();
-                       TestUtil.createTable( con1, "pkt", "a int not null, b int not null, CONSTRAINT pkt_pk_a PRIMARY KEY (a), CONSTRAINT pkt_un_b UNIQUE (b)");
-                       TestUtil.createTable( con1, "fkt", "c int, d int, CONSTRAINT fkt_fk_c FOREIGN KEY (c) REFERENCES pkt(b)");
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       ResultSet rs = dbmd.getImportedKeys("","","fkt");
-                       int j = 0;
-                       for (; rs.next(); j++)
-                       {
-                               assertTrue("pkt".equals(rs.getString("PKTABLE_NAME")));
-                               assertTrue("fkt".equals(rs.getString("FKTABLE_NAME")));
-                               assertTrue("pkt_un_b".equals(rs.getString("PK_NAME")));
-                               assertTrue("b".equals(rs.getString("PKCOLUMN_NAME")));
-                       }
-                       assertTrue(j == 1);
-
-                       TestUtil.dropTable(con1, "fkt");
-                       TestUtil.dropTable(con1, "pkt");
-                       con1.close();
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testMultiColumnForeignKeys()
-       {
-               try
-               {
-                       Connection con1 = TestUtil.openDB();
-                       TestUtil.createTable( con1, "pkt", "a int not null, b int not null, CONSTRAINT pkt_pk PRIMARY KEY (a,b)");
-                       TestUtil.createTable( con1, "fkt", "c int, d int, CONSTRAINT fkt_fk_pkt FOREIGN KEY (c,d) REFERENCES pkt(b,a)");
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       ResultSet rs = dbmd.getImportedKeys("","","fkt");
-                       int j = 0;
-                       for (; rs.next(); j++)
-                       {
-                               assertTrue("pkt".equals(rs.getString("PKTABLE_NAME")));
-                               assertTrue("fkt".equals(rs.getString("FKTABLE_NAME")));
-                               assertTrue(j+1 == rs.getInt("KEY_SEQ"));
-                               if (j == 0) {
-                                       assertTrue("b".equals(rs.getString("PKCOLUMN_NAME")));
-                                       assertTrue("c".equals(rs.getString("FKCOLUMN_NAME")));
-                               } else {
-                                       assertTrue("a".equals(rs.getString("PKCOLUMN_NAME")));
-                                       assertTrue("d".equals(rs.getString("FKCOLUMN_NAME")));
-                               }
-                       }
-                       assertTrue(j == 2);
-
-                       TestUtil.dropTable(con1, "fkt");
-                       TestUtil.dropTable(con1, "pkt");
-                       con1.close();
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testForeignKeys()
-       {
-               try
-               {
-                       Connection con1 = TestUtil.openDB();
-                       TestUtil.createTable( con1, "people", "id int4 primary key, name text" );
-                       TestUtil.createTable( con1, "policy", "id int4 primary key, name text" );
-
-                       TestUtil.createTable( con1, "users", "id int4 primary key, people_id int4, policy_id int4," +
-                                                                 "CONSTRAINT people FOREIGN KEY (people_id) references people(id)," +
-                                                                 "constraint policy FOREIGN KEY (policy_id) references policy(id)" );
-
-
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       ResultSet rs = dbmd.getImportedKeys(null, "", "users" );
-                       int j = 0;
-                       for (; rs.next(); j++ )
-                       {
-
-                               String pkTableName = rs.getString( "PKTABLE_NAME" );
-                               assertTrue ( pkTableName.equals("people") || pkTableName.equals("policy") );
-
-                               String pkColumnName = rs.getString( "PKCOLUMN_NAME" );
-                               assertEquals( "id", pkColumnName );
-
-                               String fkTableName = rs.getString( "FKTABLE_NAME" );
-                               assertEquals( "users", fkTableName );
-
-                               String fkColumnName = rs.getString( "FKCOLUMN_NAME" );
-                               assertTrue( fkColumnName.equals( "people_id" ) || fkColumnName.equals( "policy_id" ) ) ;
-
-                               String fkName = rs.getString( "FK_NAME" );
-                               assertTrue( fkName.startsWith( "people") || fkName.startsWith( "policy" ) );
-
-                               String pkName = rs.getString( "PK_NAME" );
-                               assertTrue( pkName.equals( "people_pkey") || pkName.equals( "policy_pkey" ) );
-
-                       }
-
-                       assertTrue ( j == 2 );
-
-                       rs = dbmd.getExportedKeys( null, "", "people" );
-
-                       // this is hacky, but it will serve the purpose
-                       assertTrue ( rs.next() );
-
-                       assertEquals( "people", rs.getString( "PKTABLE_NAME" ) );
-                       assertEquals( "id", rs.getString( "PKCOLUMN_NAME" ) );
-
-                       assertEquals( "users", rs.getString( "FKTABLE_NAME" ) );
-                       assertEquals( "people_id", rs.getString( "FKCOLUMN_NAME" ) );
-
-                       assertTrue( rs.getString( "FK_NAME" ).startsWith( "people" ) );
-
-
-                       TestUtil.dropTable( con1, "users" );
-                       TestUtil.dropTable( con1, "people" );
-                       TestUtil.dropTable( con1, "policy" );
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testColumns()
-       {
-               // At the moment just test that no exceptions are thrown KJ
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getColumns(null,null,"pg_class",null);
-                       rs.close();
-               } catch (SQLException sqle) {
-                       sqle.printStackTrace();
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testColumnPrivileges()
-       {
-               // At the moment just test that no exceptions are thrown KJ
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getColumnPrivileges(null,null,"pg_statistic",null);
-                       rs.close();
-               } catch (SQLException sqle) {
-                       sqle.printStackTrace();
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testTablePrivileges()
-       {
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getTablePrivileges(null,null,"testmetadata");
-                       boolean l_foundSelect = false;
-                       while (rs.next()) {
-                               if (rs.getString("GRANTEE").equals(TestUtil.getUser()) 
-                                       && rs.getString("PRIVILEGE").equals("SELECT")) l_foundSelect = true; 
-                       }
-                       rs.close();
-                       //Test that the table owner has select priv
-                       assertTrue("Couldn't find SELECT priv on table testmetadata for " + TestUtil.getUser(),l_foundSelect);
-               } catch (SQLException sqle) {
-                       sqle.printStackTrace();
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testPrimaryKeys()
-       {
-               // At the moment just test that no exceptions are thrown KJ
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getPrimaryKeys(null,null,"pg_class");
-                       rs.close();
-               } catch (SQLException sqle) {
-                       sqle.printStackTrace();
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testIndexInfo()
-       {
-               // At the moment just test that no exceptions are thrown KJ
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getIndexInfo(null,null,"pg_class",false,false);
-                       rs.close();
-               } catch (SQLException sqle) {
-                       sqle.printStackTrace();
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testTableTypes()
-       {
-               // At the moment just test that no exceptions are thrown KJ
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getTableTypes();
-                       rs.close();
-               } catch (SQLException sqle) {
-                       sqle.printStackTrace();
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testProcedureColumns()
-       {
-               // At the moment just test that no exceptions are thrown KJ
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getProcedureColumns(null,null,null,null);
-                       rs.close();
-               } catch (SQLException sqle) {
-                       sqle.printStackTrace();
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testVersionColumns()
-       {
-               // At the moment just test that no exceptions are thrown KJ
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getVersionColumns(null,null,"pg_class");
-                       rs.close();
-               } catch (SQLException sqle) {
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testBestRowIdentifier()
-       {
-               // At the moment just test that no exceptions are thrown KJ
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getBestRowIdentifier(null,null,"pg_type",DatabaseMetaData.bestRowSession,false);
-                       rs.close();
-               } catch (SQLException sqle) {
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testProcedures()
-       {
-               // At the moment just test that no exceptions are thrown KJ
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getProcedures(null,null,null);
-                       rs.close();
-               } catch (SQLException sqle) {
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testCatalogs()
-       {
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-                       ResultSet rs = dbmd.getCatalogs();
-                       boolean foundTemplate0 = false;
-                       boolean foundTemplate1 = false;
-                       while(rs.next()) {
-                               String database = rs.getString("TABLE_CAT");
-                               if ("template0".equals(database)) {
-                                       foundTemplate0 = true;
-                               } else if ("template1".equals(database)) {
-                                       foundTemplate1 = true;
-                               }
-                       }
-                       rs.close();
-                       assertTrue(foundTemplate0);
-                       assertTrue(foundTemplate1);
-               } catch(SQLException sqle) {
-                       fail(sqle.getMessage());
-               }
-       }
-
-       public void testSchemas()
-       {
-               try
-               {
-                       DatabaseMetaData dbmd = con.getMetaData();
-                       assertNotNull(dbmd);
-
-                       ResultSet rs = dbmd.getSchemas();
-                       boolean foundPublic = false;
-                       boolean foundEmpty = false;
-                       boolean foundPGCatalog = false;
-                       int count;
-               
-                       for(count=0; rs.next(); count++) {
-                               String schema = rs.getString("TABLE_SCHEM");
-                               if ("public".equals(schema)) {
-                                       foundPublic = true;
-                               } else if ("".equals(schema)) {
-                                       foundEmpty = true;
-                               } else if ("pg_catalog".equals(schema)) {
-                                       foundPGCatalog = true;
-                               }
-                       }
-                       rs.close();
-                       if (TestUtil.haveMinimumServerVersion(con,"7.3")) {
-                               assertTrue(count >= 2);
-                               assertTrue(foundPublic);
-                               assertTrue(foundPGCatalog);
-                               assertTrue(!foundEmpty);
-                       } else {
-                               assertEquals(count,1);
-                               assertTrue(foundEmpty);
-                               assertTrue(!foundPublic);
-                               assertTrue(!foundPGCatalog);
-                       }
-               } catch (SQLException sqle) {
-                       fail(sqle.getMessage());
-               }
-       }
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/DateTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/DateTest.java
deleted file mode 100644 (file)
index ecef3f1..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-
-/*
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/DateTest.java,v 1.7 2003/11/29 22:41:23 pgsql Exp $
- *
- * Some simple tests based on problems reported by users. Hopefully these will
- * help prevent previous problems from re-occuring ;-)
- *
- */
-public class DateTest extends TestCase
-{
-
-       private Connection con;
-       private boolean testingSetDate = false;
-
-       public DateTest(String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               TestUtil.createTable(con, "testdate", "dt date");
-       }
-
-       protected void tearDown() throws Exception
-       {
-               TestUtil.dropTable(con, "testdate");
-               TestUtil.closeDB(con);
-       }
-
-       /*
-        * Tests the time methods in ResultSet
-        */
-       public void testGetDate()
-       {
-               try
-               {
-                       Statement stmt = con.createStatement();
-
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1950-02-07'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1970-06-02'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1999-08-11'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'2001-02-13'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1950-04-02'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1970-11-30'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1988-01-01'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'2003-07-09'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1934-02-28'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1969-04-03'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1982-08-03'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'2012-03-15'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1912-05-01'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1971-12-15'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'1984-12-03'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'2000-01-01'")));
-
-                       /* dateTest() contains all of the tests */
-                       dateTest();
-
-                       assertEquals(16, stmt.executeUpdate("DELETE FROM " + "testdate"));
-                       stmt.close();
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Tests the time methods in PreparedStatement
-        */
-       public void testSetDate()
-       {
-               try
-               {
-                       Statement stmt = con.createStatement();
-                       PreparedStatement ps = con.prepareStatement(TestUtil.insertSQL("testdate", "?"));
-
-                       ps.setDate(1, makeDate(1950, 2, 7));
-                       assertEquals(1, ps.executeUpdate());
-
-                       ps.setDate(1, makeDate(1970, 6, 2));
-                       assertEquals(1, ps.executeUpdate());
-
-                       ps.setDate(1, makeDate(1999, 8, 11));
-                       assertEquals(1, ps.executeUpdate());
-
-                       ps.setDate(1, makeDate(2001, 2, 13));
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Timestamp.valueOf("1950-04-02 12:00:00"), java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Timestamp.valueOf("1970-11-30 3:00:00"), java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Timestamp.valueOf("1988-1-1 13:00:00"), java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Timestamp.valueOf("2003-07-09 12:00:00"), java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, "1934-02-28", java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, "1969-04-3", java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, "1982-08-03", java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, "2012-3-15", java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Date.valueOf("1912-5-1"), java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Date.valueOf("1971-12-15"), java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Date.valueOf("1984-12-03"), java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Date.valueOf("2000-1-1"), java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, "1944-4-04-01", java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, "1970-01-1-10", java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, "1982-12-14+13", java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, "2010-08-3+05", java.sql.Types.DATE);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.close();
-
-                       // Need to set a flag so that the method knows there is an extra test.
-                       testingSetDate = true;
-                       // Fall through helper
-                       dateTest();
-                       testingSetDate = false;
-
-                       assertEquals(20, stmt.executeUpdate("DELETE FROM testdate"));
-                       stmt.close();
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Helper for the date tests. It tests what should be in the db
-        */
-       private void dateTest() throws SQLException
-       {
-               Statement st = con.createStatement();
-               ResultSet rs;
-               java.sql.Date d;
-
-               rs = st.executeQuery(TestUtil.selectSQL("testdate", "dt"));
-               assertNotNull(rs);
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1950, 2, 7));
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1970, 6, 2));
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1999, 8, 11));
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(2001, 2, 13));
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1950, 4, 2));
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1970, 11, 30));                
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1988, 1, 1));
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(2003, 7, 9));
-               
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1934, 2, 28));                                         
-                               
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1969, 4, 3));
-               
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1982, 8, 3));
-               
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(2012, 3, 15)); 
-               
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1912, 5, 1));  
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1971, 12, 15));
-               
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(1984, 12, 3));
-
-               assertTrue(rs.next());
-               d = rs.getDate(1);
-               assertNotNull(d);
-               assertEquals(d, makeDate(2000, 1, 1));
-               
-               //now we have to convert the date, cause I fed it a timezone. IF it used it. hence the check                    
-               if (testingSetDate)
-               {
-                       assertTrue(rs.next());
-                       d = rs.getDate(1);
-                       assertNotNull(d);
-                       java.sql.Date tmpDate = java.sql.Date.valueOf("1944-4-4");
-                       int localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
-                       if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(tmpDate))
-                       {
-                               localoffset += 60 * 60 * 1000;
-                       }                       
-                       int Dateoffset = 60 * 60 * 1000;
-                       tmpDate.setTime(tmpDate.getTime() + Dateoffset + localoffset);
-                       assertEquals(d, makeDate(tmpDate.getYear() + 1900, tmpDate.getMonth()+1, tmpDate.getDate()));
-                       
-                       assertTrue(rs.next());
-                       d = rs.getDate(1);
-                       assertNotNull(d);
-                       tmpDate = java.sql.Date.valueOf("1970-1-1");
-                       localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
-                       if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(tmpDate))
-                       {
-                               localoffset += 60 * 60 * 1000;
-                       }                                               
-                       Dateoffset = 10 * 60 * 60 * 1000;
-                       tmpDate.setTime(tmpDate.getTime() + Dateoffset + localoffset);
-                       assertEquals(d, makeDate(tmpDate.getYear() + 1900, tmpDate.getMonth()+1, tmpDate.getDate()));
-                       
-                       assertTrue(rs.next());
-                       d = rs.getDate(1);
-                       assertNotNull(d);
-                       tmpDate = java.sql.Date.valueOf("1982-12-14");
-                       localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
-                       if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(tmpDate))
-                       {
-                               localoffset += 60 * 60 * 1000;
-                       }                                               
-                       Dateoffset = -13 * 60 * 60 * 1000;
-                       tmpDate.setTime(tmpDate.getTime() + Dateoffset + localoffset);
-                       assertEquals(d, makeDate(tmpDate.getYear() + 1900, tmpDate.getMonth()+1, tmpDate.getDate()));
-
-                       assertTrue(rs.next());
-                       d = rs.getDate(1);
-                       assertNotNull(d);
-                       tmpDate = java.sql.Date.valueOf("2010-08-03");
-                       localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
-                       if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(tmpDate))
-                       {
-                               localoffset += 60 * 60 * 1000;
-                       }                                               
-                       Dateoffset = -5 * 60 * 60 * 1000;
-                       tmpDate.setTime(tmpDate.getTime() + Dateoffset + localoffset);
-                       assertEquals(d, makeDate(tmpDate.getYear() + 1900, tmpDate.getMonth()+1, tmpDate.getDate()));
-               }
-               
-               assertTrue(!rs.next());
-
-               rs.close();
-               st.close();
-       }
-
-       private java.sql.Date makeDate(int y, int m, int d)
-       {
-               return java.sql.Date.valueOf(TestUtil.fix(y, 4) + "-" +
-                                                                        TestUtil.fix(m, 2) + "-" +
-                                                                        TestUtil.fix(d, 2));
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/DriverTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/DriverTest.java
deleted file mode 100644 (file)
index 0b7d934..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-
-/*
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/DriverTest.java,v 1.7 2003/11/29 22:41:23 pgsql Exp $
- *
- * Tests the dynamically created class org.postgresql.Driver
- *
- */
-public class DriverTest extends TestCase
-{
-
-       public DriverTest(String name)
-       {
-               super(name);
-       }
-
-       /*
-        * This tests the acceptsURL() method with a couple of good and badly formed
-        * jdbc urls
-        */
-       public void testAcceptsURL()
-       {
-               try
-               {
-
-                       // Load the driver (note clients should never do it this way!)
-                       org.postgresql.Driver drv = new org.postgresql.Driver();
-                       assertNotNull(drv);
-
-                       // These are always correct
-                       assertTrue(drv.acceptsURL("jdbc:postgresql:test"));
-                       assertTrue(drv.acceptsURL("jdbc:postgresql://localhost/test"));
-                       assertTrue(drv.acceptsURL("jdbc:postgresql://localhost:5432/test"));
-                       assertTrue(drv.acceptsURL("jdbc:postgresql://127.0.0.1/anydbname"));
-                       assertTrue(drv.acceptsURL("jdbc:postgresql://127.0.0.1:5433/hidden"));
-                       assertTrue(drv.acceptsURL("jdbc:postgresql://[::1]:5740/db"));
-
-                       // Badly formatted url's
-                       assertTrue(!drv.acceptsURL("jdbc:postgres:test"));
-                       assertTrue(!drv.acceptsURL("postgresql:test"));
-                       assertTrue(!drv.acceptsURL("db"));
-
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Tests parseURL (internal)
-        */
-       /*
-        * Tests the connect method by connecting to the test database
-        */
-       public void testConnect()
-       {
-               Connection con = null;
-               try
-               {
-                       Class.forName("org.postgresql.Driver");
-
-                       // Test with the url, username & password
-                       con = DriverManager.getConnection(TestUtil.getURL(), TestUtil.getUser(), TestUtil.getPassword());
-                       assertNotNull(con);
-                       con.close();
-
-                       // Test with the username in the url
-                       con = DriverManager.getConnection(TestUtil.getURL() + "?user=" + TestUtil.getUser() + "&password=" + TestUtil.getPassword());
-                       assertNotNull(con);
-                       con.close();
-               }
-               catch (ClassNotFoundException ex)
-               {
-                       fail(ex.getMessage());
-               }
-               catch (SQLException ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/EncodingTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/EncodingTest.java
deleted file mode 100644 (file)
index ce1e318..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-
-package org.postgresql.test.jdbc2;
-
-import junit.framework.*;
-import org.postgresql.core.Encoding;
-import java.io.*;
-
-/*
- * Tests for the Encoding class.
- *
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/EncodingTest.java,v 1.5 2003/11/29 22:41:23 pgsql Exp $
- */
-
-
-public class EncodingTest extends TestCase
-{
-
-       public EncodingTest(String name)
-       {
-               super(name);
-       }
-
-       public void testCreation() throws Exception
-       {
-               Encoding encoding;
-               encoding = Encoding.getEncoding("UNICODE", null);
-               assertEquals("UTF", encoding.name().substring(0, 3).toUpperCase());
-               encoding = Encoding.getEncoding("SQL_ASCII", null);
-               assertTrue(encoding.name().toUpperCase().indexOf("ASCII") != -1);
-               assertEquals("When encoding is unknown the default encoding should be used",
-                                        Encoding.defaultEncoding(),
-                                        Encoding.getEncoding("UNKNOWN", null));
-               encoding = Encoding.getEncoding("SQL_ASCII", "utf-8");
-               assertTrue("Encoding passed in by the user should be preferred",
-                                  encoding.name().toUpperCase().indexOf("UTF") != -1);
-       }
-
-       public void testTransformations() throws Exception
-       {
-               Encoding encoding = Encoding.getEncoding("UNICODE", null);
-               assertEquals("ab", encoding.decode(new byte[] { 97, 98 }));
-
-               assertEquals(2, encoding.encode("ab").length);
-               assertEquals(97, encoding.encode("a")[0]);
-               assertEquals(98, encoding.encode("b")[0]);
-
-               encoding = Encoding.defaultEncoding();
-               assertEquals("a".getBytes()[0], encoding.encode("a")[0]);
-               assertEquals(new String(new byte[] { 97 }),
-                                        encoding.decode(new byte[] { 97 }));
-       }
-
-       public void testReader() throws Exception
-       {
-               Encoding encoding = Encoding.getEncoding("SQL_ASCII", null);
-               InputStream stream = new ByteArrayInputStream(new byte[] { 97, 98 });
-               Reader reader = encoding.getDecodingReader(stream);
-               assertEquals(97, reader.read());
-               assertEquals(98, reader.read());
-               assertEquals( -1, reader.read());
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java
deleted file mode 100644 (file)
index da7949b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import junit.framework.TestCase;
-
-/*
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java,v 1.9 2003/11/29 22:41:23 pgsql Exp $
- *
- * Some simple tests to check that the required components needed for JBuilder
- * stay working
- *
- */
-public class JBuilderTest extends TestCase
-{
-
-       public JBuilderTest(String name)
-       {
-               super(name);
-       }
-
-       // Set up the fixture for this testcase: the tables for this test.
-       protected void setUp() throws Exception
-       {
-               Connection con = TestUtil.openDB();
-
-               TestUtil.createTable( con, "test_c",
-                                                         "source text,cost money,imageid int4" );
-
-               TestUtil.closeDB(con);
-       }
-
-       // Tear down the fixture for this test case.
-       protected void tearDown() throws Exception
-       {
-               Connection con = TestUtil.openDB();
-               TestUtil.dropTable(con, "test_c");
-               TestUtil.closeDB(con);
-       }
-
-       /*
-        * This tests that Money types work. JDBCExplorer barfs if this fails.
-        */
-       public void testMoney()
-       {
-               try
-               {
-                       Connection con = TestUtil.openDB();
-
-                       Statement st = con.createStatement();
-                       ResultSet rs = st.executeQuery("select cost from test_c");
-                       assertNotNull(rs);
-
-                       while (rs.next())
-                       {
-                               rs.getDouble(1);
-                       }
-
-                       rs.close();
-                       st.close();
-
-                       TestUtil.closeDB(con);
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/Jdbc2TestSuite.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/Jdbc2TestSuite.java
deleted file mode 100644 (file)
index 7a5acab..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import junit.framework.TestSuite;
-
-/*
- * Executes all known tests for JDBC2 and includes some utility methods.
- */
-public class Jdbc2TestSuite extends TestSuite
-{
-
-       /*
-        * The main entry point for JUnit
-        */
-       public static TestSuite suite()
-       {
-               TestSuite suite = new TestSuite();
-
-               //
-               // Add one line per class in our test cases. These should be in order of
-               // complexity.
-
-               // ANTTest should be first as it ensures that test parameters are
-               // being sent to the suite.
-               //
-               suite.addTestSuite(ANTTest.class);
-
-               // Basic Driver internals
-               suite.addTestSuite(DriverTest.class);
-               suite.addTestSuite(ConnectionTest.class);
-               suite.addTestSuite(DatabaseMetaDataTest.class);
-               suite.addTestSuite(DatabaseMetaDataPropertiesTest.class);
-               suite.addTestSuite(EncodingTest.class);
-
-               // Connectivity/Protocols
-
-               // ResultSet
-               suite.addTestSuite(ResultSetTest.class);
-
-               // Time, Date, Timestamp
-               suite.addTestSuite(DateTest.class);
-               suite.addTestSuite(TimeTest.class);
-               suite.addTestSuite(TimestampTest.class);
-
-               // PreparedStatement
-
-               // ServerSide Prepared Statements
-               suite.addTestSuite(ServerPreparedStmtTest.class);
-
-               // BatchExecute
-               suite.addTestSuite(BatchExecuteTest.class);
-
-
-               // Other misc tests, based on previous problems users have had or specific
-               // features some applications require.
-               suite.addTestSuite(JBuilderTest.class);
-               suite.addTestSuite(MiscTest.class);
-
-               // Fastpath/LargeObject
-               suite.addTestSuite(BlobTest.class);
-               suite.addTestSuite(OID74Test.class);
-
-               suite.addTestSuite(UpdateableResultTest.class );
-
-               suite.addTestSuite(CallableStmtTest.class );
-               suite.addTestSuite(CursorFetchTest.class);
-
-               // That's all folks
-               return suite;
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java
deleted file mode 100644 (file)
index c6b2e04..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-import java.io.*;
-
-/*
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java,v 1.12 2003/12/11 15:11:43 davec Exp $
- *
- * Some simple tests based on problems reported by users. Hopefully these will
- * help prevent previous problems from re-occuring ;-)
- *
- */
-public class MiscTest extends TestCase
-{
-
-       public MiscTest(String name)
-       {
-               super(name);
-       }
-
-       /*
-        * Some versions of the driver would return rs as a null?
-        *
-        * Sasha <ber0806@iperbole.bologna.it> was having this problem.
-        *
-        * Added Feb 13 2001
-        */
-       public void testDatabaseSelectNullBug()
-       {
-               try
-               {
-                       Connection con = TestUtil.openDB();
-
-                       Statement st = con.createStatement();
-                       ResultSet rs = st.executeQuery("select datname from pg_database");
-                       assertNotNull(rs);
-
-                       while (rs.next())
-                       {
-                               rs.getString(1);
-                       }
-
-                       rs.close();
-                       st.close();
-
-                       TestUtil.closeDB(con);
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       public void testError()
-       {
-               Connection con = TestUtil.openDB();
-               try
-               {
-
-                       // transaction mode
-                       con.setAutoCommit(false);
-                       Statement stmt = con.createStatement();
-                       stmt.execute("select 1/0");
-                       fail( "Should not execute this, as a SQLException s/b thrown" );
-                       con.commit();
-               }
-               catch ( SQLException ex )
-               {
-                       // Verify that the SQLException is serializable.
-                       try {
-                               ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                               ObjectOutputStream oos = new ObjectOutputStream(baos);
-                               oos.writeObject(ex);
-                               oos.close();
-                       } catch (IOException ioe) {
-                               fail(ioe.getMessage());
-                       }
-               }
-               try
-               {
-                       con.commit();
-                       con.close();
-               }
-               catch ( Exception ex)
-               {}
-       }
-
-       public void xtestLocking()
-       {
-
-               try
-               {
-                       Connection con = TestUtil.openDB();
-                       Connection con2 = TestUtil.openDB();
-
-                       TestUtil.createTable(con, "test_lock", "name text");
-                       Statement st = con.createStatement();
-                       Statement st2 = con2.createStatement();
-                       con.setAutoCommit(false);
-                       st.execute("lock table test_lock");
-                       st2.executeUpdate( "insert into test_lock ( name ) values ('hello')" );
-                       con.commit();
-                       TestUtil.dropTable(con, "test_lock");
-                       con.close();
-               }
-               catch ( Exception ex )
-               {
-                       fail( ex.getMessage() );
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/OID74Test.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/OID74Test.java
deleted file mode 100644 (file)
index eb83cd7..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.postgresql.test.jdbc2;
-                                                                                                                                                                                     
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.io.*;
-import java.sql.*;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Properties;
-import java.sql.*;
-
-/**
- * User: alexei
- * Date: 17-Dec-2003
- * Time: 11:01:44
- * @version $Id: OID74Test.java,v 1.3 2003/12/18 04:08:30 davec Exp $
- */
-public class OID74Test  extends TestCase
-{
-
-       public OID74Test( String name )
-       {
-               super(name);
-       }
-       public void setUp() throws Exception
-       {
-       }
-       public void tearDown() throws Exception
-       {
-       }
-       public void testBinaryStream() throws SQLException
-       {
-               //set up conection here
-               Properties props = new Properties();
-               props.setProperty("compatible","7.1");
-               Connection c = TestUtil.openDB(props);
-               c.setAutoCommit(false);
-
-               TestUtil.createTable(c,"temp","col oid");
-               
-               Statement st = null; 
-               
-               PreparedStatement pstmt = null;
-               try 
-               {
-               
-                       pstmt = c.prepareStatement("INSERT INTO temp VALUES (?)");
-                       pstmt.setBinaryStream(1, new ByteArrayInputStream(new byte[]{1, 2, 3, 4, 5}), 5);
-                       assertTrue( (pstmt.executeUpdate() == 1) );
-                       pstmt.close();
-               
-                       pstmt = c.prepareStatement("SELECT col FROM temp LIMIT 1");
-                       ResultSet rs = pstmt.executeQuery();
-
-                       assertTrue("No results from query", rs.next() );
-
-                       InputStream in = rs.getBinaryStream(1);
-                       int data;
-                       int i = 1;
-                       while ((data = in.read()) != -1)
-                               assertEquals(data,i++);
-                       rs.close();
-                       pstmt.close();
-                       c.createStatement().executeUpdate("DELETE FROM temp");
-                       c.commit();
-               }
-               catch ( IOException ioex )
-               {
-                       fail( ioex.getMessage() );
-               }
-               catch (SQLException ex)
-               {
-                       fail( ex.getMessage() );
-               }
-
-               TestUtil.dropTable(c,"temp");
-               TestUtil.closeDB(c);
-       }       
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/RefCursorTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/RefCursorTest.java
deleted file mode 100644 (file)
index 556bb40..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.sql.Types;
-
-import junit.framework.TestCase;
-
-/*
- * RefCursor ResultSet tests.
- * This test case is basically the same as the ResultSet test case.
- *
- * @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
- */
-public class RefCursorTest extends TestCase
-{
-       private Connection con;
-
-       public RefCursorTest(String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-                // this is the same as the ResultSet setup.
-               con = TestUtil.openDB();
-               Statement stmt = con.createStatement();
-
-               TestUtil.createTable(con, "testrs", "id integer");
-
-               stmt.executeUpdate("INSERT INTO testrs VALUES (1)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (2)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (3)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (4)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (6)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (9)");
-
-
-                // Create the functions.
-                stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getRefcursor () RETURNS refcursor AS '"
-                              + "declare v_resset; begin open v_resset for select id from testrs order by id; "
-                              + "return v_resset; end;' LANGUAGE 'plpgsql';");
-                stmt.execute ("CREATE OR REPLACE FUNCTION testspg__getEmptyRefcursor () RETURNS refcursor AS '"
-                              + "declare v_resset; begin open v_resset for select id from testrs where id < 1 order by id; "
-                              + "return v_resset; end;' LANGUAGE 'plpgsql';");
-                stmt.close();
-       }
-
-       protected void tearDown() throws Exception
-       {
-                Statement stmt = con.createStatement ();
-               stmt.execute ("drop FUNCTION testspg__getRefcursor ();");
-               stmt.execute ("drop FUNCTION testspg__getEmptyRefcursor ();");
-               TestUtil.dropTable(con, "testrs");
-               TestUtil.closeDB(con);
-       }
-
-       public void testResult() throws Exception
-       {
-               CallableStatement call = con.prepareCall("{ ? = call testspg__getRefcursor () }");
-               call.registerOutParameter(1, Types.OTHER);
-               call.execute();
-                ResultSet rs = (ResultSet) call.getObject(1);
-
-                assertTrue(rs.next());
-                assertTrue(rs.getInt(1) == 1);
-
-                assertTrue(rs.next());
-                assertTrue(rs.getInt(1) == 2);
-
-                assertTrue(rs.next());
-                assertTrue(rs.getInt(1) == 3);
-
-                assertTrue(rs.next());
-                assertTrue(rs.getInt(1) == 4);
-
-                assertTrue(rs.next());
-                assertTrue(rs.getInt(1) == 6);
-
-                assertTrue(rs.next());
-                assertTrue(rs.getInt(1) == 9);
-
-                assertTrue(!rs.next());
-                
-               call.close();
-       }
-
-
-        public void testEmptyResult() throws Exception
-       {
-                CallableStatement call = con.prepareCall("{ ? = call testspg__getRefcursor () }");
-                call.registerOutParameter(1, Types.OTHER);
-                call.execute();
-
-                ResultSet rs = (ResultSet) call.getObject(1);
-                assertTrue(!rs.next());
-
-                call.close();
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/ResultSetTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/ResultSetTest.java
deleted file mode 100644 (file)
index c09ac49..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import junit.framework.TestCase;
-
-/*
- * ResultSet tests.
- */
-public class ResultSetTest extends TestCase
-{
-       private Connection con;
-
-       public ResultSetTest(String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               Statement stmt = con.createStatement();
-
-               TestUtil.createTable(con, "testrs", "id integer");
-
-               stmt.executeUpdate("INSERT INTO testrs VALUES (1)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (2)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (3)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (4)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (6)");
-               stmt.executeUpdate("INSERT INTO testrs VALUES (9)");
-               
-               TestUtil.createTable(con, "teststring", "a text");
-               stmt.executeUpdate("INSERT INTO teststring VALUES ('12345')");
-               
-               TestUtil.createTable(con, "testint", "a int");
-               stmt.executeUpdate("INSERT INTO testint VALUES (12345)");
-               
-                TestUtil.createTable(con, "testbool", "a boolean");
-                                                                                 
-                TestUtil.createTable(con, "testbit", "a bit");
-                                                                                 
-                TestUtil.createTable(con, "testboolstring", "a varchar(30)");
-                                                                                 
-                stmt.executeUpdate("INSERT INTO testboolstring VALUES('true')");
-                stmt.executeUpdate("INSERT INTO testboolstring VALUES('false')");
-                stmt.executeUpdate("INSERT INTO testboolstring VALUES('t')");
-                stmt.executeUpdate("INSERT INTO testboolstring VALUES('f')");
-                stmt.executeUpdate("INSERT INTO testboolstring VALUES('1.0')");
-                stmt.executeUpdate("INSERT INTO testboolstring VALUES('0.0')");
-                stmt.executeUpdate("INSERT INTO testboolstring VALUES('TRUE')");
-                stmt.executeUpdate("INSERT INTO testboolstring VALUES('this is not true')");
-               
-               TestUtil.createTable(con, "testnumeric", "a numeric");
-               stmt.executeUpdate("INSERT INTO testnumeric VALUES('1.0')");
-               stmt.executeUpdate("INSERT INTO testnumeric VALUES('0.0')");
-               stmt.executeUpdate("INSERT INTO testnumeric VALUES('-1.0')");           
-               stmt.executeUpdate("INSERT INTO testnumeric VALUES('1.2')");
-               stmt.executeUpdate("INSERT INTO testnumeric VALUES('99999.2')");
-               stmt.executeUpdate("INSERT INTO testnumeric VALUES('99999')");
-               stmt.executeUpdate("INSERT INTO testnumeric VALUES('-2.5')");
-               stmt.executeUpdate("INSERT INTO testnumeric VALUES('-99999.2')");
-               stmt.executeUpdate("INSERT INTO testnumeric VALUES('-99999')");
-                 
-                stmt.close();
-
-
-               stmt.close();
-       }
-
-       protected void tearDown() throws Exception
-       {
-               TestUtil.dropTable(con, "testrs");
-               TestUtil.dropTable(con, "teststring");
-               TestUtil.dropTable(con, "testint");
-               TestUtil.dropTable(con, "testbool");
-               TestUtil.dropTable(con, "testbit");
-               TestUtil.dropTable(con, "testboolstring");
-               TestUtil.dropTable(con, "testnumeric");
-               TestUtil.closeDB(con);
-       }
-
-       public void testBackward() throws Exception
-       {
-               Statement stmt = con.createStatement();
-               ResultSet rs = stmt.executeQuery("SELECT * FROM testrs");
-               rs.afterLast();
-               assertTrue(rs.previous());
-               rs.close();
-               stmt.close();
-       }
-
-       public void testAbsolute() throws Exception
-       {
-               Statement stmt = con.createStatement();
-               ResultSet rs = stmt.executeQuery("SELECT * FROM testrs");
-
-               assertTrue(rs.absolute( -1));
-               assertEquals(6, rs.getRow());
-
-               assertTrue(rs.absolute(1));
-               assertEquals(1, rs.getRow());
-
-               assertTrue(!rs.absolute( -10));
-               assertEquals(0, rs.getRow());
-               assertTrue(rs.next());
-               assertEquals(1, rs.getRow());
-
-               assertTrue(!rs.absolute(10));
-               assertEquals(0, rs.getRow());
-               assertTrue(rs.previous());
-               assertEquals(6, rs.getRow());
-
-               stmt.close();
-       }
-       public void testEmptyResult()
-       {
-               try
-               {
-                       Statement stmt = con.createStatement();
-                       ResultSet rs = stmt.executeQuery("SELECT * FROM testrs where id=100");
-                       rs.beforeFirst();
-                       rs.afterLast();
-                       assertTrue(!rs.first());
-                       assertTrue(!rs.last());
-                       assertTrue(!rs.next());
-
-
-               }
-               catch ( Exception ex )
-               {
-                       fail( ex.getMessage() );
-               }
-
-       }
-       
-       public void testMaxFieldSize() throws Exception
-       {
-                       Statement stmt = con.createStatement();
-                       stmt.setMaxFieldSize(2);
-
-                       ResultSet rs = stmt.executeQuery("select * from testint");
-                       
-                       //max should not apply to the following since per the spec
-                       //it should apply only to binary and char/varchar columns
-                       rs.next();
-                       assertEquals(rs.getString(1),"12345");
-                       assertEquals(new String(rs.getBytes(1)), "12345");
-                       
-                       //max should apply to the following since the column is 
-                       //a varchar column
-                       rs = stmt.executeQuery("select * from teststring");
-                       rs.next();
-                       assertEquals(rs.getString(1), "12");
-                       assertEquals(new String(rs.getBytes(1)), "12");
-       }
-
-       public void booleanTests(boolean useServerPrepare) throws Exception
-        {
-                java.sql.PreparedStatement pstmt = con.prepareStatement("insert into testbool values (?)");
-                if (useServerPrepare)
-                       ((org.postgresql.PGStatement)pstmt).setUseServerPrepare(true);
-                                                                                 
-               pstmt.setObject(1, new Float(0), java.sql.Types.BIT);
-                pstmt.executeUpdate();
-                                                                                  
-                pstmt.setObject(1, new Float(1), java.sql.Types.BIT);
-                pstmt.executeUpdate();
-                                                                                 
-                pstmt.setObject(1, "False", java.sql.Types.BIT);
-                pstmt.executeUpdate();
-                                                                                 
-                pstmt.setObject(1, "True", java.sql.Types.BIT);
-                pstmt.executeUpdate();
-                                                                                 
-                ResultSet rs = con.createStatement().executeQuery("select * from testbool");
-               for (int i = 0; i<2; i++)
-                {
-                       assertTrue(rs.next());
-                        assertEquals(false, rs.getBoolean(1));
-                        assertTrue(rs.next());
-                        assertEquals(true, rs.getBoolean(1));
-                }
-                                                                                 
-                pstmt = con.prepareStatement("insert into testbit values (?)");
-                                                                                 
-                pstmt.setObject(1, new Float(0), java.sql.Types.BIT);
-                pstmt.executeUpdate();
-                                                                                 
-                pstmt.setObject(1, new Float(1), java.sql.Types.BIT);
-                pstmt.executeUpdate();
-                                                                                 
-                pstmt.setObject(1, "false", java.sql.Types.BIT);
-                pstmt.executeUpdate();
-                                                                                 
-                pstmt.setObject(1, "true", java.sql.Types.BIT);
-                pstmt.executeUpdate();
-               
-               rs = con.createStatement().executeQuery("select * from testbit");
-               
-                for (int i = 0;i<2; i++)
-                {
-                       assertTrue(rs.next());
-                       assertEquals(false, rs.getBoolean(1));
-                        assertTrue(rs.next());
-                        assertEquals(true, rs.getBoolean(1));
-                }
-                                                                                
-                rs = con.createStatement().executeQuery("select * from testboolstring");
-                                                                         
-                for (int i = 0;i<4; i++)
-                {
-                        assertTrue(rs.next());
-                        assertEquals(true, rs.getBoolean(1));
-                        assertTrue(rs.next());
-                        assertEquals(false, rs.getBoolean(1));
-               }
-       }
-
-       public void testBoolean() throws Exception
-       {
-               booleanTests(true);
-               booleanTests(false);
-       }
-       
-       public void testgetByte() throws Exception
-       {
-                       ResultSet rs = con.createStatement().executeQuery("select * from testnumeric");
-               boolean thrown = false;
-               
-               assertTrue(rs.next());
-               assertEquals(1,rs.getByte(1));
-               
-               assertTrue(rs.next());
-               assertEquals(0,rs.getByte(1));
-               
-               assertTrue(rs.next());
-               assertEquals(-1,rs.getByte(1));
-               
-               while (rs.next())
-               {
-                       thrown = false;
-                       try
-                       {
-                               rs.getByte(1);
-                       }
-                       catch (Exception e)
-                       {
-                               thrown = true;
-                       }
-                       if (!thrown)
-                               fail("Exception expected.");
-               }
-       }
-               
-       public void testgetShort() throws Exception
-       {
-                       ResultSet rs = con.createStatement().executeQuery("select * from testnumeric");
-               boolean thrown = false;
-               
-               assertTrue(rs.next());
-               assertEquals(1,rs.getShort(1));
-               
-               assertTrue(rs.next());
-               assertEquals(0,rs.getShort(1));
-               
-               assertTrue(rs.next());
-               assertEquals(-1,rs.getShort(1));
-               
-               while (rs.next())
-               {
-                       thrown = false;
-                       try
-                       {
-                               rs.getShort(1);
-                       }
-                       catch (Exception e)
-                       {
-                               thrown = true;
-                       }
-                       if (!thrown)
-                               fail("Exception expected.");
-               }
-       }
-       
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java
deleted file mode 100644 (file)
index aeb356f..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.PGStatement;
-import org.postgresql.test.TestUtil;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import junit.framework.TestCase;
-
-/*
- *  Tests for using server side prepared statements
- */
-public class ServerPreparedStmtTest extends TestCase
-{
-       private Connection con;
-
-       public ServerPreparedStmtTest(String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               Statement stmt = con.createStatement();
-
-               TestUtil.createTable(con, "testsps", "id integer, value boolean");
-
-               stmt.executeUpdate("INSERT INTO testsps VALUES (1,'t')");
-               stmt.executeUpdate("INSERT INTO testsps VALUES (2,'t')");
-               stmt.executeUpdate("INSERT INTO testsps VALUES (3,'t')");
-               stmt.executeUpdate("INSERT INTO testsps VALUES (4,'t')");
-               stmt.executeUpdate("INSERT INTO testsps VALUES (6,'t')");
-               stmt.executeUpdate("INSERT INTO testsps VALUES (9,'f')");
-
-               stmt.close();
-       }
-
-       protected void tearDown() throws Exception
-       {
-               TestUtil.dropTable(con, "testsps");
-               TestUtil.closeDB(con);
-       }
-
-       public void testPreparedStatementsNoBinds() throws Exception
-       {
-               PreparedStatement pstmt = con.prepareStatement("SELECT * FROM testsps WHERE id = 2");
-        ((PGStatement)pstmt).setUseServerPrepare(true);
-        if (TestUtil.haveMinimumServerVersion(con,"7.3")) {
-                       assertTrue(((PGStatement)pstmt).isUseServerPrepare());
-               } else {
-                       assertTrue(!((PGStatement)pstmt).isUseServerPrepare());
-               }
-
-        //Test that basic functionality works
-               ResultSet rs = pstmt.executeQuery();
-               assertTrue(rs.next());
-        assertEquals(2, rs.getInt(1));
-        rs.close();
-
-        //Verify that subsequent calls still work
-               rs = pstmt.executeQuery();
-               assertTrue(rs.next());
-        assertEquals(2, rs.getInt(1));
-        rs.close();
-
-        //Verify that using the statement to execute a different query works
-               rs = pstmt.executeQuery("SELECT * FROM testsps WHERE id = 9");
-               assertTrue(rs.next());
-        assertEquals(9, rs.getInt(1));
-        rs.close();
-
-        ((PGStatement)pstmt).setUseServerPrepare(false);
-        assertTrue(!((PGStatement)pstmt).isUseServerPrepare());
-
-        //Verify that using the statement still works after turning off prepares
-               rs = pstmt.executeQuery("SELECT * FROM testsps WHERE id = 9");
-               assertTrue(rs.next());
-        assertEquals(9, rs.getInt(1));
-        rs.close();
-
-               pstmt.close();
-       }
-
-       public void testPreparedStatementsWithOneBind() throws Exception
-       {
-               PreparedStatement pstmt = con.prepareStatement("SELECT * FROM testsps WHERE id = ?");
-        ((PGStatement)pstmt).setUseServerPrepare(true);
-        if (TestUtil.haveMinimumServerVersion(con,"7.3")) {
-                       assertTrue(((PGStatement)pstmt).isUseServerPrepare());
-               } else {
-                       assertTrue(!((PGStatement)pstmt).isUseServerPrepare());
-               }
-
-        //Test that basic functionality works
-        pstmt.setInt(1,2);
-               ResultSet rs = pstmt.executeQuery();
-               assertTrue(rs.next());
-        assertEquals(2, rs.getInt(1));
-        rs.close();
-
-        //Verify that subsequent calls still work
-               rs = pstmt.executeQuery();
-               assertTrue(rs.next());
-        assertEquals(2, rs.getInt(1));
-        rs.close();
-
-        //Verify that using the statement to execute a different query works
-               rs = pstmt.executeQuery("SELECT * FROM testsps WHERE id = 9");
-               assertTrue(rs.next());
-        assertEquals(9, rs.getInt(1));
-        rs.close();
-
-        ((PGStatement)pstmt).setUseServerPrepare(false);
-        assertTrue(!((PGStatement)pstmt).isUseServerPrepare());
-
-        //Verify that using the statement still works after turning off prepares
-               rs = pstmt.executeQuery("SELECT * FROM testsps WHERE id = 9");
-               assertTrue(rs.next());
-        assertEquals(9, rs.getInt(1));
-        rs.close();
-
-               pstmt.close();
-       }
-
-       // Verify we can bind booleans-as-objects ok.
-       public void testBooleanObjectBind() throws Exception
-       {
-               PreparedStatement pstmt = con.prepareStatement("SELECT * FROM testsps WHERE value = ?");
-        ((PGStatement)pstmt).setUseServerPrepare(true);
-        if (TestUtil.haveMinimumServerVersion(con,"7.3")) {
-                       assertTrue(((PGStatement)pstmt).isUseServerPrepare());
-               } else {
-                       assertTrue(!((PGStatement)pstmt).isUseServerPrepare());
-               }
-
-        pstmt.setObject(1, new Boolean(false), java.sql.Types.BIT);
-               ResultSet rs = pstmt.executeQuery();
-               assertTrue(rs.next());
-        assertEquals(9, rs.getInt(1));
-        rs.close();
-       }
-
-       // Verify we can bind booleans-as-integers ok.
-       public void testBooleanIntegerBind() throws Exception
-       {
-               PreparedStatement pstmt = con.prepareStatement("SELECT * FROM testsps WHERE id = ?");
-        ((PGStatement)pstmt).setUseServerPrepare(true);
-        if (TestUtil.haveMinimumServerVersion(con,"7.3")) {
-                       assertTrue(((PGStatement)pstmt).isUseServerPrepare());
-               } else {
-                       assertTrue(!((PGStatement)pstmt).isUseServerPrepare());
-               }
-
-        pstmt.setObject(1, new Boolean(true), java.sql.Types.INTEGER);
-               ResultSet rs = pstmt.executeQuery();
-               assertTrue(rs.next());
-        assertEquals(1, rs.getInt(1));
-        rs.close();
-       }
-
-       // Verify we can bind booleans-as-native-types ok.
-       public void testBooleanBind() throws Exception
-       {
-               PreparedStatement pstmt = con.prepareStatement("SELECT * FROM testsps WHERE value = ?");
-        ((PGStatement)pstmt).setUseServerPrepare(true);
-        if (TestUtil.haveMinimumServerVersion(con,"7.3")) {
-                       assertTrue(((PGStatement)pstmt).isUseServerPrepare());
-               } else {
-                       assertTrue(!((PGStatement)pstmt).isUseServerPrepare());
-               }
-
-        pstmt.setBoolean(1, false);
-               ResultSet rs = pstmt.executeQuery();
-               assertTrue(rs.next());
-        assertEquals(9, rs.getInt(1));
-        rs.close();
-       }
-
-       public void testPreparedStatementsWithBinds() throws Exception
-       {
-               PreparedStatement pstmt = con.prepareStatement("SELECT * FROM testsps WHERE id = ? or id = ?");
-        ((PGStatement)pstmt).setUseServerPrepare(true);
-        if (TestUtil.haveMinimumServerVersion(con,"7.3")) {
-                       assertTrue(((PGStatement)pstmt).isUseServerPrepare());
-               } else {
-                       assertTrue(!((PGStatement)pstmt).isUseServerPrepare());
-               }
-
-        //Test that basic functionality works
-        //bind different datatypes
-        pstmt.setInt(1,2);
-        pstmt.setString(2,"2");
-               ResultSet rs = pstmt.executeQuery();
-               assertTrue(rs.next());
-        assertEquals(2, rs.getInt(1));
-        rs.close();
-
-        //Verify that subsequent calls still work
-               rs = pstmt.executeQuery();
-               assertTrue(rs.next());
-        assertEquals(2, rs.getInt(1));
-        rs.close();
-
-               pstmt.close();
-       }
-
-       public void testSPSToggle() throws Exception
-       {
-               // Verify we can toggle UseServerPrepare safely before a query is executed.
-               PreparedStatement pstmt = con.prepareStatement("SELECT * FROM testsps WHERE id = 2");
-        ((PGStatement)pstmt).setUseServerPrepare(true);
-        ((PGStatement)pstmt).setUseServerPrepare(false);
-       }
-
-       public void testBytea() throws Exception
-       {
-               // Verify we can use setBytes() with a server-prepared update.
-               try {
-                       TestUtil.createTable(con, "testsps_bytea", "data bytea");
-                       
-                       PreparedStatement pstmt = con.prepareStatement("INSERT INTO testsps_bytea(data) VALUES (?)");
-                       ((PGStatement)pstmt).setUseServerPrepare(true);
-                       pstmt.setBytes(1, new byte[100]);
-                       pstmt.executeUpdate();
-               } finally {
-                       TestUtil.dropTable(con, "testsps_bytea");
-               }
-       }
-
-       // Check statements are not transformed when they shouldn't be.
-       public void TODO_FAILS_testCreateTable() throws Exception {
-               // CREATE TABLE isn't supported by PREPARE; the driver should realize this and
-               // still complete without error.
-               PreparedStatement pstmt = con.prepareStatement("CREATE TABLE testsps_bad(data int)");
-               ((PGStatement)pstmt).setUseServerPrepare(true);
-               pstmt.executeUpdate();
-               TestUtil.dropTable(con, "testsps_bad");
-       }
-
-       public void TODO_FAILS_testMultistatement() throws Exception {
-               // Shouldn't try to PREPARE this one, if we do we get:
-               //   PREPARE x(int,int) AS INSERT .... $1 ; INSERT ... $2    -- syntax error
-               try {
-                       TestUtil.createTable(con, "testsps_multiple", "data int");
-                       PreparedStatement pstmt = con.prepareStatement("INSERT INTO testsps_multiple(data) VALUES (?); INSERT INTO testsps_multiple(data) VALUES (?)");
-                       ((PGStatement)pstmt).setUseServerPrepare(true);                 
-                       pstmt.setInt(1, 1);
-                       pstmt.setInt(2, 2);
-                       pstmt.executeUpdate(); // Two inserts.
-
-                       pstmt.setInt(1, 3);
-                       pstmt.setInt(2, 4);
-                       pstmt.executeUpdate(); // Two more inserts.
-                       
-                       ResultSet check = con.createStatement().executeQuery("SELECT COUNT(*) FROM testsps_multiple");
-                       assertTrue(check.next());
-                       assertEquals(4, check.getInt(1));
-               } finally {
-                       TestUtil.dropTable(con, "testsps_multiple");
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/TimeTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/TimeTest.java
deleted file mode 100644 (file)
index 0c0f733..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-
-/*
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/TimeTest.java,v 1.7 2003/11/29 22:41:23 pgsql Exp $
- *
- * Some simple tests based on problems reported by users. Hopefully these will
- * help prevent previous problems from re-occuring ;-)
- *
- */
-public class TimeTest extends TestCase
-{
-
-       private Connection con;
-       private boolean testSetTime = false;
-
-       public TimeTest(String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               TestUtil.createTable(con, "testtime", "tm time");
-       }
-
-       protected void tearDown() throws Exception
-       {
-               TestUtil.dropTable(con, "testtime");
-               TestUtil.closeDB(con);
-       }
-
-       /*
-        * Tests the time methods in ResultSet
-        */
-       public void testGetTime()
-       {
-               try
-               {
-                       Statement stmt = con.createStatement();
-
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'01:02:03'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'23:59:59'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'12:00:00'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'05:15:21'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'16:21:51'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'12:15:12'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'22:12:01'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'08:46:44'")));
-                       
-
-                       // Fall through helper
-                       timeTest();
-
-                       assertEquals(8, stmt.executeUpdate("DELETE FROM testtime"));
-                       stmt.close();
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Tests the time methods in PreparedStatement
-        */
-       public void testSetTime()
-       {
-               try
-               {
-                       PreparedStatement ps = con.prepareStatement(TestUtil.insertSQL("testtime", "?"));
-                       Statement stmt = con.createStatement();
-
-                       ps.setTime(1, makeTime(1, 2, 3));
-                       assertEquals(1, ps.executeUpdate());
-
-                       ps.setTime(1, makeTime(23, 59, 59));
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Time.valueOf("12:00:00"), java.sql.Types.TIME);
-                       assertEquals(1, ps.executeUpdate());
-                       
-                       ps.setObject(1, java.sql.Time.valueOf("05:15:21"), java.sql.Types.TIME);
-                       assertEquals(1, ps.executeUpdate());                    
-
-                       ps.setObject(1, java.sql.Time.valueOf("16:21:51"), java.sql.Types.TIME);
-                       assertEquals(1, ps.executeUpdate());
-
-                       ps.setObject(1, java.sql.Time.valueOf("12:15:12"), java.sql.Types.TIME);
-                       assertEquals(1, ps.executeUpdate());
-
-                       ps.setObject(1, "22:12:1", java.sql.Types.TIME);
-                       assertEquals(1, ps.executeUpdate());
-
-                       ps.setObject(1, "8:46:44", java.sql.Types.TIME);                        
-                       assertEquals(1, ps.executeUpdate());                    
-
-                       ps.setObject(1, "5:1:2-03", java.sql.Types.TIME);
-                       assertEquals(1, ps.executeUpdate());
-
-                       ps.setObject(1, "23:59:59+11", java.sql.Types.TIME);
-                       assertEquals(1, ps.executeUpdate());                    
-
-                       // Need to let the test know this one has extra test cases.
-                       testSetTime = true;
-                       // Fall through helper
-                       timeTest();
-                       testSetTime = false;
-
-                       assertEquals(10, stmt.executeUpdate("DELETE FROM testtime"));
-                       stmt.close();
-                       ps.close();
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Helper for the TimeTests. It tests what should be in the db
-        */
-       private void timeTest() throws SQLException
-       {
-               Statement st = con.createStatement();
-               ResultSet rs;
-               java.sql.Time t;
-
-               rs = st.executeQuery(TestUtil.selectSQL("testtime", "tm"));
-               assertNotNull(rs);
-
-               assertTrue(rs.next());
-               t = rs.getTime(1);
-               assertNotNull(t);
-               assertEquals(makeTime(1, 2, 3), t);
-
-               assertTrue(rs.next());
-               t = rs.getTime(1);
-               assertNotNull(t);
-               assertEquals(makeTime(23, 59, 59), t);
-
-               assertTrue(rs.next());
-               t = rs.getTime(1);
-               assertNotNull(t);
-               assertEquals(makeTime(12, 0, 0), t);
-
-               assertTrue(rs.next());
-               t = rs.getTime(1);
-               assertNotNull(t);
-               assertEquals(makeTime(5, 15, 21), t);
-
-               assertTrue(rs.next());
-               t = rs.getTime(1);
-               assertNotNull(t);
-               assertEquals(makeTime(16, 21, 51), t);
-
-               assertTrue(rs.next());
-               t = rs.getTime(1);
-               assertNotNull(t);
-               assertEquals(makeTime(12, 15, 12), t);
-
-               assertTrue(rs.next());
-               t = rs.getTime(1);
-               assertNotNull(t);
-               assertEquals(makeTime(22, 12, 1), t);
-
-               assertTrue(rs.next());
-               t = rs.getTime(1);
-               assertNotNull(t);
-               assertEquals(makeTime(8, 46, 44), t);
-               
-               // If we're checking for timezones.
-               if (testSetTime)
-               {
-                       assertTrue(rs.next());
-                       t = rs.getTime(1);
-                       assertNotNull(t);
-                       java.sql.Time tmpTime = java.sql.Time.valueOf("5:1:2");
-                       int localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
-                       if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(tmpTime))
-                       {
-                               localoffset += 60 * 60 * 1000;
-                       }
-                       int Timeoffset = 3 * 60 * 60 * 1000;
-                       tmpTime.setTime(tmpTime.getTime() + Timeoffset + localoffset);
-                       assertEquals(t, makeTime(tmpTime.getHours(), tmpTime.getMinutes(), tmpTime.getSeconds()));
-                       
-                       assertTrue(rs.next());
-                       t = rs.getTime(1);
-                       assertNotNull(t);
-                       tmpTime= java.sql.Time.valueOf("23:59:59");
-                       localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
-                       if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(tmpTime))
-                       {
-                               localoffset += 60 * 60 * 1000;
-                       }                       
-                       Timeoffset = -11 * 60 * 60 * 1000;
-                       tmpTime.setTime(tmpTime.getTime() + Timeoffset + localoffset);
-                       assertEquals(t, makeTime(tmpTime.getHours(), tmpTime.getMinutes(), tmpTime.getSeconds()));
-               }
-                                               
-               assertTrue(! rs.next());
-
-               rs.close();
-       }
-
-       private java.sql.Time makeTime(int h, int m, int s)
-       {
-               return java.sql.Time.valueOf(TestUtil.fix(h, 2) + ":" +
-                                                                        TestUtil.fix(m, 2) + ":" +
-                                                                        TestUtil.fix(s, 2));
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/TimestampTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/TimestampTest.java
deleted file mode 100644 (file)
index 2affb1d..0000000
+++ /dev/null
@@ -1,538 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import junit.framework.TestCase;
-import java.sql.*;
-
-/*
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/TimestampTest.java,v 1.13 2003/11/29 22:41:23 pgsql Exp $
- *
- * Test get/setTimestamp for both timestamp with time zone and
- * timestamp without time zone datatypes
- *
- */
-public class TimestampTest extends TestCase
-{
-
-       private Connection con;
-
-       public TimestampTest(String name)
-       {
-               super(name);
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               TestUtil.createTable(con, TSWTZ_TABLE, "ts timestamp with time zone");
-               TestUtil.createTable(con, TSWOTZ_TABLE, "ts timestamp without time zone");
-       }
-
-       protected void tearDown() throws Exception
-       {
-               TestUtil.dropTable(con, TSWTZ_TABLE);
-               TestUtil.dropTable(con, TSWOTZ_TABLE);
-               TestUtil.closeDB(con);
-       }
-
-       /*
-        * Tests the timestamp methods in ResultSet on timestamp with time zone
-                       * we insert a known string value (don't use setTimestamp) then see that 
-                       * we get back the same value from getTimestamp
-        */
-       public void testGetTimestampWTZ()
-       {
-               try
-               {
-                       Statement stmt = con.createStatement();
-
-                       //Insert the three timestamp values in raw pg format
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS1WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS2WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS3WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS4WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS1WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS2WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS3WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS4WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS1WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS2WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS3WTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + TS4WTZ_PGFORMAT + "'")));                                                                                              
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + new java.sql.Timestamp(tmpDate1.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + new java.sql.Timestamp(tmpDate2.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + new java.sql.Timestamp(tmpDate3.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + new java.sql.Timestamp(tmpDate4.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + new java.sql.Timestamp(tmpTime1.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + new java.sql.Timestamp(tmpTime2.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + new java.sql.Timestamp(tmpTime3.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE, "'" + new java.sql.Timestamp(tmpTime4.getTime()) + "'")));
-                       
-
-                       // Fall through helper
-                       timestampTestWTZ();
-
-                       assertEquals(20, stmt.executeUpdate("DELETE FROM " + TSWTZ_TABLE));
-
-                       stmt.close();
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Tests the timestamp methods in PreparedStatement on timestamp with time zone
-                       * we insert a value using setTimestamp then see that
-                       * we get back the same value from getTimestamp (which we know works as it was tested
-                       * independently of setTimestamp
-        */
-       public void testSetTimestampWTZ()
-       {
-               try
-               {
-                       Statement stmt = con.createStatement();
-                       PreparedStatement pstmt = con.prepareStatement(TestUtil.insertSQL(TSWTZ_TABLE, "?"));
-
-                       pstmt.setTimestamp(1, TS1WTZ);
-                       assertEquals(1, pstmt.executeUpdate());
-
-                       pstmt.setTimestamp(1, TS2WTZ);
-                       assertEquals(1, pstmt.executeUpdate());
-
-                       pstmt.setTimestamp(1, TS3WTZ);
-                       assertEquals(1, pstmt.executeUpdate());
-
-                       pstmt.setTimestamp(1, TS4WTZ);
-                       assertEquals(1, pstmt.executeUpdate());
-                       
-                       // With java.sql.Timestamp
-                       pstmt.setObject(1,TS1WTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,TS2WTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,TS3WTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                 
-                       pstmt.setObject(1,TS4WTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       
-                       // With Strings
-                       pstmt.setObject(1,TS1WTZ_PGFORMAT, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,TS2WTZ_PGFORMAT, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,TS3WTZ_PGFORMAT, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                 
-                       pstmt.setObject(1,TS4WTZ_PGFORMAT, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-
-                       // With java.sql.Date
-                       pstmt.setObject(1,tmpDate1, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,tmpDate2, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,tmpDate3, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                 
-                       pstmt.setObject(1,tmpDate4, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-               
-                       // With java.sql.Time   
-                       pstmt.setObject(1,tmpTime1, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,tmpTime2, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,tmpTime3, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                 
-                       pstmt.setObject(1,tmpTime4, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                                                                                                                 
-                       
-                       // Fall through helper
-                       timestampTestWTZ();
-
-                       assertEquals(20, stmt.executeUpdate("DELETE FROM " + TSWTZ_TABLE));
-
-                       pstmt.close();
-                       stmt.close();
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Tests the timestamp methods in ResultSet on timestamp without time zone
-                       * we insert a known string value (don't use setTimestamp) then see that 
-                       * we get back the same value from getTimestamp
-        */
-       public void testGetTimestampWOTZ()
-       {
-               try
-               {
-                       Statement stmt = con.createStatement();
-
-                       //Insert the three timestamp values in raw pg format
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS1WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS2WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS3WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS4WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS1WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS2WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS3WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS4WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS1WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS2WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS3WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + TS4WOTZ_PGFORMAT + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + new java.sql.Timestamp(tmpDate1WOTZ.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + new java.sql.Timestamp(tmpDate2WOTZ.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + new java.sql.Timestamp(tmpDate3WOTZ.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + new java.sql.Timestamp(tmpDate4WOTZ.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + new java.sql.Timestamp(tmpTime1WOTZ.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + new java.sql.Timestamp(tmpTime2WOTZ.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + new java.sql.Timestamp(tmpTime3WOTZ.getTime()) + "'")));
-                       assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWOTZ_TABLE, "'" + new java.sql.Timestamp(tmpTime4WOTZ.getTime()) + "'")));                                                                                              
-
-                       // Fall through helper
-                       timestampTestWOTZ();
-
-                       assertEquals(20, stmt.executeUpdate("DELETE FROM " + TSWOTZ_TABLE));
-
-                       stmt.close();
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-
-       /*
-        * Tests the timestamp methods in PreparedStatement on timestamp without time zone
-                       * we insert a value using setTimestamp then see that
-                       * we get back the same value from getTimestamp (which we know works as it was tested
-                       * independently of setTimestamp
-        */
-       public void testSetTimestampWOTZ()
-       {
-               try
-               {
-                       Statement stmt = con.createStatement();
-                       PreparedStatement pstmt = con.prepareStatement(TestUtil.insertSQL(TSWOTZ_TABLE, "?"));
-
-                       pstmt.setTimestamp(1, TS1WOTZ);
-                       assertEquals(1, pstmt.executeUpdate());
-
-                       pstmt.setTimestamp(1, TS2WOTZ);
-                       assertEquals(1, pstmt.executeUpdate());
-
-                       pstmt.setTimestamp(1, TS3WOTZ);
-                       assertEquals(1, pstmt.executeUpdate());
-
-                       pstmt.setTimestamp(1, TS4WOTZ);
-                       assertEquals(1, pstmt.executeUpdate());
-
-
-                       // With java.sql.Timestamp
-                       pstmt.setObject(1,TS1WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,TS2WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,TS3WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                 
-                       pstmt.setObject(1,TS4WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       
-                       // With Strings
-                       pstmt.setObject(1,TS1WOTZ_PGFORMAT, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,TS2WOTZ_PGFORMAT, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,TS3WOTZ_PGFORMAT, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                 
-                       pstmt.setObject(1,TS4WOTZ_PGFORMAT, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-
-                       // With java.sql.Date
-                       pstmt.setObject(1,tmpDate1WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,tmpDate2WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,tmpDate3WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                 
-                       pstmt.setObject(1,tmpDate4WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-               
-                       // With java.sql.Time   
-                       pstmt.setObject(1,tmpTime1WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,tmpTime2WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());
-                       pstmt.setObject(1,tmpTime3WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                 
-                       pstmt.setObject(1,tmpTime4WOTZ, java.sql.Types.TIMESTAMP);
-                       assertEquals(1, pstmt.executeUpdate());                                                                                                                 
-
-                       // Fall through helper
-                       timestampTestWOTZ();
-
-                       assertEquals(20, stmt.executeUpdate("DELETE FROM " + TSWOTZ_TABLE));
-
-                       pstmt.close();
-                       stmt.close();
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-       }
-
-       /*
-        * Helper for the TimestampTests. It tests what should be in the db
-        */
-       private void timestampTestWTZ() throws SQLException
-       {
-               Statement stmt = con.createStatement();
-               ResultSet rs;
-               java.sql.Timestamp t;
-
-               rs = stmt.executeQuery("select ts from " + TSWTZ_TABLE); //removed the order by ts
-               assertNotNull(rs);
-
-               for (int i=0; i<3; i++)
-               {
-                       assertTrue(rs.next());
-                       t = rs.getTimestamp(1);
-                       assertNotNull(t);
-                       assertTrue(t.equals(TS1WTZ));
-       
-                       assertTrue(rs.next());
-                       t = rs.getTimestamp(1);
-                       assertNotNull(t);
-                       assertTrue(t.equals(TS2WTZ));
-       
-                       assertTrue(rs.next());
-                       t = rs.getTimestamp(1);
-                       assertNotNull(t);
-                       assertTrue(t.equals(TS3WTZ));
-       
-                       assertTrue(rs.next());
-                       t = rs.getTimestamp(1);
-                       assertNotNull(t);
-                       assertTrue(t.equals(TS4WTZ));
-               }
-               
-               // Testing for Date
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpDate1.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpDate2.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpDate3.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpDate4.getTime());
-               
-               // Testing for Time
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpTime1.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpTime2.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpTime3.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpTime4.getTime());          
-
-               assertTrue(! rs.next()); // end of table. Fail if more entries exist.
-
-               rs.close();
-               stmt.close();
-       }
-
-       /*
-        * Helper for the TimestampTests. It tests what should be in the db
-        */
-       private void timestampTestWOTZ() throws SQLException
-       {
-               Statement stmt = con.createStatement();
-               ResultSet rs;
-               java.sql.Timestamp t;
-
-               rs = stmt.executeQuery("select ts from " + TSWOTZ_TABLE); //removed the order by ts
-               assertNotNull(rs);
-
-               for (int i=0; i<3; i++)
-               {
-                       assertTrue(rs.next());
-                       t = rs.getTimestamp(1);
-                       assertNotNull(t);
-                       assertTrue(t.equals(TS1WOTZ));
-       
-                       assertTrue(rs.next());
-                       t = rs.getTimestamp(1);
-                       assertNotNull(t);
-                       assertTrue(t.equals(TS2WOTZ));
-       
-                       assertTrue(rs.next());
-                       t = rs.getTimestamp(1);
-                       assertNotNull(t);
-                       assertTrue(t.equals(TS3WOTZ));
-       
-                       assertTrue(rs.next());
-                       t = rs.getTimestamp(1);
-                       assertNotNull(t);
-                       assertTrue(t.equals(TS4WOTZ));
-               }
-               
-               // Testing for Date
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpDate1WOTZ.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpDate2WOTZ.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpDate3WOTZ.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpDate4WOTZ.getTime());
-               
-               // Testing for Time
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpTime1WOTZ.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpTime2WOTZ.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpTime3WOTZ.getTime());
-
-               assertTrue(rs.next());
-               t = rs.getTimestamp(1);
-               assertNotNull(t);
-               assertEquals(t.getTime(), tmpTime4WOTZ.getTime());              
-               
-               assertTrue(! rs.next()); // end of table. Fail if more entries exist.
-
-               rs.close();
-               stmt.close();
-       }
-
-       private static java.sql.Timestamp getTimestamp(int y, int m, int d, int h, int mn, int se, int f, String tz)
-       {
-               java.sql.Timestamp l_return = null;
-               java.text.DateFormat l_df;
-               try
-               {
-                       String l_ts;
-                       l_ts = TestUtil.fix(y, 4) + "-" +
-                                  TestUtil.fix(m, 2) + "-" +
-                                  TestUtil.fix(d, 2) + " " +
-                                  TestUtil.fix(h, 2) + ":" +
-                                  TestUtil.fix(mn, 2) + ":" +
-                                  TestUtil.fix(se, 2) + " ";
-
-                       if (tz == null)
-                       {
-                               l_df = new java.text.SimpleDateFormat("y-M-d H:m:s");
-                       }
-                       else
-                       {
-                               l_ts = l_ts + tz;
-                               l_df = new java.text.SimpleDateFormat("y-M-d H:m:s z");
-                       }
-                       java.util.Date l_date = l_df.parse(l_ts);
-                       l_return = new java.sql.Timestamp(l_date.getTime());
-                       l_return.setNanos(f);
-               }
-               catch (Exception ex)
-               {
-                       fail(ex.getMessage());
-               }
-               return l_return;
-       }
-
-       private static final java.sql.Timestamp TS1WTZ = getTimestamp(1950, 2, 7, 15, 0, 0, 100000000, "PST");
-       private static final String TS1WTZ_PGFORMAT = "1950-02-07 15:00:00.1-08";
-
-       private static final java.sql.Timestamp TS2WTZ = getTimestamp(2000, 2, 7, 15, 0, 0, 120000000, "GMT");
-       private static final String TS2WTZ_PGFORMAT = "2000-02-07 15:00:00.12+00";
-
-       private static final java.sql.Timestamp TS3WTZ = getTimestamp(2000, 7, 7, 15, 0, 0, 123000000, "GMT");
-       private static final String TS3WTZ_PGFORMAT = "2000-07-07 15:00:00.123+00";
-
-       private static final java.sql.Timestamp TS4WTZ = getTimestamp(2000, 7, 7, 15, 0, 0, 123456000, "GMT");
-       private static final String TS4WTZ_PGFORMAT = "2000-07-07 15:00:00.123456+00";
-
-
-       private static final java.sql.Timestamp TS1WOTZ = getTimestamp(1950, 2, 7, 15, 0, 0, 100000000, null);
-       private static final String TS1WOTZ_PGFORMAT = "1950-02-07 15:00:00.1";
-
-       private static final java.sql.Timestamp TS2WOTZ = getTimestamp(2000, 2, 7, 15, 0, 0, 120000000, null);
-       private static final String TS2WOTZ_PGFORMAT = "2000-02-07 15:00:00.12";
-
-       private static final java.sql.Timestamp TS3WOTZ = getTimestamp(2000, 7, 7, 15, 0, 0, 123000000, null);
-       private static final String TS3WOTZ_PGFORMAT = "2000-07-07 15:00:00.123";
-
-       private static final java.sql.Timestamp TS4WOTZ = getTimestamp(2000, 7, 7, 15, 0, 0, 123456000, null);
-       private static final String TS4WOTZ_PGFORMAT = "2000-07-07 15:00:00.123456";
-
-       private static final String TSWTZ_TABLE = "testtimestampwtz";
-       private static final String TSWOTZ_TABLE = "testtimestampwotz";
-       
-       private static final java.sql.Date tmpDate1 = new java.sql.Date(TS1WTZ.getTime());
-       private static final java.sql.Time tmpTime1 = new java.sql.Time(TS1WTZ.getTime());
-       private static final java.sql.Date tmpDate2 = new java.sql.Date(TS2WTZ.getTime());
-       private static final java.sql.Time tmpTime2 = new java.sql.Time(TS2WTZ.getTime());
-       private static final java.sql.Date tmpDate3 = new java.sql.Date(TS3WTZ.getTime());
-       private static final java.sql.Time tmpTime3 = new java.sql.Time(TS3WTZ.getTime());
-       private static final java.sql.Date tmpDate4 = new java.sql.Date(TS4WTZ.getTime());
-       private static final java.sql.Time tmpTime4 = new java.sql.Time(TS4WTZ.getTime());      
-       
-       private static final java.sql.Date tmpDate1WOTZ = new java.sql.Date(TS1WOTZ.getTime());
-       private static final java.sql.Time tmpTime1WOTZ = new java.sql.Time(TS1WOTZ.getTime());
-       private static final java.sql.Date tmpDate2WOTZ = new java.sql.Date(TS2WOTZ.getTime());
-       private static final java.sql.Time tmpTime2WOTZ = new java.sql.Time(TS2WOTZ.getTime());
-       private static final java.sql.Date tmpDate3WOTZ = new java.sql.Date(TS3WOTZ.getTime());
-       private static final java.sql.Time tmpTime3WOTZ = new java.sql.Time(TS3WOTZ.getTime());
-       private static final java.sql.Date tmpDate4WOTZ = new java.sql.Date(TS4WOTZ.getTime());
-       private static final java.sql.Time tmpTime4WOTZ = new java.sql.Time(TS4WOTZ.getTime()); 
-
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java
deleted file mode 100644 (file)
index 362f3ac..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-package org.postgresql.test.jdbc2;
-
-import java.sql.*;
-import junit.framework.TestCase;
-
-import org.postgresql.test.TestUtil;
-/**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2001</p>
- * <p>Company: </p>
- * @author unascribed
- * @version 1.0
- */
-
-public class UpdateableResultTest extends TestCase
-{
-       private Connection con;
-
-       public UpdateableResultTest( String name )
-       {
-               super( name );
-       }
-
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               TestUtil.createTable(con, "updateable", "id int primary key, name text, notselected text");
-               TestUtil.createTable(con, "second", "id1 int primary key, name1 text");
-
-               // put some dummy data into second
-               Statement st2 = con.createStatement();
-               st2.execute( "insert into second values (1,'anyvalue' )");
-               st2.close();
-               
-       }
-
-       protected void tearDown() throws Exception
-       {
-               TestUtil.dropTable(con, "updateable");
-               TestUtil.dropTable(con, "second");
-               TestUtil.closeDB(con);
-       }
-
-       public void testCancelRowUpdates() throws Exception
-       {
-               Statement st = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
-               ResultSet rs = st.executeQuery( "select * from second");
-
-               // make sure we're dealing with the correct row.
-               rs.first();
-               assertEquals(1,rs.getInt(1));
-               assertEquals("anyvalue",rs.getString(2));
-
-               // update, cancel and make sure nothings changed.
-               rs.updateInt(1,99);
-               rs.cancelRowUpdates();
-               assertEquals(1,rs.getInt(1));
-               assertEquals("anyvalue",rs.getString(2));
-
-               // real update
-               rs.updateInt(1,999);
-               rs.updateRow();
-               assertEquals(999,rs.getInt(1));
-               assertEquals("anyvalue",rs.getString(2));
-
-               // scroll some and make sure the update is still there
-               rs.beforeFirst();
-               rs.next();
-               assertEquals(999,rs.getInt(1));
-               assertEquals("anyvalue",rs.getString(2));
-
-
-               // make sure the update got to the db and the driver isn't lying to us.
-               rs.close();
-               rs = st.executeQuery( "select * from second");
-               rs.first();
-               assertEquals(999,rs.getInt(1));
-               assertEquals("anyvalue",rs.getString(2));
-
-               rs.close();
-               st.close();
-       }
-
-
-
-       public void testUpdateable()
-       {
-               try
-               {
-                       Statement st = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
-                       ResultSet rs = st.executeQuery( "select * from updateable");
-                       assertNotNull( rs );
-                       rs.moveToInsertRow();
-                       rs.updateInt( 1, 1 );
-                       rs.updateString( 2, "jake" );
-                       rs.updateString( 3, "avalue" );
-                       rs.insertRow();
-                       rs.first();
-
-                       rs.updateInt( "id", 2 );
-                       rs.updateString( "name", "dave" );
-                       rs.updateRow();
-
-                       assertTrue( rs.getInt("id") == 2 );
-                       assertTrue( rs.getString("name").equals("dave"));
-                       assertTrue( rs.getString("notselected").equals("avalue") );
-
-                       rs.deleteRow();
-                       rs.moveToInsertRow();
-                       rs.updateInt("id", 3);
-                       rs.updateString("name", "paul");
-
-                       rs.insertRow();
-                       rs.refreshRow();
-                       assertTrue( rs.getInt("id") == 3 );
-                       assertTrue( rs.getString("name").equals("paul"));
-                       assertTrue( rs.getString("notselected") == null );
-
-
-                       rs.close();
-
-                       rs = st.executeQuery("select id1, id, name, name1 from updateable, second" );
-                       try
-                       {
-                               while ( rs.next() )
-                               {
-                                       rs.updateInt( "id", 2 );
-                                       rs.updateString( "name", "dave" );
-                                       rs.updateRow();
-                               }
-
-
-                               assertTrue( "should not get here, update should fail", false );
-                       }
-                       catch (SQLException ex)
-                       {}
-
-                       try
-                       {
-                               rs = st.executeQuery("select oid,* from updateable");
-                               if ( rs.first() )
-                               {
-                                       rs.updateInt( "id", 3 );
-                                       rs.updateString( "name", "dave3");
-                                       rs.updateRow();
-                                       assertTrue(rs.getInt("id") == 3 );
-                                       assertTrue(rs.getString("name").equals("dave3"));
-
-                                       rs.moveToInsertRow();
-                                       rs.updateInt( "id", 4 );
-                                       rs.updateString( "name", "dave4" );
-
-                                       rs.insertRow();
-                                       rs.updateInt("id", 5 );
-                                       rs.updateString( "name", "dave5" );
-                                       rs.insertRow();
-
-                                       rs.moveToCurrentRow();
-                                       assertTrue(rs.getInt("id") == 3 );
-                                       assertTrue(rs.getString("name").equals("dave3"));
-
-                                       assertTrue( rs.next() );
-                                       assertTrue(rs.getInt("id") == 4 );
-                                       assertTrue(rs.getString("name").equals("dave4"));
-
-                                       assertTrue( rs.next() );
-                                       assertTrue(rs.getInt("id") == 5 );
-                                       assertTrue(rs.getString("name").equals("dave5"));
-
-                               }
-                       }
-                       catch (SQLException ex)
-                       {
-                               fail(ex.getMessage());
-                       }
-
-                       st.close();
-
-               }
-               catch (Exception ex)
-               {
-                       ex.printStackTrace();
-                       fail(ex.getMessage());
-               }
-       }
-
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java
deleted file mode 100644 (file)
index 75157a8..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-package org.postgresql.test.jdbc2.optional;
-
-import junit.framework.TestCase;
-import org.postgresql.test.TestUtil;
-import org.postgresql.jdbc2.optional.BaseDataSource;
-import org.postgresql.PGConnection;
-
-import java.sql.*;
-import java.util.*;
-import javax.naming.*;
-
-/**
- * Common tests for all the BaseDataSource implementations.  This is
- * a small variety to make sure that a connection can be opened and
- * some basic queries run.     The different BaseDataSource subclasses
- * have different subclasses of this which add additional custom
- * tests.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.6 $
- */
-public abstract class BaseDataSourceTest extends TestCase
-{
-    public static String DATA_SOURCE_JNDI = "BaseDataSource";
-       protected Connection con;
-       protected BaseDataSource bds;
-
-       /**
-        * Constructor required by JUnit
-        */
-       public BaseDataSourceTest(String name)
-       {
-               super(name);
-       }
-
-       /**
-        * Creates a test table using a standard connection (not from a
-        * DataSource).
-        */
-       protected void setUp() throws Exception
-       {
-               con = TestUtil.openDB();
-               TestUtil.createTable(con, "poolingtest", "id int4 not null primary key, name varchar(50)");
-               Statement stmt = con.createStatement();
-               stmt.executeUpdate("INSERT INTO poolingtest VALUES (1, 'Test Row 1')");
-               stmt.executeUpdate("INSERT INTO poolingtest VALUES (2, 'Test Row 2')");
-               TestUtil.closeDB(con);
-       }
-
-       /**
-        * Removes the test table using a standard connection (not from
-        * a DataSource)
-        */
-       protected void tearDown() throws Exception
-       {
-               con = TestUtil.openDB();
-               TestUtil.dropTable(con, "poolingtest");
-               TestUtil.closeDB(con);
-       }
-
-       /**
-        * Gets a connection from the current BaseDataSource
-        */
-       protected Connection getDataSourceConnection() throws SQLException
-       {
-               if(bds == null)
-        {
-            initializeDataSource();
-        }
-               return bds.getConnection();
-       }
-
-       /**
-        * Creates an instance of the current BaseDataSource for
-        * testing.  Must be customized by each subclass.
-        */
-       protected abstract void initializeDataSource();
-
-       /**
-        * Test to make sure you can instantiate and configure the
-        * appropriate DataSource
-        */
-       public void testCreateDataSource()
-       {
-               initializeDataSource();
-       }
-
-       /**
-        * Test to make sure you can get a connection from the DataSource,
-        * which in turn means the DataSource was able to open it.
-        */
-       public void testGetConnection()
-       {
-               try
-               {
-                       con = getDataSourceConnection();
-                       con.close();
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * A simple test to make sure you can execute SQL using the
-        * Connection from the DataSource
-        */
-       public void testUseConnection()
-       {
-               try
-               {
-                       con = getDataSourceConnection();
-                       Statement st = con.createStatement();
-                       ResultSet rs = st.executeQuery("SELECT COUNT(*) FROM poolingtest");
-                       if (rs.next())
-                       {
-                               int count = rs.getInt(1);
-                               if (rs.next())
-                               {
-                                       fail("Should only have one row in SELECT COUNT result set");
-                               }
-                               if (count != 2)
-                               {
-                                       fail("Count returned " + count + " expecting 2");
-                               }
-                       }
-                       else
-                       {
-                               fail("Should have one row in SELECT COUNT result set");
-                       }
-                       rs.close();
-                       st.close();
-                       con.close();
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * A test to make sure you can execute DDL SQL using the
-        * Connection from the DataSource.
-        */
-       public void testDdlOverConnection()
-       {
-               try
-               {
-                       con = getDataSourceConnection();
-                       TestUtil.createTable(con, "poolingtest", "id int4 not null primary key, name varchar(50)");
-                       con.close();
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * A test to make sure the connections are not being pooled by the
-        * current DataSource.  Obviously need to be overridden in the case
-        * of a pooling Datasource.
-        */
-       public void testNotPooledConnection()
-       {
-               try
-               {
-                       con = getDataSourceConnection();
-                       String name = con.toString();
-                       con.close();
-                       con = getDataSourceConnection();
-                       String name2 = con.toString();
-                       con.close();
-                       assertTrue(!name.equals(name2));
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-    /**
-     * Test to make sure that PGConnection methods can be called on the
-     * pooled Connection.
-     */
-    public void testPGConnection()
-    {
-        try
-        {
-            con = getDataSourceConnection();
-            ((PGConnection)con).getNotifications();
-            con.close();
-        }
-        catch (Exception e)
-        {
-            fail("Unable to call PGConnection method on pooled connection due to "+e.getClass().getName()+" ("+e.getMessage()+")");
-        }
-    }
-
-    /**
-     * Uses the mini-JNDI implementation for testing purposes
-     */
-    protected InitialContext getInitialContext()
-    {
-        Hashtable env = new Hashtable();
-        env.put(Context.INITIAL_CONTEXT_FACTORY, "org.postgresql.test.util.MiniJndiContextFactory");
-        try {
-            return new InitialContext(env);
-        } catch(NamingException e) {
-            fail("Unable to create InitialContext: "+e.getMessage());
-            return null;
-        }
-    }
-
-       /**
-        * Eventually, we must test stuffing the DataSource in JNDI and
-        * then getting it back out and make sure it's still usable.  This
-        * should ideally test both Serializable and Referenceable
-        * mechanisms.  Will probably be multiple tests when implemented.
-        */
-       public void testJndi()
-       {
-        initializeDataSource();
-        BaseDataSource oldbds = bds;
-        InitialContext ic = getInitialContext();
-        try {
-            ic.rebind(DATA_SOURCE_JNDI, bds);
-            bds = (BaseDataSource)ic.lookup(DATA_SOURCE_JNDI);
-            assertTrue("Got null looking up DataSource from JNDI!", bds != null);
-            compareJndiDataSource(oldbds, bds);
-        } catch (NamingException e) {
-            fail(e.getMessage());
-        }
-        oldbds = bds;
-        testUseConnection();
-        assertTrue("Test should not have changed DataSource ("+bds+" != "+oldbds+")!", bds == oldbds);
-    }
-
-    /**
-     * Check whether a DS was dereferenced from JNDI or recreated.
-     */
-    protected void compareJndiDataSource(BaseDataSource oldbds, BaseDataSource bds) {
-        assertTrue("DataSource was dereferenced, should have been serialized or recreated", bds != oldbds);
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
deleted file mode 100644 (file)
index d49f73c..0000000
+++ /dev/null
@@ -1,496 +0,0 @@
-package org.postgresql.test.jdbc2.optional;
-
-import org.postgresql.jdbc2.optional.ConnectionPool;
-import org.postgresql.test.TestUtil;
-import javax.sql.*;
-import java.sql.*;
-
-/**
- * Tests for the ConnectionPoolDataSource and PooledConnection
- * implementations.  They are tested together because the only client
- * interface to the PooledConnection is through the CPDS.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.8 $
- */
-public class ConnectionPoolTest extends BaseDataSourceTest
-{
-       /**
-        * Constructor required by JUnit
-        */
-       public ConnectionPoolTest(String name)
-       {
-               super(name);
-       }
-
-       /**
-        * Creates and configures a ConnectionPool
-        */
-       protected void initializeDataSource()
-       {
-               if (bds == null)
-               {
-                       bds = new ConnectionPool();
-                       bds.setServerName(TestUtil.getServer());
-                       bds.setPortNumber(TestUtil.getPort());
-                       bds.setDatabaseName(TestUtil.getDatabase());
-                       bds.setUser(TestUtil.getUser());
-                       bds.setPassword(TestUtil.getPassword());
-               }
-       }
-
-       /**
-        * Though the normal client interface is to grab a Connection, in
-        * order to test the middleware/server interface, we need to deal
-        * with PooledConnections.      Some tests use each.
-        */
-       protected PooledConnection getPooledConnection() throws SQLException
-       {
-               initializeDataSource();
-               return ((ConnectionPool)bds).getPooledConnection();
-       }
-
-       /**
-        * Instead of just fetching a Connection from the ConnectionPool,
-        * get a PooledConnection, add a listener to close it when the
-        * Connection is closed, and then get the Connection.  Without
-        * the listener the PooledConnection (and thus the physical connection)
-        * would never by closed.  Probably not a disaster during testing, but
-        * you never know.
-        */
-       protected Connection getDataSourceConnection() throws SQLException
-       {
-               initializeDataSource();
-               final PooledConnection pc = getPooledConnection();
-               // Since the pooled connection won't be reused in these basic tests, close it when the connection is closed
-               pc.addConnectionEventListener(new ConnectionEventListener()
-                                                                         {
-                                                                                 public void connectionClosed(ConnectionEvent event)
-                                                                                 {
-                                                                                         try
-                                                                                         {
-                                                                                                 pc.close();
-                                                                                         }
-                                                                                         catch (SQLException e)
-                                                                                         {
-                                                                                                 fail("Unable to close PooledConnection: " + e);
-                                                                                         }
-                                                                                 }
-
-                                                                                 public void connectionErrorOccurred(ConnectionEvent event)
-                                                                                 {}
-                                                                         }
-                                                                        );
-               return pc.getConnection();
-       }
-
-       /**
-        * Makes sure that if you get a connection from a PooledConnection,
-        * close it, and then get another one, you're really using the same
-        * physical connection.  Depends on the implementation of toString
-        * for the connection handle.
-        */
-       public void testPoolReuse()
-       {
-               try
-               {
-                       PooledConnection pc = getPooledConnection();
-                       con = pc.getConnection();
-                       String name = con.toString();
-                       con.close();
-                       con = pc.getConnection();
-                       String name2 = con.toString();
-                       con.close();
-                       pc.close();
-                       assertTrue("Physical connection doesn't appear to be reused across PooledConnection wrappers", name.equals(name2));
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * Makes sure that when you request a connection from the
-        * PooledConnection, and previous connection it might have given
-        * out is closed.  See JDBC 2.0 Optional Package spec section
-        * 6.2.3
-        */
-       public void testPoolCloseOldWrapper()
-       {
-               try
-               {
-                       PooledConnection pc = getPooledConnection();
-                       con = pc.getConnection();
-                       Connection con2 = pc.getConnection();
-                       try
-                       {
-                               con.createStatement();
-                               fail("Original connection wrapper should be closed when new connection wrapper is generated");
-                       }
-                       catch (SQLException e)
-                       {}
-                       try
-                       {
-                               con.close();
-                               fail("Original connection wrapper should be closed when new connection wrapper is generated");
-                       }
-                       catch (SQLException e)
-                       {}
-                       con2.close();
-                       pc.close();
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * Makes sure that if you get two connection wrappers from the same
-        * PooledConnection, they are different, even though the represent
-        * the same physical connection.  See JDBC 2.0 Optional Pacakge spec
-        * section 6.2.2
-        */
-       public void testPoolNewWrapper()
-       {
-               try
-               {
-                       PooledConnection pc = getPooledConnection();
-                       con = pc.getConnection();
-                       Connection con2 = pc.getConnection();
-                       con2.close();
-                       pc.close();
-                       assertTrue("Two calls to PooledConnection.getConnection should not return the same connection wrapper", con != con2);
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * Makes sure that exactly one close event is fired for each time a
-        * connection handle is closed.  Also checks that events are not
-        * fired after a given handle has been closed once.
-        */
-       public void testCloseEvent()
-       {
-               try
-               {
-                       PooledConnection pc = getPooledConnection();
-                       CountClose cc = new CountClose();
-                       pc.addConnectionEventListener(cc);
-                       con = pc.getConnection();
-                       assertTrue(cc.getCount() == 0);
-                       assertTrue(cc.getErrorCount() == 0);
-                       con.close();
-                       assertTrue(cc.getCount() == 1);
-                       assertTrue(cc.getErrorCount() == 0);
-                       con = pc.getConnection();
-                       assertTrue(cc.getCount() == 1);
-                       assertTrue(cc.getErrorCount() == 0);
-                       con.close();
-                       assertTrue(cc.getCount() == 2);
-                       assertTrue(cc.getErrorCount() == 0);
-                       try
-                       {
-                               con.close();
-                               fail("Should not be able to close a connection wrapper twice");
-                       }
-                       catch (SQLException e)
-                       {}
-                       assertTrue(cc.getCount() == 2);
-                       assertTrue(cc.getErrorCount() == 0);
-                       pc.close();
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * Makes sure that close events are not fired after a listener has
-        * been removed.
-        */
-       public void testNoCloseEvent()
-       {
-               try
-               {
-                       PooledConnection pc = getPooledConnection();
-                       CountClose cc = new CountClose();
-                       pc.addConnectionEventListener(cc);
-                       con = pc.getConnection();
-                       assertTrue(cc.getCount() == 0);
-                       assertTrue(cc.getErrorCount() == 0);
-                       con.close();
-                       assertTrue(cc.getCount() == 1);
-                       assertTrue(cc.getErrorCount() == 0);
-                       pc.removeConnectionEventListener(cc);
-                       con = pc.getConnection();
-                       assertTrue(cc.getCount() == 1);
-                       assertTrue(cc.getErrorCount() == 0);
-                       con.close();
-                       assertTrue(cc.getCount() == 1);
-                       assertTrue(cc.getErrorCount() == 0);
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * Makes sure that a listener can be removed while dispatching
-        * events.      Sometimes this causes a ConcurrentModificationException
-        * or something.
-        */
-       public void testInlineCloseEvent()
-       {
-               try
-               {
-                       PooledConnection pc = getPooledConnection();
-                       RemoveClose rc1 = new RemoveClose();
-                       RemoveClose rc2 = new RemoveClose();
-                       RemoveClose rc3 = new RemoveClose();
-                       pc.addConnectionEventListener(rc1);
-                       pc.addConnectionEventListener(rc2);
-                       pc.addConnectionEventListener(rc3);
-                       con = pc.getConnection();
-                       con.close();
-                       con = pc.getConnection();
-                       con.close();
-               }
-               catch (Exception e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * Tests that a close event is not generated when a connection
-        * handle is closed automatically due to a new connection handle
-        * being opened for the same PooledConnection.  See JDBC 2.0
-        * Optional Package spec section 6.3
-        */
-       public void testAutomaticCloseEvent()
-       {
-               try
-               {
-                       PooledConnection pc = getPooledConnection();
-                       CountClose cc = new CountClose();
-                       pc.addConnectionEventListener(cc);
-                       con = pc.getConnection();
-                       assertTrue(cc.getCount() == 0);
-                       assertTrue(cc.getErrorCount() == 0);
-                       con.close();
-                       assertTrue(cc.getCount() == 1);
-                       assertTrue(cc.getErrorCount() == 0);
-                       con = pc.getConnection();
-                       assertTrue(cc.getCount() == 1);
-                       assertTrue(cc.getErrorCount() == 0);
-                       // Open a 2nd connection, causing the first to be closed.  No even should be generated.
-                       Connection con2 = pc.getConnection();
-                       assertTrue("Connection handle was not closed when new handle was opened", con.isClosed());
-                       assertTrue(cc.getCount() == 1);
-                       assertTrue(cc.getErrorCount() == 0);
-                       con2.close();
-                       assertTrue(cc.getCount() == 2);
-                       assertTrue(cc.getErrorCount() == 0);
-                       pc.close();
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-       /**
-        * Makes sure the isClosed method on a connection wrapper does what
-        * you'd expect.  Checks the usual case, as well as automatic
-        * closure when a new handle is opened on the same physical connection.
-        */
-       public void testIsClosed()
-       {
-               try
-               {
-                       PooledConnection pc = getPooledConnection();
-                       Connection con = pc.getConnection();
-                       assertTrue(!con.isClosed());
-                       con.close();
-                       assertTrue(con.isClosed());
-                       con = pc.getConnection();
-                       Connection con2 = pc.getConnection();
-                       assertTrue(con.isClosed());
-                       assertTrue(!con2.isClosed());
-                       con2.close();
-                       assertTrue(con.isClosed());
-                       pc.close();
-               }
-               catch (SQLException e)
-               {
-                       fail(e.getMessage());
-               }
-       }
-
-    /**
-     * Ensures that a statement generated by a proxied connection returns the
-     * proxied connection from getConnection() [not the physical connection].
-     */
-    public void testStatementConnection() {
-        try {
-            PooledConnection pc = getPooledConnection();
-            Connection con = pc.getConnection();
-            Statement s = con.createStatement();
-            Connection conRetrieved = s.getConnection();
-
-            assertTrue(con.getClass().equals(conRetrieved.getClass()));
-            assertTrue(con.equals(conRetrieved));
-        } catch (SQLException e) {
-            fail(e.getMessage());
-        }
-    }
-
-    /**
-     * Ensures that the Statement proxy generated by the Connection handle
-     * throws the correct kind of exception.
-     */
-    public void testStatementProxy() {
-            Statement s = null;
-            try 
-            {
-                    PooledConnection pc = getPooledConnection();
-                    Connection con = pc.getConnection();
-                    s = con.createStatement();
-            } 
-            catch (SQLException e) 
-            {
-                    fail(e.getMessage());
-            }
-            try 
-            {
-                    s.executeQuery("SELECT * FROM THIS_TABLE_SHOULD_NOT_EXIST");
-                    fail("An SQL exception was not thrown that should have been");
-            } 
-            catch (SQLException e) 
-            {
-                    ; // This is the expected and correct path
-            }
-            catch (Exception e) 
-            {
-                    fail("bad exception; was expecting SQLException, not" +
-                         e.getClass().getName());
-            }
-    }
-
-    /**
-     * Ensures that a prepared statement generated by a proxied connection
-     * returns the proxied connection from getConnection() [not the physical
-     * connection].
-     */
-    public void testPreparedStatementConnection() {
-        try {
-            PooledConnection pc = getPooledConnection();
-            Connection con = pc.getConnection();
-            PreparedStatement s = con.prepareStatement("select 'x'");
-            Connection conRetrieved = s.getConnection();
-
-            assertTrue(con.getClass().equals(conRetrieved.getClass()));
-            assertTrue(con.equals(conRetrieved));
-        } catch (SQLException e) {
-            fail(e.getMessage());
-        }
-    }
-
-    /**
-     * Ensures that a callable statement generated by a proxied connection
-     * returns the proxied connection from getConnection() [not the physical
-     * connection].
-     */
-    public void testCallableStatementConnection() {
-        try {
-            PooledConnection pc = getPooledConnection();
-            Connection con = pc.getConnection();
-            CallableStatement s = con.prepareCall("select 'x'");
-            Connection conRetrieved = s.getConnection();
-
-            assertTrue(con.getClass().equals(conRetrieved.getClass()));
-            assertTrue(con.equals(conRetrieved));
-        } catch (SQLException e) {
-            fail(e.getMessage());
-        }
-    }
-
-    /**
-     * Ensure that a statement created from a pool can be used
-     * like any other statement in regard to pg extensions.
-     */
-    public void testStatementsProxyPGStatement() {
-       try {
-           PooledConnection pc = getPooledConnection();
-           con = pc.getConnection();
-           
-           Statement s = con.createStatement();
-           boolean b = ((org.postgresql.PGStatement)s).isUseServerPrepare();
-
-           PreparedStatement ps = con.prepareStatement("select 'x'");
-           b = ((org.postgresql.PGStatement)ps).isUseServerPrepare();
-
-            CallableStatement cs = con.prepareCall("select 'x'");
-           b = ((org.postgresql.PGStatement)cs).isUseServerPrepare();
-
-       } catch (SQLException e) {
-           fail(e.getMessage());
-       }
-    }
-
-    /**
-        * Helper class to remove a listener during event dispatching.
-        */
-       private class RemoveClose implements ConnectionEventListener
-       {
-               public void connectionClosed(ConnectionEvent event)
-               {
-                       ((PooledConnection)event.getSource()).removeConnectionEventListener(this);
-               }
-
-               public void connectionErrorOccurred(ConnectionEvent event)
-               {
-                       ((PooledConnection)event.getSource()).removeConnectionEventListener(this);
-               }
-       }
-
-       /**
-        * Helper class that implements the event listener interface, and
-        * counts the number of events it sees.
-        */
-       private class CountClose implements ConnectionEventListener
-       {
-               private int count = 0, errorCount = 0;
-               public void connectionClosed(ConnectionEvent event)
-               {
-                       count++;
-               }
-
-               public void connectionErrorOccurred(ConnectionEvent event)
-               {
-                       errorCount++;
-               }
-
-               public int getCount()
-               {
-                       return count;
-               }
-
-               public int getErrorCount()
-               {
-                       return errorCount;
-               }
-
-               public void clear()
-               {
-                       count = errorCount = 0;
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/OptionalTestSuite.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/OptionalTestSuite.java
deleted file mode 100644 (file)
index 58e47bb..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.postgresql.test.jdbc2.optional;
-
-import junit.framework.TestSuite;
-
-/**
- * Test suite for the JDBC 2.0 Optional Package implementation.  This
- * includes the DataSource, ConnectionPoolDataSource, and
- * PooledConnection implementations.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.4 $
- */
-public class OptionalTestSuite extends TestSuite
-{
-       /**
-        * Gets the test suite for the entire JDBC 2.0 Optional Package
-        * implementation.
-        */
-       public static TestSuite suite()
-       {
-               TestSuite suite = new TestSuite();
-               suite.addTestSuite(SimpleDataSourceTest.class);
-               suite.addTestSuite(ConnectionPoolTest.class);
-        suite.addTestSuite(PoolingDataSourceTest.class);
-               return suite;
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java
deleted file mode 100644 (file)
index 6f4a6ea..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.postgresql.test.jdbc2.optional;
-
-import java.sql.SQLException;
-import org.postgresql.test.TestUtil;
-import org.postgresql.jdbc2.optional.PoolingDataSource;
-import org.postgresql.jdbc2.optional.BaseDataSource;
-
-/**
- * Minimal tests for pooling DataSource.  Needs many more.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.2 $
- */
-public class PoolingDataSourceTest extends BaseDataSourceTest
-{
-    private final static String DS_NAME = "JDBC 2 SE Test DataSource";
-
-    /**
-     * Constructor required by JUnit
-     */
-    public PoolingDataSourceTest(String name)
-    {
-        super(name);
-    }
-
-    protected void tearDown() throws Exception
-    {
-        super.tearDown();
-        if (bds instanceof PoolingDataSource)
-        {
-            ((PoolingDataSource) bds).close();
-        }
-    }
-
-    /**
-     * Creates and configures a new SimpleDataSource.
-     */
-    protected void initializeDataSource()
-    {
-        if (bds == null)
-        {
-            bds = new PoolingDataSource();
-            bds.setServerName(TestUtil.getServer());
-            bds.setPortNumber(TestUtil.getPort());
-            bds.setDatabaseName(TestUtil.getDatabase());
-            bds.setUser(TestUtil.getUser());
-            bds.setPassword(TestUtil.getPassword());
-            ((PoolingDataSource) bds).setDataSourceName(DS_NAME);
-            ((PoolingDataSource) bds).setInitialConnections(2);
-            ((PoolingDataSource) bds).setMaxConnections(10);
-        }
-    }
-
-    /**
-     * In this case, we *do* want it to be pooled.
-     */
-    public void testNotPooledConnection()
-    {
-        try
-        {
-            con = getDataSourceConnection();
-            String name = con.toString();
-            con.close();
-            con = getDataSourceConnection();
-            String name2 = con.toString();
-            con.close();
-            assertTrue("Pooled DS doesn't appear to be pooling connections!", name.equals(name2));
-        }
-        catch (SQLException e)
-        {
-            fail(e.getMessage());
-        }
-    }
-
-    /**
-     * In this case, the desired behavior is dereferencing.
-     */
-    protected void compareJndiDataSource(BaseDataSource oldbds, BaseDataSource bds)
-    {
-        assertTrue("DataSource was serialized or recreated, should have been dereferenced", bds == oldbds);
-    }
-
-    /**
-     * Check that 2 DS instances can't use the same name.
-     */
-    public void testCantReuseName()
-    {
-        initializeDataSource();
-        PoolingDataSource pds = new PoolingDataSource();
-        try
-        {
-            pds.setDataSourceName(DS_NAME);
-            fail("Should have denied 2nd DataSource with same name");
-        }
-        catch (IllegalArgumentException e)
-        {
-        }
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java
deleted file mode 100644 (file)
index 4051122..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.postgresql.test.jdbc2.optional;
-
-import org.postgresql.test.TestUtil;
-import org.postgresql.jdbc2.optional.SimpleDataSource;
-
-/**
- * Performs the basic tests defined in the superclass. Just adds the
- * configuration logic.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.4 $
- */
-public class SimpleDataSourceTest extends BaseDataSourceTest
-{
-       /**
-        * Constructor required by JUnit
-        */
-       public SimpleDataSourceTest(String name)
-       {
-               super(name);
-       }
-
-       /**
-        * Creates and configures a new SimpleDataSource.
-        */
-       protected void initializeDataSource()
-       {
-               if (bds == null)
-               {
-                       bds = new SimpleDataSource();
-                       bds.setServerName(TestUtil.getServer());
-                       bds.setPortNumber(TestUtil.getPort());
-                       bds.setDatabaseName(TestUtil.getDatabase());
-                       bds.setUser(TestUtil.getUser());
-                       bds.setPassword(TestUtil.getPassword());
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3ConnectionPoolTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3ConnectionPoolTest.java
deleted file mode 100644 (file)
index 013a18a..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.postgresql.test.jdbc3;
-
-import org.postgresql.jdbc3.Jdbc3ConnectionPool;
-import org.postgresql.jdbc3.Jdbc3PooledConnection;
-import org.postgresql.test.TestUtil;
-import org.postgresql.test.jdbc2.optional.ConnectionPoolTest;
-import java.sql.SQLException;
-
-import javax.sql.PooledConnection;
-
-/**
- * Tests JDBC3 implementation of ConnectionPoolDataSource.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.3 $
- */
-public class Jdbc3ConnectionPoolTest extends ConnectionPoolTest
-{
-    public Jdbc3ConnectionPoolTest(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Creates and configures a Jdbc3ConnectionPool
-     */
-    protected void initializeDataSource()
-    {
-        if (bds == null)
-        {
-            bds = new Jdbc3ConnectionPool();
-            bds.setServerName(TestUtil.getServer());
-            bds.setPortNumber(TestUtil.getPort());
-            bds.setDatabaseName(TestUtil.getDatabase());
-            bds.setUser(TestUtil.getUser());
-            bds.setPassword(TestUtil.getPassword());
-        }
-    }
-
-    /**
-     * Makes sure this is a JDBC 3 implementation producing JDBC3
-     * connections.  Depends on toString implementation of
-     * connection wrappers.
-     */
-    public void testConfirmJdbc3Impl()
-    {
-        try
-        {
-            initializeDataSource();
-            assertTrue("Wrong ConnectionPool impl used by test: " + bds.getClass().getName(), bds instanceof Jdbc3ConnectionPool);
-            PooledConnection pc = ((Jdbc3ConnectionPool) bds).getPooledConnection();
-            assertTrue("Wrong PooledConnection impl generated by JDBC3 ConnectionPoolDataSource: " + pc.getClass().getName(), pc instanceof Jdbc3PooledConnection);
-            assertTrue("Wrong Connnection class used in JDBC3 ConnectionPoolDataSource's PooledConnection impl: " + pc.getConnection().toString(), pc.getConnection().toString().indexOf("Jdbc3") > -1);
-            pc.close();
-        }
-        catch (SQLException e)
-        {
-            fail(e.getMessage());
-        }
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3PoolingDataSourceTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3PoolingDataSourceTest.java
deleted file mode 100644 (file)
index c6c603b..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-package org.postgresql.test.jdbc3;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.postgresql.test.jdbc2.optional.PoolingDataSourceTest;
-import org.postgresql.test.TestUtil;
-import org.postgresql.jdbc3.Jdbc3PoolingDataSource;
-import org.postgresql.jdbc2.optional.PoolingDataSource;
-
-/**
- * Minimal tests for JDBC3 pooling DataSource.  Needs many more.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.2 $
- */
-public class Jdbc3PoolingDataSourceTest extends PoolingDataSourceTest
-{
-    private final static String DS_NAME = "JDBC 3 Test DataSource";
-
-    /**
-     * Constructor required by JUnit
-     */
-    public Jdbc3PoolingDataSourceTest(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Creates and configures a new SimpleDataSource.
-     */
-    protected void initializeDataSource()
-    {
-        if (bds == null)
-        {
-            bds = new Jdbc3PoolingDataSource();
-            configureDataSource((Jdbc3PoolingDataSource) bds);
-        }
-    }
-
-    private void configureDataSource(PoolingDataSource source)
-    {
-        String db = TestUtil.getURL();
-        source.setServerName(TestUtil.getServer());
-        source.setPortNumber(TestUtil.getPort());
-        source.setDatabaseName(TestUtil.getDatabase());
-        source.setUser(TestUtil.getUser());
-        source.setPassword(TestUtil.getPassword());
-        source.setDataSourceName(DS_NAME);
-        source.setInitialConnections(2);
-        source.setMaxConnections(10);
-    }
-
-    /**
-     * Check that 2 DS instances can't use the same name.
-     */
-    public void testCantReuseName()
-    {
-        initializeDataSource();
-        Jdbc3PoolingDataSource pds = new Jdbc3PoolingDataSource();
-        try
-        {
-            pds.setDataSourceName(DS_NAME);
-            fail("Should have denied 2nd DataSource with same name");
-        }
-        catch (IllegalArgumentException e)
-        {
-        }
-    }
-
-    /**
-     * Test that JDBC 2 and JDBC 3 DSs come from different buckets
-     * as far as creating with the same name
-     */
-    public void testDifferentImplPools()
-    {
-        initializeDataSource();
-        PoolingDataSource pds = new PoolingDataSource();
-        try
-        {
-            configureDataSource(pds);
-            PoolingDataSource p2 = new PoolingDataSource();
-            try
-            {
-                configureDataSource(p2);
-                fail("Shouldn't be able to create 2 JDBC 2 DSs with same name");
-            }
-            catch (IllegalArgumentException e)
-            {
-            }
-            Jdbc3PoolingDataSource p3 = new Jdbc3PoolingDataSource();
-            try
-            {
-                configureDataSource(p3);
-                fail("Shouldn't be able to create 2 JDBC 3 DSs with same name");
-            }
-            catch (IllegalArgumentException e)
-            {
-            }
-        }
-        finally
-        {
-            pds.close();
-        }
-    }
-
-    /**
-     * Test that JDBC 2 and JDBC 3 DSs come from different buckets
-     * as far as fetching from JNDI
-     */
-    public void testDifferentImplJndi()
-    {
-        initializeDataSource();
-        PoolingDataSource pds = new PoolingDataSource();
-        try
-        {
-            configureDataSource(pds);
-            try
-            {
-                Connection j3c = getDataSourceConnection();
-                Connection j2c = pds.getConnection();
-                j2c.close();
-                j3c.close();
-                InitialContext ctx = getInitialContext();
-                ctx.bind("JDBC2", pds);
-                ctx.bind("JDBC3", bds);
-                pds = (PoolingDataSource) ctx.lookup("JDBC2");
-                bds = (Jdbc3PoolingDataSource) ctx.lookup("JDBC3");
-                j2c = pds.getConnection();
-                j3c = bds.getConnection();
-                j2c.close();
-                j3c.close();
-            }
-            catch (SQLException e)
-            {
-                fail(e.getMessage());
-            }
-            catch (NamingException e)
-            {
-                fail(e.getMessage());
-            }
-        }
-        finally
-        {
-            pds.close();
-        }
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3SimpleDataSourceTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3SimpleDataSourceTest.java
deleted file mode 100644 (file)
index 7c1157d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.postgresql.test.jdbc3;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import org.postgresql.test.jdbc2.optional.SimpleDataSourceTest;
-import org.postgresql.test.TestUtil;
-import org.postgresql.jdbc3.*;
-
-/**
- * Tests JDBC3 non-pooling DataSource.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.2 $
- */
-public class Jdbc3SimpleDataSourceTest extends SimpleDataSourceTest {
-    /**
-     * Constructor required by JUnit
-     */
-    public Jdbc3SimpleDataSourceTest(String name)
-    {
-        super(name);
-    }
-
-    /**
-     * Creates and configures a new SimpleDataSource.
-     */
-    protected void initializeDataSource()
-    {
-        if (bds == null)
-        {
-            bds = new Jdbc3SimpleDataSource();
-            bds.setServerName(TestUtil.getServer());
-            bds.setPortNumber(TestUtil.getPort());
-            bds.setDatabaseName(TestUtil.getDatabase());
-            bds.setUser(TestUtil.getUser());
-            bds.setPassword(TestUtil.getPassword());
-        }
-    }
-    /**
-     * Makes sure this is a JDBC 3 implementation producing JDBC3
-     * connections.
-     */
-    public void testConfirmJdbc3Impl()
-    {
-        try {
-            Connection con = getDataSourceConnection();
-            assertTrue("Wrong SimpleDataSource impl used by test: "+bds.getClass().getName(), bds instanceof Jdbc3SimpleDataSource);
-            assertTrue("Wrong Connnection class generated by JDBC3 DataSource: "+con.getClass().getName(), con instanceof Jdbc3Connection);
-        } catch (SQLException e) {
-            fail(e.getMessage());
-        }
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java b/src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java
deleted file mode 100644 (file)
index d4b4ea0..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.postgresql.test.jdbc3;
-
-import junit.framework.TestSuite;
-
-/*
- * Executes all known tests for JDBC3
- */
-public class Jdbc3TestSuite extends TestSuite
-{
-
-       /*
-        * The main entry point for JUnit
-        */
-       public static TestSuite suite()
-       {
-        TestSuite suite = new TestSuite();
-        suite.addTestSuite(Jdbc3SimpleDataSourceTest.class);
-        suite.addTestSuite(Jdbc3ConnectionPoolTest.class);
-        suite.addTestSuite(Jdbc3PoolingDataSourceTest.class);
-        return suite;
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/util/MiniJndiContext.java b/src/interfaces/jdbc/org/postgresql/test/util/MiniJndiContext.java
deleted file mode 100644 (file)
index 4caf241..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-package org.postgresql.test.util;
-
-import java.util.*;
-import java.rmi.MarshalledObject;
-import java.io.Serializable;
-import javax.naming.*;
-import javax.naming.spi.ObjectFactory;
-
-/**
- * The Context for a trivial JNDI implementation.  This is not meant to
- * be very useful, beyond testing JNDI features of the connection
- * pools.  It is not a complete JNDI implementations.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.1 $
- */
-public class MiniJndiContext implements Context
-{
-    private Map map = new HashMap();
-
-    public MiniJndiContext()
-    {
-    }
-
-    public Object lookup(Name name) throws NamingException
-    {
-        return lookup(name.get(0));
-    }
-
-    public Object lookup(String name) throws NamingException
-    {
-        Object o = map.get(name);
-        if (o == null)
-        {
-            return null;
-        }
-        if (o instanceof Reference)
-        {
-            Reference ref = (Reference) o;
-            try
-            {
-                Class factoryClass = Class.forName(ref.getFactoryClassName());
-                ObjectFactory fac = (ObjectFactory) factoryClass.newInstance();
-                Object result = fac.getObjectInstance(ref, null, this, null);
-                return result;
-            }
-            catch (Exception e)
-            {
-                throw new NamingException("Unable to dereference to object: " + e);
-            }
-        }
-        else if (o instanceof MarshalledObject)
-        {
-            try
-            {
-                Object result = ((MarshalledObject) o).get();
-                return result;
-            }
-            catch (java.io.IOException e)
-            {
-                throw new NamingException("Unable to deserialize object: " + e);
-            }
-            catch (ClassNotFoundException e)
-            {
-                throw new NamingException("Unable to deserialize object: " + e);
-            }
-        }
-        else
-        {
-            throw new NamingException("JNDI Object is neither Referenceable nor Serializable");
-        }
-    }
-
-    public void bind(Name name, Object obj) throws NamingException
-    {
-        rebind(name.get(0), obj);
-    }
-
-    public void bind(String name, Object obj) throws NamingException
-    {
-        rebind(name, obj);
-    }
-
-    public void rebind(Name name, Object obj) throws NamingException
-    {
-        rebind(name.get(0), obj);
-    }
-
-    public void rebind(String name, Object obj) throws NamingException
-    {
-        if (obj instanceof Referenceable)
-        {
-            Reference ref = ((Referenceable) obj).getReference();
-            map.put(name, ref);
-        }
-        else if (obj instanceof Serializable)
-        {
-            try
-            {
-                MarshalledObject mo = new MarshalledObject(obj);
-                map.put(name, mo);
-            }
-            catch (java.io.IOException e)
-            {
-                throw new NamingException("Unable to serialize object to JNDI: " + e);
-            }
-        }
-        else
-        {
-            throw new NamingException("Object to store in JNDI is neither Referenceable nor Serializable");
-        }
-    }
-
-    public void unbind(Name name) throws NamingException
-    {
-        unbind(name.get(0));
-    }
-
-    public void unbind(String name) throws NamingException
-    {
-        map.remove(name);
-    }
-
-    public void rename(Name oldName, Name newName) throws NamingException
-    {
-        rename(oldName.get(0), newName.get(0));
-    }
-
-    public void rename(String oldName, String newName) throws NamingException
-    {
-        map.put(newName, map.remove(oldName));
-    }
-
-    public NamingEnumeration list(Name name) throws NamingException
-    {
-        return null;
-    }
-
-    public NamingEnumeration list(String name) throws NamingException
-    {
-        return null;
-    }
-
-    public NamingEnumeration listBindings(Name name) throws NamingException
-    {
-        return null;
-    }
-
-    public NamingEnumeration listBindings(String name) throws NamingException
-    {
-        return null;
-    }
-
-    public void destroySubcontext(Name name) throws NamingException
-    {
-    }
-
-    public void destroySubcontext(String name) throws NamingException
-    {
-    }
-
-    public Context createSubcontext(Name name) throws NamingException
-    {
-        return null;
-    }
-
-    public Context createSubcontext(String name) throws NamingException
-    {
-        return null;
-    }
-
-    public Object lookupLink(Name name) throws NamingException
-    {
-        return null;
-    }
-
-    public Object lookupLink(String name) throws NamingException
-    {
-        return null;
-    }
-
-    public NameParser getNameParser(Name name) throws NamingException
-    {
-        return null;
-    }
-
-    public NameParser getNameParser(String name) throws NamingException
-    {
-        return null;
-    }
-
-    public Name composeName(Name name, Name prefix) throws NamingException
-    {
-        return null;
-    }
-
-    public String composeName(String name, String prefix)
-            throws NamingException
-    {
-        return null;
-    }
-
-    public Object addToEnvironment(String propName, Object propVal)
-            throws NamingException
-    {
-        return null;
-    }
-
-    public Object removeFromEnvironment(String propName)
-            throws NamingException
-    {
-        return null;
-    }
-
-    public Hashtable getEnvironment() throws NamingException
-    {
-        return null;
-    }
-
-    public void close() throws NamingException
-    {
-    }
-
-    public String getNameInNamespace() throws NamingException
-    {
-        return null;
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/test/util/MiniJndiContextFactory.java b/src/interfaces/jdbc/org/postgresql/test/util/MiniJndiContextFactory.java
deleted file mode 100644 (file)
index 58cc533..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.postgresql.test.util;
-
-import java.util.*;
-import javax.naming.*;
-import javax.naming.spi.InitialContextFactory;
-
-/**
- * The ICF for a trivial JNDI implementation.  This is not meant to
- * be very useful, beyond testing JNDI features of the connection
- * pools.
- *
- * @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.1 $
- */
-public class MiniJndiContextFactory implements InitialContextFactory
-{
-    public Context getInitialContext(Hashtable environment)
-            throws NamingException
-    {
-        return new MiniJndiContext();
-    }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/util/MD5Digest.java b/src/interfaces/jdbc/org/postgresql/util/MD5Digest.java
deleted file mode 100644 (file)
index 86d3b34..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * MD5Digest.java
- *     MD5-based utility function to obfuscate passwords before network 
- *     transmission
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/MD5Digest.java,v 1.6 2003/11/29 19:52:11 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.util;
-
-/*
- * @author Jeremy Wohl
- */
-
-import java.security.*;
-
-public class MD5Digest
-{
-       private MD5Digest()
-       {}
-
-
-       /*
-        * Encodes user/password/salt information in the following way:
-        *       MD5(MD5(password + user) + salt)
-        *
-        * @param user          The connecting user.
-        * @param password      The connecting user's password.
-        * @param salt          A four-salt sent by the server.
-        *
-        * @return      A 35-byte array, comprising the string "md5" and an MD5 digest.
-        */
-       public static byte[] encode(String user, String password, byte []salt)
-       {
-               MessageDigest md;
-               byte[] temp_digest, pass_digest;
-               byte[] hex_digest = new byte[35];
-
-               try
-               {
-                       md = MessageDigest.getInstance("MD5");
-
-                       md.update(password.getBytes());
-                       md.update(user.getBytes());
-                       temp_digest = md.digest();
-
-                       bytesToHex(temp_digest, hex_digest, 0);
-                       md.update(hex_digest, 0, 32);
-                       md.update(salt);
-                       pass_digest = md.digest();
-
-                       bytesToHex(pass_digest, hex_digest, 3);
-                       hex_digest[0] = (byte) 'm';
-                       hex_digest[1] = (byte) 'd';
-                       hex_digest[2] = (byte) '5';
-               }
-               catch (Exception e)
-               {
-                       ; // "MessageDigest failure; " + e
-               }
-
-               return hex_digest;
-       }
-
-
-       /*
-        * Turn 16-byte stream into a human-readable 32-byte hex string
-        */
-       private static void bytesToHex(byte[] bytes, byte[] hex, int offset)
-       {
-               final char lookup[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-                                                               'a', 'b', 'c', 'd', 'e', 'f' };
-
-               int i, c, j, pos = offset;
-
-               for (i = 0; i < 16; i++)
-               {
-                       c = bytes[i] & 0xFF;
-                       j = c >> 4;
-                       hex[pos++] = (byte) lookup[j];
-                       j = (c & 0xF);
-                       hex[pos++] = (byte) lookup[j];
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/util/MessageTranslator.java b/src/interfaces/jdbc/org/postgresql/util/MessageTranslator.java
deleted file mode 100644 (file)
index 6fa6ef9..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * MessageTranslator.java
- *     A singleton class to translate JDBC driver messages in SQLException's.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/MessageTranslator.java,v 1.6 2003/11/29 19:52:11 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.util;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class MessageTranslator
-{
-
-       // The singleton instance.
-       private static MessageTranslator instance = null;
-
-       private ResourceBundle bundle;
-
-       private MessageTranslator()
-       {
-               try
-               {
-                       bundle = ResourceBundle.getBundle("org.postgresql.errors");
-               }
-               catch (MissingResourceException e)
-               {
-                       // translation files have not been installed.
-                       bundle = null;
-               }
-       }
-
-       // Synchronized, otherwise multiple threads may perform the test and
-       // assign to the singleton instance simultaneously.
-       private synchronized final static MessageTranslator getInstance()
-       {
-               if (instance == null)
-               {
-                       instance = new MessageTranslator();
-               }
-               return instance;
-       }
-
-       public final static String translate(String id, Object[] args)
-       {
-
-               MessageTranslator translator = MessageTranslator.getInstance();
-
-               return translator._translate(id, args);
-       }
-
-       public final static String translate(String id, Object arg)
-       {
-               MessageTranslator translator = MessageTranslator.getInstance();
-               Object[] args = new Object[1];
-               args[0] = arg;
-               return translator._translate(id, args);
-       }
-
-       private final String _translate(String id, Object[] args)
-       {
-               String message;
-
-               if (bundle != null && id != null)
-               {
-                       // Now look up a localized message. If one is not found, then use
-                       // the supplied message instead.
-                       try
-                       {
-                               message = bundle.getString(id);
-                       }
-                       catch (MissingResourceException e)
-                       {
-                               message = id;
-                       }
-               }
-               else
-               {
-                       message = id;
-               }
-
-               // Expand any arguments
-               if (args != null && message != null)
-               {
-                       message = MessageFormat.format(message, args);
-               }
-
-               return message;
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/util/PGbytea.java b/src/interfaces/jdbc/org/postgresql/util/PGbytea.java
deleted file mode 100644 (file)
index 25cc3e1..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGbytea.java
- *     Converts to and from the postgresql bytea datatype used by the backend.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/PGbytea.java,v 1.9 2003/11/29 19:52:11 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.util;
-
-import java.sql.*;
-
-public class PGbytea
-{
-
-       /*
-        * Converts a PG bytea raw value (i.e. the raw binary representation
-        * of the bytea data type) into a java byte[]
-        */
-       public static byte[] toBytes(byte[] s) throws SQLException
-       {
-               if (s == null)
-                       return null;
-               int slength = s.length;
-               byte[] buf = new byte[slength];
-               int bufpos = 0;
-               int thebyte;
-               byte nextbyte;
-               byte secondbyte;
-               for (int i = 0; i < slength; i++)
-               {
-                       nextbyte = s[i];
-                       if (nextbyte == (byte)'\\')
-                       {
-                               secondbyte = s[++i];
-                               if (secondbyte == (byte)'\\')
-                               {
-                                       //escaped \
-                                       buf[bufpos++] = (byte)'\\';
-                               }
-                               else
-                               {
-                                       thebyte = (secondbyte - 48) * 64 + (s[++i] - 48) * 8 + (s[++i] - 48);
-                                       if (thebyte > 127)
-                                               thebyte -= 256;
-                                       buf[bufpos++] = (byte)thebyte;
-                               }
-                       }
-                       else
-                       {
-                               buf[bufpos++] = nextbyte;
-                       }
-               }
-               byte[] l_return = new byte[bufpos];
-               System.arraycopy(buf, 0, l_return, 0, bufpos);
-               return l_return;
-       }
-
-       /*
-        * Converts a java byte[] into a PG bytea string (i.e. the text
-        * representation of the bytea data type)
-        */
-       public static String toPGString(byte[] p_buf) throws SQLException
-       {
-               if (p_buf == null)
-                       return null;
-               StringBuffer l_strbuf = new StringBuffer(2 * p_buf.length);
-               for (int i = 0; i < p_buf.length; i++)
-               {
-                       int l_int = (int)p_buf[i];
-                       if (l_int < 0)
-                       {
-                               l_int = 256 + l_int;
-                       }
-                       //we escape the same non-printable characters as the backend
-                       //we must escape all 8bit characters otherwise when convering
-                       //from java unicode to the db character set we may end up with
-                       //question marks if the character set is SQL_ASCII
-                       if (l_int < 040 || l_int > 0176)
-                       {
-                               //escape charcter with the form \000, but need two \\ because of
-                               //the parser
-                               l_strbuf.append("\\");
-                               l_strbuf.append((char)(((l_int >> 6) & 0x3) + 48));
-                               l_strbuf.append((char)(((l_int >> 3) & 0x7) + 48));
-                               l_strbuf.append((char)((l_int & 0x07) + 48));
-                       }
-                       else if (p_buf[i] == (byte)'\\')
-                       {
-                               //escape the backslash character as \\, but need four \\\\ because
-                               //of the parser
-                               l_strbuf.append("\\\\");
-                       }
-                       else
-                       {
-                               //other characters are left alone
-                               l_strbuf.append((char)p_buf[i]);
-                       }
-               }
-               return l_strbuf.toString();
-       }
-
-
-}
diff --git a/src/interfaces/jdbc/org/postgresql/util/PGmoney.java b/src/interfaces/jdbc/org/postgresql/util/PGmoney.java
deleted file mode 100644 (file)
index a68376e..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGmoney.java
- *     This implements a class that handles the PostgreSQL money and cash types
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/PGmoney.java,v 1.7 2003/11/29 19:52:11 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.util;
-
-
-import java.io.Serializable;
-import java.sql.SQLException;
-
-public class PGmoney extends PGobject implements Serializable, Cloneable
-{
-       /*
-        * The value of the field
-        */
-       public double val;
-
-       /*
-        * @param value of field
-        */
-       public PGmoney(double value)
-       {
-               this();
-               val = value;
-       }
-
-       public PGmoney(String value) throws SQLException
-       {
-               this();
-               setValue(value);
-       }
-
-       /*
-        * Required by the driver
-        */
-       public PGmoney()
-       {
-               setType("money");
-       }
-
-       public void setValue(String s) throws SQLException
-       {
-               try
-               {
-                       String s1;
-                       boolean negative;
-
-                       negative = (s.charAt(0) == '(') ;
-
-                       // Remove any () (for negative) & currency symbol
-                       s1 = PGtokenizer.removePara(s).substring(1);
-
-                       // Strip out any , in currency
-                       int pos = s1.indexOf(',');
-                       while (pos != -1)
-                       {
-                               s1 = s1.substring(0, pos) + s1.substring(pos + 1);
-                               pos = s1.indexOf(',');
-                       }
-
-                       val = Double.valueOf(s1).doubleValue();
-                       val = negative ? -val : val;
-
-               }
-               catch (NumberFormatException e)
-               {
-                       throw new PSQLException("postgresql.money", PSQLState.NUMERIC_CONSTANT_OUT_OF_RANGE, e);
-               }
-       }
-
-       public boolean equals(Object obj)
-       {
-               if (obj instanceof PGmoney)
-               {
-                       PGmoney p = (PGmoney)obj;
-                       return val == p.val;
-               }
-               return false;
-       }
-
-       /*
-        * This must be overidden to allow the object to be cloned
-        */
-       public Object clone()
-       {
-               return new PGmoney(val);
-       }
-
-       public String getValue()
-       {
-               if (val < 0)
-               {
-                       return "-$" + ( -val);
-               }
-               else
-               {
-                       return "$" + val;
-               }
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/util/PGobject.java b/src/interfaces/jdbc/org/postgresql/util/PGobject.java
deleted file mode 100644 (file)
index 6171663..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGobject.java
- *     PGobject is a class used to describe unknown types
- *     An unknown type is any type that is unknown by JDBC Standards
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/PGobject.java,v 1.5 2003/11/29 19:52:11 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.util;
-
-import java.io.Serializable;
-import java.sql.SQLException;
-
-public class PGobject implements Serializable, Cloneable
-{
-       protected String        type;
-       protected String        value;
-
-       /*
-        * This is called by org.postgresql.Connection.getObject() to create the
-        * object.
-        */
-       public PGobject()
-       {}
-
-       /*
-        * This method sets the type of this object.
-        *
-        * <p>It should not be extended by subclasses, hence its final
-        *
-        * @param type a string describing the type of the object
-        */
-       public final void setType(String type)
-       {
-               this.type = type;
-       }
-
-       /*
-        * This method sets the value of this object. It must be overidden.
-        *
-        * @param value a string representation of the value of the object
-        * @exception SQLException thrown if value is invalid for this type
-        */
-       public void setValue(String value) throws SQLException
-       {
-               this.value = value;
-       }
-
-       /*
-        * As this cannot change during the life of the object, it's final.
-        * @return the type name of this object
-        */
-       public final String getType()
-       {
-               return type;
-       }
-
-       /*
-        * This must be overidden, to return the value of the object, in the
-        * form required by org.postgresql.
-        * @return the value of this object
-        */
-       public String getValue()
-       {
-               return value;
-       }
-
-       /*
-        * This must be overidden to allow comparisons of objects
-        * @param obj Object to compare with
-        * @return true if the two boxes are identical
-        */
-       public boolean equals(Object obj)
-       {
-               if (obj instanceof PGobject)
-                       return ((PGobject)obj).getValue().equals(getValue());
-               return false;
-       }
-
-       /*
-        * This must be overidden to allow the object to be cloned
-        */
-       public Object clone()
-       {
-               PGobject obj = new PGobject();
-               obj.type = type;
-               obj.value = value;
-               return obj;
-       }
-
-       /*
-        * This is defined here, so user code need not overide it.
-        * @return the value of this object, in the syntax expected by org.postgresql
-        */
-       public String toString()
-       {
-               return getValue();
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/util/PGtokenizer.java b/src/interfaces/jdbc/org/postgresql/util/PGtokenizer.java
deleted file mode 100644 (file)
index cf33d3d..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PGtokenizer.java
- *     This class is used to tokenize the text output of org.postgres.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/PGtokenizer.java,v 1.8 2003/11/29 19:52:11 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.util;
-
-import java.util.Vector;
-
-/*
- * 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
- * @see org.postgresql.geometric.PGcircle
- * @see org.postgresql.geometric.PGlseg
- * @see org.postgresql.geometric.PGpath
- * @see org.postgresql.geometric.PGpoint
- * @see org.postgresql.geometric.PGpolygon
- */
-public class PGtokenizer
-{
-       // Our tokens
-       protected Vector        tokens;
-
-       /*
-        * Create a tokeniser.
-        *
-        * <p>We could have used StringTokenizer to do this, however, we needed to
-        * handle nesting of '(' ')' '[' ']' '&lt;' and '&gt;' as these are used
-        * by the geometric data types.
-        *
-        * @param string containing tokens
-        * @param delim single character to split the tokens
-        */
-       public PGtokenizer(String string, char delim)
-       {
-               tokenize(string, delim);
-       }
-
-       /*
-        * This resets this tokenizer with a new string and/or delimiter.
-        *
-        * @param string containing tokens
-        * @param delim single character to split the tokens
-        */
-       public int tokenize(String string, char delim)
-       {
-               tokens = new Vector();
-
-               // nest holds how many levels we are in the current token.
-               // if this is > 0 then we don't split a token when delim is matched.
-               //
-               // The Geometric datatypes use this, because often a type may have others
-               // (usualls PGpoint) imbedded within a token.
-               //
-               // Peter 1998 Jan 6 - Added < and > to the nesting rules
-               int nest = 0, p, s;
-
-               for (p = 0, s = 0;p < string.length();p++)
-               {
-                       char c = string.charAt(p);
-
-                       // increase nesting if an open character is found
-                       if (c == '(' || c == '[' || c == '<')
-                               nest++;
-
-                       // decrease nesting if a close character is found
-                       if (c == ')' || c == ']' || c == '>')
-                               nest--;
-
-                       if (nest == 0 && c == delim)
-                       {
-                               tokens.addElement(string.substring(s, p));
-                               s = p + 1; // +1 to skip the delimiter
-                       }
-
-               }
-
-               // Don't forget the last token ;-)
-
-
-
-               if (s < string.length())
-                       tokens.addElement(string.substring(s));
-
-               return tokens.size();
-       }
-
-       /*
-        * @return the number of tokens available
-        */
-       public int getSize()
-       {
-               return tokens.size();
-       }
-
-       /*
-        * @param n Token number ( 0 ... getSize()-1 )
-        * @return The token value
-        */
-       public String getToken(int n)
-       {
-               return (String)tokens.elementAt(n);
-       }
-
-       /*
-        * This returns a new tokenizer based on one of our tokens.
-        *
-        * The geometric datatypes use this to process nested tokens (usually
-        * PGpoint).
-        *
-        * @param n Token number ( 0 ... getSize()-1 )
-        * @param delim The delimiter to use
-        * @return A new instance of PGtokenizer based on the token
-        */
-       public PGtokenizer tokenizeToken(int n, char delim)
-       {
-               return new PGtokenizer(getToken(n), delim);
-       }
-
-       /*
-        * This removes the lead/trailing strings from a string
-        * @param s Source string
-        * @param l Leading string to remove
-        * @param t Trailing string to remove
-        * @return String without the lead/trailing strings
-        */
-       public static String remove(String s, String l, String t)
-       {
-               if (s.startsWith(l))
-                       s = s.substring(l.length());
-               if (s.endsWith(t))
-                       s = s.substring(0, s.length() - t.length());
-               return s;
-       }
-
-       /*
-        * This removes the lead/trailing strings from all tokens
-        * @param l Leading string to remove
-        * @param t Trailing string to remove
-        */
-       public void remove(String l, String t)
-       {
-               for (int i = 0;i < tokens.size();i++)
-               {
-                       tokens.setElementAt(remove((String)tokens.elementAt(i), l, t), i);
-               }
-       }
-
-       /*
-        * Removes ( and ) from the beginning and end of a string
-        * @param s String to remove from
-        * @return String without the ( or )
-        */
-       public static String removePara(String s)
-       {
-               return remove(s, "(", ")");
-       }
-
-       /*
-        * Removes ( and ) from the beginning and end of all tokens
-        * @return String without the ( or )
-        */
-       public void removePara()
-       {
-               remove("(", ")");
-       }
-
-       /*
-        * Removes [ and ] from the beginning and end of a string
-        * @param s String to remove from
-        * @return String without the [ or ]
-        */
-       public static String removeBox(String s)
-       {
-               return remove(s, "[", "]");
-       }
-
-       /*
-        * Removes [ and ] from the beginning and end of all tokens
-        * @return String without the [ or ]
-        */
-       public void removeBox()
-       {
-               remove("[", "]");
-       }
-
-       /*
-        * Removes &lt; and &gt; from the beginning and end of a string
-        * @param s String to remove from
-        * @return String without the &lt; or &gt;
-        */
-       public static String removeAngle(String s)
-       {
-               return remove(s, "<", ">");
-       }
-
-       /*
-        * Removes &lt; and &gt; from the beginning and end of all tokens
-        * @return String without the &lt; or &gt;
-        */
-       public void removeAngle()
-       {
-               remove("<", ">");
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/util/PSQLException.java b/src/interfaces/jdbc/org/postgresql/util/PSQLException.java
deleted file mode 100644 (file)
index c085139..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PSQLException.java
- *     This class extends SQLException, and provides our internationalisation
- *     handling
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/PSQLException.java,v 1.15 2003/12/12 18:36:20 davec Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-import java.sql.SQLException;
-import java.util.Hashtable;
-import org.postgresql.Driver;
-
-public class PSQLException extends SQLException
-{
-       private String message;
-       private PSQLState state;
-
-       //-------start new constructors-------
-       
-       public PSQLException(String msg, PSQLState state)
-       {
-               this.state = state;
-               translate(msg, null);
-               if (Driver.logDebug)
-                       Driver.debug("Exception: " + this);             
-       }
-       
-       public PSQLException(String msg, PSQLState state, Object[] argv)
-       {
-               this.state = state;
-               translate(msg, argv);
-               if (Driver.logDebug)
-                       Driver.debug("Exception: " + this);
-       }
-
-       //Helper version for one arg
-       public PSQLException(String msg, PSQLState state, Object arg1)
-       {
-               this.state = state;
-               Object[] argv = new Object[1];
-               argv[0] = arg1;
-               translate(msg, argv);
-               if (Driver.logDebug)
-                       Driver.debug("Exception: " + this);
-       }
-       
-       //Helper version for two args
-       public PSQLException(String msg, PSQLState state, Object arg1, Object arg2)
-       {
-               this.state = state;
-               Object[] argv = new Object[2];
-               argv[0] = arg1;
-               argv[1] = arg2;
-               translate(msg, argv);
-               if (Driver.logDebug)
-                       Driver.debug("Exception: " + this);
-       }
-       
-       //-------end new constructors-------
-
-       public static PSQLException parseServerError(String p_serverError) 
-       {
-               if (Driver.logDebug)
-                       Driver.debug("Constructing exception from server message: " + p_serverError);
-               char[] l_chars = p_serverError.toCharArray();
-               int l_pos = 0;
-               int l_length = l_chars.length;
-               Hashtable l_mesgParts = new Hashtable();
-               while (l_pos < l_length) {
-                       char l_mesgType = l_chars[l_pos];
-                       if (l_mesgType != '\0') {
-                               l_pos++;
-                               int l_startString = l_pos;
-                               while (l_chars[l_pos] != '\0' && l_pos < l_length) {
-                                       l_pos++;
-                               }
-                               String l_mesgPart = new String(l_chars, l_startString, l_pos - l_startString);
-                               l_mesgParts.put(new Character(l_mesgType),l_mesgPart);
-                       }
-                       l_pos++;
-               }
-
-        //Now construct the message from what the server sent
-               //The general format is:
-               //SEVERITY: Message \n
-               //  Detail: \n
-               //  Hint: \n
-               //  Position: \n
-               //  Where: \n
-               //  Location: File:Line:Routine \n
-               //  SQLState: \n
-               //
-               //Normally only the message and detail is included.
-               //If INFO level logging is enabled then detail, hint, position and where are
-               //included.  If DEBUG level logging is enabled then all information 
-               //is included.
-
-               StringBuffer l_totalMessage = new StringBuffer();
-               String l_message = (String)l_mesgParts.get(MESSAGE_TYPE_S);
-               if (l_message != null) 
-                       l_totalMessage.append(l_message).append(": ");
-               l_message = (String)l_mesgParts.get(MESSAGE_TYPE_M);
-               if (l_message != null)
-                       l_totalMessage.append(l_message).append('\n');
-               if (Driver.logInfo) {
-                       l_message = (String)l_mesgParts.get(MESSAGE_TYPE_D);
-                       if (l_message != null)
-                               l_totalMessage.append("  ").append(MessageTranslator.translate("postgresql.error.detail", l_message)).append('\n');
-                       l_message = (String)l_mesgParts.get(MESSAGE_TYPE_H);
-                       if (l_message != null)
-                               l_totalMessage.append("  ").append(MessageTranslator.translate("postgresql.error.hint", l_message)).append('\n');
-                       l_message = (String)l_mesgParts.get(MESSAGE_TYPE_P);
-                       if (l_message != null)
-                               l_totalMessage.append("  ").append(MessageTranslator.translate("postgresql.error.position", l_message)).append('\n');
-                       l_message = (String)l_mesgParts.get(MESSAGE_TYPE_W);
-                       if (l_message != null)
-                               l_totalMessage.append("  ").append(MessageTranslator.translate("postgresql.error.where", l_message)).append('\n');
-           }
-               if (Driver.logDebug) {
-                       String l_file = (String)l_mesgParts.get(MESSAGE_TYPE_F);
-                       String l_line = (String)l_mesgParts.get(MESSAGE_TYPE_L);
-                       String l_routine = (String)l_mesgParts.get(MESSAGE_TYPE_R);
-                       if (l_file != null || l_line != null || l_routine != null)
-                               l_totalMessage.append("  ").append(MessageTranslator.translate("postgresql.error.location", l_file+":"+l_line+":"+l_routine)).append('\n');
-                       l_message = (String)l_mesgParts.get(MESSAGE_TYPE_C);
-                       if (l_message != null)
-                               l_totalMessage.append("  ").append("ServerSQLState: " + l_message).append('\n');
-               }
-
-               PSQLException l_return = new PSQLException(l_totalMessage.toString(), PSQLState.UNKNOWN_STATE);
-               l_return.state = new PSQLState((String)l_mesgParts.get(MESSAGE_TYPE_C));
-               return l_return;
-       }
-       
-       private static final Character MESSAGE_TYPE_S = new Character('S');
-       private static final Character MESSAGE_TYPE_M = new Character('M');
-       private static final Character MESSAGE_TYPE_D = new Character('D');
-       private static final Character MESSAGE_TYPE_H = new Character('H');
-       private static final Character MESSAGE_TYPE_P = new Character('P');
-       private static final Character MESSAGE_TYPE_W = new Character('W');
-       private static final Character MESSAGE_TYPE_F = new Character('F');
-       private static final Character MESSAGE_TYPE_L = new Character('L');
-       private static final Character MESSAGE_TYPE_R = new Character('R');
-       private static final Character MESSAGE_TYPE_C = new Character('C');
-
-       /*
-        * This provides the same functionality to SQLException
-        * @param error Error string
-        */
-       public PSQLException(String error)
-       {
-               translate(error, null);
-               if (Driver.logDebug)
-                       Driver.debug("Exception: " + this);
-       }
-
-       /*
-        * Helper version for 1 arg
-        */
-       public PSQLException(String error, Object arg)
-       {
-               Object[] argv = new Object[1];
-               argv[0] = arg;
-               translate(error, argv);
-               if (Driver.logDebug)
-                       Driver.debug("Exception: " + this);
-       }
-
-
-    private void translate(String error, Object[] args) {
-       //We convert exception objects to Strings that 
-               //contain the full stack trace 
-               if (args != null) {
-                       for (int i = 0; i < args.length; i++) {
-                               if (args[i] instanceof Exception && !(args[i] instanceof PSQLException)) {
-                                       Exception ex = (Exception) args[i];
-                                       try {
-                                               ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                                               PrintWriter pw = new PrintWriter(baos);
-                                               pw.println("Exception: " + ex.toString() + "\nStack Trace:\n");
-                                               ex.printStackTrace(pw);
-                                               pw.println("End of Stack Trace");
-                                               pw.flush();
-                                               args[i] = baos.toString();
-                                               pw.close();
-                                               baos.close();
-                                       }
-                                       catch (Exception ioe)
-                                       {
-                                               args[i] = ex.toString() + "\nIO Error on stack trace generation! " + ioe.toString();
-                                       }
-                               }
-                       }
-               }
-
-               message = MessageTranslator.translate(error, args);
-
-       }
-
-       /*
-        * Overides Throwable
-        */
-       public String getLocalizedMessage()
-       {
-               return message;
-       }
-
-       /*
-        * Overides Throwable
-        */
-       public String getMessage()
-       {
-               return message;
-       }
-       
-       public String getSQLState()
-       {
-               if (state == null)
-                       return PSQLState.UNKNOWN_STATE.getState();
-               return state.getState();
-       }
-}
diff --git a/src/interfaces/jdbc/org/postgresql/util/PSQLState.java b/src/interfaces/jdbc/org/postgresql/util/PSQLState.java
deleted file mode 100644 (file)
index b1d1efa..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * PSQLState.java
- *     This class is used for holding SQLState codes.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- *-------------------------------------------------------------------------
- */
- package org.postgresql.util;
- public class PSQLState implements java.io.Serializable
- {
-       private String state;
-       
-       public String getState()
-       {
-               return this.state;
-       }
-
-       public PSQLState(String state)
-       {
-               this.state = state;
-       }
-       
-       
-       // begin constant state codes
-       public final static PSQLState UNKNOWN_STATE = new PSQLState("");
-  public final static PSQLState NO_DATA = new PSQLState("02000");
-  public final static PSQLState INVALID_PARAMETER_TYPE = new PSQLState("07006");
-  public final static PSQLState CONNECTION_UNABLE_TO_CONNECT = new PSQLState("08001");
-  public final static PSQLState CONNECTION_DOES_NOT_EXIST = new PSQLState("08003");
-  public final static PSQLState CONNECTION_REJECTED = new PSQLState("08004");
-  public final static PSQLState CONNECTION_FAILURE = new PSQLState("08006");
-  public final static PSQLState CONNECTION_FAILURE_DURING_TRANSACTION = new PSQLState("08007");
-       public final static PSQLState COMMUNICATION_ERROR = new PSQLState("08S01");
-  public final static PSQLState NOT_IMPLEMENTED = new PSQLState("0A000");
-  public final static PSQLState DATA_ERROR = new PSQLState("22000");
-  public final static PSQLState NUMERIC_VALUE_OUT_OF_RANGE = new PSQLState("22003");
-  public final static PSQLState BAD_DATETIME_FORMAT = new PSQLState("22007");
-  public final static PSQLState MOST_SPECIFIC_TYPE_DOES_NOT_MATCH = new PSQLState("2200G");
-  public final static PSQLState INVALID_PARAMETER_VALUE = new PSQLState("22023");
-       public final static PSQLState TRANSACTION_STATE_INVALID = new PSQLState("25000");
-  public final static PSQLState STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL = new PSQLState("2F003");
-  public final static PSQLState NUMERIC_CONSTANT_OUT_OF_RANGE = new PSQLState("42820'");
-  public final static PSQLState DATA_TYPE_MISMATCH = new PSQLState("42821");
-  public final static PSQLState SYSTEM_ERROR = new PSQLState("60000");
-  public final static PSQLState UNEXPECTED_ERROR = new PSQLState("99999");
-       
-}
diff --git a/src/interfaces/jdbc/org/postgresql/util/UnixCrypt.java b/src/interfaces/jdbc/org/postgresql/util/UnixCrypt.java
deleted file mode 100644 (file)
index b7fa9ce..0000000
+++ /dev/null
@@ -1,691 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * UnixCrypt.java
- *     Contains static methods to encrypt and compare
- *     passwords with Unix encrypted passwords.
- *
- * Copyright (c) 2003, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/UnixCrypt.java,v 1.5 2003/11/29 19:52:11 pgsql Exp $
- *
- *-------------------------------------------------------------------------
- */
-package org.postgresql.util;
-
-/*
- * <P>See <A HREF="http://www.zeh.com/local/jfd/crypt.html">
- * John Dumas's Java Crypt page</A> for the original source.</P>
- *
- * @author jdumas@zgs.com (John Dumas)
- */
-public class UnixCrypt extends Object
-{
-       //
-       // Null constructor - can't instantiate class
-       private UnixCrypt()
-       {}
-
-       private static final char[] saltChars =
-               ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./".toCharArray());
-
-       private static final int ITERATIONS = 16;
-
-       private static final int con_salt[] =
-               {
-                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-                       0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
-                       0x0A, 0x0B, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
-                       0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12,
-                       0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A,
-                       0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22,
-                       0x23, 0x24, 0x25, 0x20, 0x21, 0x22, 0x23, 0x24,
-                       0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C,
-                       0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34,
-                       0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C,
-                       0x3D, 0x3E, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00,
-               };
-
-       private static final boolean shifts2[] =
-               {
-                       false, false, true, true, true, true, true, true,
-                       false, true, true, true, true, true, true, false
-               };
-
-       private static final int skb[][] =
-               {
-                       {
-                               /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
-                               0x00000000, 0x00000010, 0x20000000, 0x20000010,
-                               0x00010000, 0x00010010, 0x20010000, 0x20010010,
-                               0x00000800, 0x00000810, 0x20000800, 0x20000810,
-                               0x00010800, 0x00010810, 0x20010800, 0x20010810,
-                               0x00000020, 0x00000030, 0x20000020, 0x20000030,
-                               0x00010020, 0x00010030, 0x20010020, 0x20010030,
-                               0x00000820, 0x00000830, 0x20000820, 0x20000830,
-                               0x00010820, 0x00010830, 0x20010820, 0x20010830,
-                               0x00080000, 0x00080010, 0x20080000, 0x20080010,
-                               0x00090000, 0x00090010, 0x20090000, 0x20090010,
-                               0x00080800, 0x00080810, 0x20080800, 0x20080810,
-                               0x00090800, 0x00090810, 0x20090800, 0x20090810,
-                               0x00080020, 0x00080030, 0x20080020, 0x20080030,
-                               0x00090020, 0x00090030, 0x20090020, 0x20090030,
-                               0x00080820, 0x00080830, 0x20080820, 0x20080830,
-                               0x00090820, 0x00090830, 0x20090820, 0x20090830,
-                       },
-                       {
-                               /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */
-                               0x00000000, 0x02000000, 0x00002000, 0x02002000,
-                               0x00200000, 0x02200000, 0x00202000, 0x02202000,
-                               0x00000004, 0x02000004, 0x00002004, 0x02002004,
-                               0x00200004, 0x02200004, 0x00202004, 0x02202004,
-                               0x00000400, 0x02000400, 0x00002400, 0x02002400,
-                               0x00200400, 0x02200400, 0x00202400, 0x02202400,
-                               0x00000404, 0x02000404, 0x00002404, 0x02002404,
-                               0x00200404, 0x02200404, 0x00202404, 0x02202404,
-                               0x10000000, 0x12000000, 0x10002000, 0x12002000,
-                               0x10200000, 0x12200000, 0x10202000, 0x12202000,
-                               0x10000004, 0x12000004, 0x10002004, 0x12002004,
-                               0x10200004, 0x12200004, 0x10202004, 0x12202004,
-                               0x10000400, 0x12000400, 0x10002400, 0x12002400,
-                               0x10200400, 0x12200400, 0x10202400, 0x12202400,
-                               0x10000404, 0x12000404, 0x10002404, 0x12002404,
-                               0x10200404, 0x12200404, 0x10202404, 0x12202404,
-                       },
-                       {
-                               /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */
-                               0x00000000, 0x00000001, 0x00040000, 0x00040001,
-                               0x01000000, 0x01000001, 0x01040000, 0x01040001,
-                               0x00000002, 0x00000003, 0x00040002, 0x00040003,
-                               0x01000002, 0x01000003, 0x01040002, 0x01040003,
-                               0x00000200, 0x00000201, 0x00040200, 0x00040201,
-                               0x01000200, 0x01000201, 0x01040200, 0x01040201,
-                               0x00000202, 0x00000203, 0x00040202, 0x00040203,
-                               0x01000202, 0x01000203, 0x01040202, 0x01040203,
-                               0x08000000, 0x08000001, 0x08040000, 0x08040001,
-                               0x09000000, 0x09000001, 0x09040000, 0x09040001,
-                               0x08000002, 0x08000003, 0x08040002, 0x08040003,
-                               0x09000002, 0x09000003, 0x09040002, 0x09040003,
-                               0x08000200, 0x08000201, 0x08040200, 0x08040201,
-                               0x09000200, 0x09000201, 0x09040200, 0x09040201,
-                               0x08000202, 0x08000203, 0x08040202, 0x08040203,
-                               0x09000202, 0x09000203, 0x09040202, 0x09040203,
-                       },
-                       {
-                               /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */
-                               0x00000000, 0x00100000, 0x00000100, 0x00100100,
-                               0x00000008, 0x00100008, 0x00000108, 0x00100108,
-                               0x00001000, 0x00101000, 0x00001100, 0x00101100,
-                               0x00001008, 0x00101008, 0x00001108, 0x00101108,
-                               0x04000000, 0x04100000, 0x04000100, 0x04100100,
-                               0x04000008, 0x04100008, 0x04000108, 0x04100108,
-                               0x04001000, 0x04101000, 0x04001100, 0x04101100,
-                               0x04001008, 0x04101008, 0x04001108, 0x04101108,
-                               0x00020000, 0x00120000, 0x00020100, 0x00120100,
-                               0x00020008, 0x00120008, 0x00020108, 0x00120108,
-                               0x00021000, 0x00121000, 0x00021100, 0x00121100,
-                               0x00021008, 0x00121008, 0x00021108, 0x00121108,
-                               0x04020000, 0x04120000, 0x04020100, 0x04120100,
-                               0x04020008, 0x04120008, 0x04020108, 0x04120108,
-                               0x04021000, 0x04121000, 0x04021100, 0x04121100,
-                               0x04021008, 0x04121008, 0x04021108, 0x04121108,
-                       },
-                       {
-                               /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
-                               0x00000000, 0x10000000, 0x00010000, 0x10010000,
-                               0x00000004, 0x10000004, 0x00010004, 0x10010004,
-                               0x20000000, 0x30000000, 0x20010000, 0x30010000,
-                               0x20000004, 0x30000004, 0x20010004, 0x30010004,
-                               0x00100000, 0x10100000, 0x00110000, 0x10110000,
-                               0x00100004, 0x10100004, 0x00110004, 0x10110004,
-                               0x20100000, 0x30100000, 0x20110000, 0x30110000,
-                               0x20100004, 0x30100004, 0x20110004, 0x30110004,
-                               0x00001000, 0x10001000, 0x00011000, 0x10011000,
-                               0x00001004, 0x10001004, 0x00011004, 0x10011004,
-                               0x20001000, 0x30001000, 0x20011000, 0x30011000,
-                               0x20001004, 0x30001004, 0x20011004, 0x30011004,
-                               0x00101000, 0x10101000, 0x00111000, 0x10111000,
-                               0x00101004, 0x10101004, 0x00111004, 0x10111004,
-                               0x20101000, 0x30101000, 0x20111000, 0x30111000,
-                               0x20101004, 0x30101004, 0x20111004, 0x30111004,
-                       },
-                       {
-                               /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */
-                               0x00000000, 0x08000000, 0x00000008, 0x08000008,
-                               0x00000400, 0x08000400, 0x00000408, 0x08000408,
-                               0x00020000, 0x08020000, 0x00020008, 0x08020008,
-                               0x00020400, 0x08020400, 0x00020408, 0x08020408,
-                               0x00000001, 0x08000001, 0x00000009, 0x08000009,
-                               0x00000401, 0x08000401, 0x00000409, 0x08000409,
-                               0x00020001, 0x08020001, 0x00020009, 0x08020009,
-                               0x00020401, 0x08020401, 0x00020409, 0x08020409,
-                               0x02000000, 0x0A000000, 0x02000008, 0x0A000008,
-                               0x02000400, 0x0A000400, 0x02000408, 0x0A000408,
-                               0x02020000, 0x0A020000, 0x02020008, 0x0A020008,
-                               0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
-                               0x02000001, 0x0A000001, 0x02000009, 0x0A000009,
-                               0x02000401, 0x0A000401, 0x02000409, 0x0A000409,
-                               0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
-                               0x02020401, 0x0A020401, 0x02020409, 0x0A020409,
-                       },
-                       {
-                               /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */
-                               0x00000000, 0x00000100, 0x00080000, 0x00080100,
-                               0x01000000, 0x01000100, 0x01080000, 0x01080100,
-                               0x00000010, 0x00000110, 0x00080010, 0x00080110,
-                               0x01000010, 0x01000110, 0x01080010, 0x01080110,
-                               0x00200000, 0x00200100, 0x00280000, 0x00280100,
-                               0x01200000, 0x01200100, 0x01280000, 0x01280100,
-                               0x00200010, 0x00200110, 0x00280010, 0x00280110,
-                               0x01200010, 0x01200110, 0x01280010, 0x01280110,
-                               0x00000200, 0x00000300, 0x00080200, 0x00080300,
-                               0x01000200, 0x01000300, 0x01080200, 0x01080300,
-                               0x00000210, 0x00000310, 0x00080210, 0x00080310,
-                               0x01000210, 0x01000310, 0x01080210, 0x01080310,
-                               0x00200200, 0x00200300, 0x00280200, 0x00280300,
-                               0x01200200, 0x01200300, 0x01280200, 0x01280300,
-                               0x00200210, 0x00200310, 0x00280210, 0x00280310,
-                               0x01200210, 0x01200310, 0x01280210, 0x01280310,
-                       },
-                       {
-                               /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */
-                               0x00000000, 0x04000000, 0x00040000, 0x04040000,
-                               0x00000002, 0x04000002, 0x00040002, 0x04040002,
-                               0x00002000, 0x04002000, 0x00042000, 0x04042000,
-                               0x00002002, 0x04002002, 0x00042002, 0x04042002,
-                               0x00000020, 0x04000020, 0x00040020, 0x04040020,
-                               0x00000022, 0x04000022, 0x00040022, 0x04040022,
-                               0x00002020, 0x04002020, 0x00042020, 0x04042020,
-                               0x00002022, 0x04002022, 0x00042022, 0x04042022,
-                               0x00000800, 0x04000800, 0x00040800, 0x04040800,
-                               0x00000802, 0x04000802, 0x00040802, 0x04040802,
-                               0x00002800, 0x04002800, 0x00042800, 0x04042800,
-                               0x00002802, 0x04002802, 0x00042802, 0x04042802,
-                               0x00000820, 0x04000820, 0x00040820, 0x04040820,
-                               0x00000822, 0x04000822, 0x00040822, 0x04040822,
-                               0x00002820, 0x04002820, 0x00042820, 0x04042820,
-                               0x00002822, 0x04002822, 0x00042822, 0x04042822,
-                       },
-               };
-
-       private static final int SPtrans[][] =
-               {
-                       {
-                               /* nibble 0 */
-                               0x00820200, 0x00020000, 0x80800000, 0x80820200,
-                               0x00800000, 0x80020200, 0x80020000, 0x80800000,
-                               0x80020200, 0x00820200, 0x00820000, 0x80000200,
-                               0x80800200, 0x00800000, 0x00000000, 0x80020000,
-                               0x00020000, 0x80000000, 0x00800200, 0x00020200,
-                               0x80820200, 0x00820000, 0x80000200, 0x00800200,
-                               0x80000000, 0x00000200, 0x00020200, 0x80820000,
-                               0x00000200, 0x80800200, 0x80820000, 0x00000000,
-                               0x00000000, 0x80820200, 0x00800200, 0x80020000,
-                               0x00820200, 0x00020000, 0x80000200, 0x00800200,
-                               0x80820000, 0x00000200, 0x00020200, 0x80800000,
-                               0x80020200, 0x80000000, 0x80800000, 0x00820000,
-                               0x80820200, 0x00020200, 0x00820000, 0x80800200,
-                               0x00800000, 0x80000200, 0x80020000, 0x00000000,
-                               0x00020000, 0x00800000, 0x80800200, 0x00820200,
-                               0x80000000, 0x80820000, 0x00000200, 0x80020200,
-                       },
-                       {
-                               /* nibble 1 */
-                               0x10042004, 0x00000000, 0x00042000, 0x10040000,
-                               0x10000004, 0x00002004, 0x10002000, 0x00042000,
-                               0x00002000, 0x10040004, 0x00000004, 0x10002000,
-                               0x00040004, 0x10042000, 0x10040000, 0x00000004,
-                               0x00040000, 0x10002004, 0x10040004, 0x00002000,
-                               0x00042004, 0x10000000, 0x00000000, 0x00040004,
-                               0x10002004, 0x00042004, 0x10042000, 0x10000004,
-                               0x10000000, 0x00040000, 0x00002004, 0x10042004,
-                               0x00040004, 0x10042000, 0x10002000, 0x00042004,
-                               0x10042004, 0x00040004, 0x10000004, 0x00000000,
-                               0x10000000, 0x00002004, 0x00040000, 0x10040004,
-                               0x00002000, 0x10000000, 0x00042004, 0x10002004,
-                               0x10042000, 0x00002000, 0x00000000, 0x10000004,
-                               0x00000004, 0x10042004, 0x00042000, 0x10040000,
-                               0x10040004, 0x00040000, 0x00002004, 0x10002000,
-                               0x10002004, 0x00000004, 0x10040000, 0x00042000,
-                       },
-                       {
-                               /* nibble 2 */
-                               0x41000000, 0x01010040, 0x00000040, 0x41000040,
-                               0x40010000, 0x01000000, 0x41000040, 0x00010040,
-                               0x01000040, 0x00010000, 0x01010000, 0x40000000,
-                               0x41010040, 0x40000040, 0x40000000, 0x41010000,
-                               0x00000000, 0x40010000, 0x01010040, 0x00000040,
-                               0x40000040, 0x41010040, 0x00010000, 0x41000000,
-                               0x41010000, 0x01000040, 0x40010040, 0x01010000,
-                               0x00010040, 0x00000000, 0x01000000, 0x40010040,
-                               0x01010040, 0x00000040, 0x40000000, 0x00010000,
-                               0x40000040, 0x40010000, 0x01010000, 0x41000040,
-                               0x00000000, 0x01010040, 0x00010040, 0x41010000,
-                               0x40010000, 0x01000000, 0x41010040, 0x40000000,
-                               0x40010040, 0x41000000, 0x01000000, 0x41010040,
-                               0x00010000, 0x01000040, 0x41000040, 0x00010040,
-                               0x01000040, 0x00000000, 0x41010000, 0x40000040,
-                               0x41000000, 0x40010040, 0x00000040, 0x01010000,
-                       },
-                       {
-                               /* nibble 3 */
-                               0x00100402, 0x04000400, 0x00000002, 0x04100402,
-                               0x00000000, 0x04100000, 0x04000402, 0x00100002,
-                               0x04100400, 0x04000002, 0x04000000, 0x00000402,
-                               0x04000002, 0x00100402, 0x00100000, 0x04000000,
-                               0x04100002, 0x00100400, 0x00000400, 0x00000002,
-                               0x00100400, 0x04000402, 0x04100000, 0x00000400,
-                               0x00000402, 0x00000000, 0x00100002, 0x04100400,
-                               0x04000400, 0x04100002, 0x04100402, 0x00100000,
-                               0x04100002, 0x00000402, 0x00100000, 0x04000002,
-                               0x00100400, 0x04000400, 0x00000002, 0x04100000,
-                               0x04000402, 0x00000000, 0x00000400, 0x00100002,
-                               0x00000000, 0x04100002, 0x04100400, 0x00000400,
-                               0x04000000, 0x04100402, 0x00100402, 0x00100000,
-                               0x04100402, 0x00000002, 0x04000400, 0x00100402,
-                               0x00100002, 0x00100400, 0x04100000, 0x04000402,
-                               0x00000402, 0x04000000, 0x04000002, 0x04100400,
-                       },
-                       {
-                               /* nibble 4 */
-                               0x02000000, 0x00004000, 0x00000100, 0x02004108,
-                               0x02004008, 0x02000100, 0x00004108, 0x02004000,
-                               0x00004000, 0x00000008, 0x02000008, 0x00004100,
-                               0x02000108, 0x02004008, 0x02004100, 0x00000000,
-                               0x00004100, 0x02000000, 0x00004008, 0x00000108,
-                               0x02000100, 0x00004108, 0x00000000, 0x02000008,
-                               0x00000008, 0x02000108, 0x02004108, 0x00004008,
-                               0x02004000, 0x00000100, 0x00000108, 0x02004100,
-                               0x02004100, 0x02000108, 0x00004008, 0x02004000,
-                               0x00004000, 0x00000008, 0x02000008, 0x02000100,
-                               0x02000000, 0x00004100, 0x02004108, 0x00000000,
-                               0x00004108, 0x02000000, 0x00000100, 0x00004008,
-                               0x02000108, 0x00000100, 0x00000000, 0x02004108,
-                               0x02004008, 0x02004100, 0x00000108, 0x00004000,
-                               0x00004100, 0x02004008, 0x02000100, 0x00000108,
-                               0x00000008, 0x00004108, 0x02004000, 0x02000008,
-                       },
-                       {
-                               /* nibble 5 */
-                               0x20000010, 0x00080010, 0x00000000, 0x20080800,
-                               0x00080010, 0x00000800, 0x20000810, 0x00080000,
-                               0x00000810, 0x20080810, 0x00080800, 0x20000000,
-                               0x20000800, 0x20000010, 0x20080000, 0x00080810,
-                               0x00080000, 0x20000810, 0x20080010, 0x00000000,
-                               0x00000800, 0x00000010, 0x20080800, 0x20080010,
-                               0x20080810, 0x20080000, 0x20000000, 0x00000810,
-                               0x00000010, 0x00080800, 0x00080810, 0x20000800,
-                               0x00000810, 0x20000000, 0x20000800, 0x00080810,
-                               0x20080800, 0x00080010, 0x00000000, 0x20000800,
-                               0x20000000, 0x00000800, 0x20080010, 0x00080000,
-                               0x00080010, 0x20080810, 0x00080800, 0x00000010,
-                               0x20080810, 0x00080800, 0x00080000, 0x20000810,
-                               0x20000010, 0x20080000, 0x00080810, 0x00000000,
-                               0x00000800, 0x20000010, 0x20000810, 0x20080800,
-                               0x20080000, 0x00000810, 0x00000010, 0x20080010,
-                       },
-                       {
-                               /* nibble 6 */
-                               0x00001000, 0x00000080, 0x00400080, 0x00400001,
-                               0x00401081, 0x00001001, 0x00001080, 0x00000000,
-                               0x00400000, 0x00400081, 0x00000081, 0x00401000,
-                               0x00000001, 0x00401080, 0x00401000, 0x00000081,
-                               0x00400081, 0x00001000, 0x00001001, 0x00401081,
-                               0x00000000, 0x00400080, 0x00400001, 0x00001080,
-                               0x00401001, 0x00001081, 0x00401080, 0x00000001,
-                               0x00001081, 0x00401001, 0x00000080, 0x00400000,
-                               0x00001081, 0x00401000, 0x00401001, 0x00000081,
-                               0x00001000, 0x00000080, 0x00400000, 0x00401001,
-                               0x00400081, 0x00001081, 0x00001080, 0x00000000,
-                               0x00000080, 0x00400001, 0x00000001, 0x00400080,
-                               0x00000000, 0x00400081, 0x00400080, 0x00001080,
-                               0x00000081, 0x00001000, 0x00401081, 0x00400000,
-                               0x00401080, 0x00000001, 0x00001001, 0x00401081,
-                               0x00400001, 0x00401080, 0x00401000, 0x00001001,
-                       },
-                       {
-                               /* nibble 7 */
-                               0x08200020, 0x08208000, 0x00008020, 0x00000000,
-                               0x08008000, 0x00200020, 0x08200000, 0x08208020,
-                               0x00000020, 0x08000000, 0x00208000, 0x00008020,
-                               0x00208020, 0x08008020, 0x08000020, 0x08200000,
-                               0x00008000, 0x00208020, 0x00200020, 0x08008000,
-                               0x08208020, 0x08000020, 0x00000000, 0x00208000,
-                               0x08000000, 0x00200000, 0x08008020, 0x08200020,
-                               0x00200000, 0x00008000, 0x08208000, 0x00000020,
-                               0x00200000, 0x00008000, 0x08000020, 0x08208020,
-                               0x00008020, 0x08000000, 0x00000000, 0x00208000,
-                               0x08200020, 0x08008020, 0x08008000, 0x00200020,
-                               0x08208000, 0x00000020, 0x00200020, 0x08008000,
-                               0x08208020, 0x00200000, 0x08200000, 0x08000020,
-                               0x00208000, 0x00008020, 0x08008020, 0x08200000,
-                               0x00000020, 0x08208000, 0x00208020, 0x00000000,
-                               0x08000000, 0x08200020, 0x00008000, 0x00208020
-                       }
-               };
-
-       private static final int cov_2char[] =
-               {
-                       0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
-                       0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44,
-                       0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C,
-                       0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
-                       0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x61, 0x62,
-                       0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A,
-                       0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72,
-                       0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A
-               };
-
-       private static final int byteToUnsigned(byte b)
-       {
-               int value = (int)b;
-
-               return (value >= 0 ? value : value + 256);
-       }
-
-       private static int fourBytesToInt(byte b[], int offset)
-       {
-               int value;
-
-               value = byteToUnsigned(b[offset++]);
-               value |= (byteToUnsigned(b[offset++]) << 8);
-               value |= (byteToUnsigned(b[offset++]) << 16);
-               value |= (byteToUnsigned(b[offset++]) << 24);
-
-               return (value);
-       }
-
-       private static final void intToFourBytes(int iValue, byte b[], int offset)
-       {
-               b[offset++] = (byte)((iValue) & 0xff);
-               b[offset++] = (byte)((iValue >>> 8 ) & 0xff);
-               b[offset++] = (byte)((iValue >>> 16) & 0xff);
-               b[offset++] = (byte)((iValue >>> 24) & 0xff);
-       }
-
-       private static final void PERM_OP(int a, int b, int n, int m, int results[])
-       {
-               int t;
-
-               t = ((a >>> n) ^ b) & m;
-               a ^= t << n;
-               b ^= t;
-
-               results[0] = a;
-               results[1] = b;
-       }
-
-       private static final int HPERM_OP(int a, int n, int m)
-       {
-               int t;
-
-               t = ((a << (16 - n)) ^ a) & m;
-               a = a ^ t ^ (t >>> (16 - n));
-
-               return (a);
-       }
-
-       private static int [] des_set_key(byte key[])
-       {
-               int schedule[] = new int[ITERATIONS * 2];
-
-               int c = fourBytesToInt(key, 0);
-               int d = fourBytesToInt(key, 4);
-
-               int results[] = new int[2];
-
-               PERM_OP(d, c, 4, 0x0f0f0f0f, results);
-               d = results[0];
-               c = results[1];
-
-               c = HPERM_OP(c, -2, 0xcccc0000);
-               d = HPERM_OP(d, -2, 0xcccc0000);
-
-               PERM_OP(d, c, 1, 0x55555555, results);
-               d = results[0];
-               c = results[1];
-
-               PERM_OP(c, d, 8, 0x00ff00ff, results);
-               c = results[0];
-               d = results[1];
-
-               PERM_OP(d, c, 1, 0x55555555, results);
-               d = results[0];
-               c = results[1];
-
-               d = (((d & 0x000000ff) << 16) | (d & 0x0000ff00) |
-                        ((d & 0x00ff0000) >>> 16) | ((c & 0xf0000000) >>> 4));
-               c &= 0x0fffffff;
-
-               int s, t;
-               int j = 0;
-
-               for (int i = 0; i < ITERATIONS; i ++)
-               {
-                       if (shifts2[i])
-                       {
-                               c = (c >>> 2) | (c << 26);
-                               d = (d >>> 2) | (d << 26);
-                       }
-                       else
-                       {
-                               c = (c >>> 1) | (c << 27);
-                               d = (d >>> 1) | (d << 27);
-                       }
-
-                       c &= 0x0fffffff;
-                       d &= 0x0fffffff;
-
-                       s = skb[0][ (c ) & 0x3f ] |
-                               skb[1][((c >>> 6) & 0x03) | ((c >>> 7) & 0x3c)] |
-                               skb[2][((c >>> 13) & 0x0f) | ((c >>> 14) & 0x30)] |
-                               skb[3][((c >>> 20) & 0x01) | ((c >>> 21) & 0x06) |
-                                          ((c >>> 22) & 0x38)];
-
-                       t = skb[4][ (d ) & 0x3f ] |
-                               skb[5][((d >>> 7) & 0x03) | ((d >>> 8) & 0x3c)] |
-                               skb[6][ (d >>> 15) & 0x3f ] |
-                               skb[7][((d >>> 21) & 0x0f) | ((d >>> 22) & 0x30)];
-
-                       schedule[j++] = ((t << 16) | (s & 0x0000ffff)) & 0xffffffff;
-                       s = ((s >>> 16) | (t & 0xffff0000));
-
-                       s = (s << 4) | (s >>> 28);
-                       schedule[j++] = s & 0xffffffff;
-               }
-               return (schedule);
-       }
-
-       private static final int D_ENCRYPT
-       (
-               int L, int R, int S, int E0, int E1, int s[]
-       )
-       {
-               int t, u, v;
-
-               v = R ^ (R >>> 16);
-               u = v & E0;
-               v = v & E1;
-               u = (u ^ (u << 16)) ^ R ^ s[S];
-               t = (v ^ (v << 16)) ^ R ^ s[S + 1];
-               t = (t >>> 4) | (t << 28);
-
-               L ^= SPtrans[1][(t ) & 0x3f] |
-                        SPtrans[3][(t >>> 8) & 0x3f] |
-                        SPtrans[5][(t >>> 16) & 0x3f] |
-                        SPtrans[7][(t >>> 24) & 0x3f] |
-                        SPtrans[0][(u ) & 0x3f] |
-                        SPtrans[2][(u >>> 8) & 0x3f] |
-                        SPtrans[4][(u >>> 16) & 0x3f] |
-                        SPtrans[6][(u >>> 24) & 0x3f];
-
-               return (L);
-       }
-
-       private static final int [] body(int schedule[], int Eswap0, int Eswap1)
-       {
-               int left = 0;
-               int right = 0;
-               int t = 0;
-
-               for (int j = 0; j < 25; j ++)
-               {
-                       for (int i = 0; i < ITERATIONS * 2; i += 4)
-                       {
-                               left = D_ENCRYPT(left, right, i, Eswap0, Eswap1, schedule);
-                               right = D_ENCRYPT(right, left, i + 2, Eswap0, Eswap1, schedule);
-                       }
-                       t = left;
-                       left = right;
-                       right = t;
-               }
-
-               t = right;
-
-               right = (left >>> 1) | (left << 31);
-               left = (t >>> 1) | (t << 31);
-
-               left &= 0xffffffff;
-               right &= 0xffffffff;
-
-               int results[] = new int[2];
-
-               PERM_OP(right, left, 1, 0x55555555, results);
-               right = results[0];
-               left = results[1];
-
-               PERM_OP(left, right, 8, 0x00ff00ff, results);
-               left = results[0];
-               right = results[1];
-
-               PERM_OP(right, left, 2, 0x33333333, results);
-               right = results[0];
-               left = results[1];
-
-               PERM_OP(left, right, 16, 0x0000ffff, results);
-               left = results[0];
-               right = results[1];
-
-               PERM_OP(right, left, 4, 0x0f0f0f0f, results);
-               right = results[0];
-               left = results[1];
-
-               int out[] = new int[2];
-
-               out[0] = left;
-               out[1] = right;
-
-               return (out);
-       }
-
-       /*
-        * <P>Encrypt a password given the cleartext password and a "salt".</P>
-        * @param salt A two-character string representing the salt used to
-        * iterate the encryption engine in lots of different ways. If you
-        * are generating a new encryption then this value should be
-        * randomised.
-        * @param original The password to be encrypted.
-        * @return A string consisting of the 2-character salt followed by the
-        * encrypted password.
-        */
-       public static final String crypt(String salt, String original)
-       {
-               while (salt.length() < 2)
-                       salt += "A";
-
-               StringBuffer buffer = new StringBuffer("             ");
-
-               char charZero = salt.charAt(0);
-               char charOne = salt.charAt(1);
-
-               buffer.setCharAt(0, charZero);
-               buffer.setCharAt(1, charOne);
-
-               int Eswap0 = con_salt[(int)charZero];
-               int Eswap1 = con_salt[(int)charOne] << 4;
-
-               byte key[] = new byte[8];
-
-               for (int i = 0; i < key.length; i ++)
-                       key[i] = (byte)0;
-
-               for (int i = 0; i < key.length && i < original.length(); i ++)
-               {
-                       int iChar = (int)original.charAt(i);
-
-                       key[i] = (byte)(iChar << 1);
-               }
-
-               int schedule[] = des_set_key(key);
-               int out[] = body(schedule, Eswap0, Eswap1);
-
-               byte b[] = new byte[9];
-
-               intToFourBytes(out[0], b, 0);
-               intToFourBytes(out[1], b, 4);
-               b[8] = 0;
-
-               for (int i = 2, y = 0, u = 0x80; i < 13; i ++)
-               {
-                       for (int j = 0, c = 0; j < 6; j ++)
-                       {
-                               c <<= 1;
-
-                               if (((int)b[y] & u) != 0)
-                                       c |= 1;
-
-                               u >>>= 1;
-
-                               if (u == 0)
-                               {
-                                       y++;
-                                       u = 0x80;
-                               }
-                               buffer.setCharAt(i, (char)cov_2char[c]);
-                       }
-               }
-               return (buffer.toString());
-       }
-
-       /*
-        * <P>Encrypt a password given the cleartext password. This method
-        * generates a random salt using the 'java.util.Random' class.</P>
-        * @param original The password to be encrypted.
-        * @return A string consisting of the 2-character salt followed by the
-        * encrypted password.
-        */
-       public static final String crypt(String original)
-       {
-               java.util.Random randomGenerator = new java.util.Random();
-               int numSaltChars = saltChars.length;
-               String salt;
-
-               salt = (new StringBuffer()).append(saltChars[Math.abs(randomGenerator.nextInt()) % numSaltChars]).append(saltChars[Math.abs(randomGenerator.nextInt()) % numSaltChars]).toString();
-
-               return crypt(salt, original);
-       }
-
-       /*
-        * <P>Check that <I>enteredPassword</I> encrypts to
-        * <I>encryptedPassword</I>.</P>
-        * @param encryptedPassword The <I>encryptedPassword</I>. The first
-        * two characters are assumed to be the salt. This string would
-        * be the same as one found in a Unix <U>/etc/passwd</U> file.
-        * @param enteredPassword The password as entered by the user (or
-        * otherwise aquired).
-        * @return <B>true</B> if the password should be considered correct.
-        */
-       public final static boolean matches(String encryptedPassword, String enteredPassword)
-       {
-               String salt = encryptedPassword.substring(0, 3);
-               String newCrypt = crypt(salt, enteredPassword);
-
-               return newCrypt.equals(encryptedPassword);
-       }
-}
-