diff options
author | Barry Lind <barry@xythos.com> | 2002-07-23 03:59:55 +0000 |
---|---|---|
committer | Barry Lind <barry@xythos.com> | 2002-07-23 03:59:55 +0000 |
commit | 1e3187366ca96069e71527cf109198f645e14252 (patch) | |
tree | 4a962e3adecaeb680f4366c611af5ceaca763944 /src/interfaces/jdbc/org/postgresql/util/Serialize.java | |
parent | e9c013f4bddd953df03be74177a37016d1e22b96 (diff) | |
download | postgresql-1e3187366ca96069e71527cf109198f645e14252.tar.gz |
Initial restructuring to add jdbc3 support. There was a significant amount
of duplicated code between the jdbc1 and jdbc2. This checkin restructures
the code so that the duplication is removed so that the jdbc3 support
can be added without adding yet another copy of everything. Also many
classes were renamed to avoid confusion with multiple different objects
having the same name. The timestamp tests were also updated to add support
for testing timestamp without time zone in addition to timestamp with time zone
Modified Files:
jdbc/Makefile jdbc/build.xml jdbc/example/ImageViewer.java
jdbc/example/basic.java jdbc/example/blobtest.java
jdbc/example/threadsafe.java
jdbc/org/postgresql/Driver.java.in
jdbc/org/postgresql/Field.java
jdbc/org/postgresql/core/QueryExecutor.java
jdbc/org/postgresql/fastpath/Fastpath.java
jdbc/org/postgresql/jdbc1/CallableStatement.java
jdbc/org/postgresql/jdbc1/DatabaseMetaData.java
jdbc/org/postgresql/jdbc1/PreparedStatement.java
jdbc/org/postgresql/jdbc2/Array.java
jdbc/org/postgresql/jdbc2/CallableStatement.java
jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
jdbc/org/postgresql/jdbc2/PreparedStatement.java
jdbc/org/postgresql/jdbc2/UpdateableResultSet.java
jdbc/org/postgresql/largeobject/LargeObjectManager.java
jdbc/org/postgresql/largeobject/PGblob.java
jdbc/org/postgresql/largeobject/PGclob.java
jdbc/org/postgresql/test/jdbc2/BlobTest.java
jdbc/org/postgresql/test/jdbc2/ConnectionTest.java
jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
jdbc/org/postgresql/test/jdbc2/TimestampTest.java
jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java
jdbc/org/postgresql/util/Serialize.java
Added Files:
jdbc/org/postgresql/PGConnection.java
jdbc/org/postgresql/PGStatement.java
jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
jdbc/org/postgresql/jdbc1/Jdbc1Connection.java
jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java
jdbc/org/postgresql/jdbc1/Jdbc1Statement.java
jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java
jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
jdbc/org/postgresql/jdbc2/Jdbc2Connection.java
jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java
jdbc/org/postgresql/jdbc2/Jdbc2Statement.java
Removed Files:
jdbc/org/postgresql/Connection.java
jdbc/org/postgresql/ResultSet.java
jdbc/org/postgresql/Statement.java
jdbc/org/postgresql/jdbc1/Connection.java
jdbc/org/postgresql/jdbc1/ResultSet.java
jdbc/org/postgresql/jdbc1/Statement.java
jdbc/org/postgresql/jdbc2/Connection.java
jdbc/org/postgresql/jdbc2/ResultSet.java
jdbc/org/postgresql/jdbc2/Statement.java
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/util/Serialize.java')
-rw-r--r-- | src/interfaces/jdbc/org/postgresql/util/Serialize.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/util/Serialize.java b/src/interfaces/jdbc/org/postgresql/util/Serialize.java index 80d10bc541..f1f12520ba 100644 --- a/src/interfaces/jdbc/org/postgresql/util/Serialize.java +++ b/src/interfaces/jdbc/org/postgresql/util/Serialize.java @@ -109,7 +109,7 @@ import java.sql.*; public class Serialize { // This is the connection that the instance refers to - protected org.postgresql.Connection conn; + protected Connection conn; // This is the table name protected String tableName; @@ -124,7 +124,7 @@ public class Serialize * This creates an instance that can be used to serialize or deserialize * a Java object from a PostgreSQL table. */ - public Serialize(org.postgresql.Connection c, String type) throws SQLException + public Serialize(Connection c, String type) throws SQLException { try { @@ -142,7 +142,7 @@ public class Serialize // Second check, the type must be a table boolean status = false; - ResultSet rs = conn.ExecSQL("select typname from pg_type,pg_class where typname=relname and typname='" + tableName + "'"); + ResultSet rs = ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).ExecSQL("select typname from pg_type,pg_class where typname=relname and typname='" + tableName + "'"); if (rs != null) { if (rs.next()) @@ -164,7 +164,7 @@ public class Serialize /* * Constructor when Object is passed in */ - public Serialize(org.postgresql.Connection c, Object o) throws SQLException + public Serialize(Connection c, Object o) throws SQLException { this(c, o.getClass().getName()); } @@ -172,7 +172,7 @@ public class Serialize /* * Constructor when Class is passed in */ - public Serialize(org.postgresql.Connection c, Class cls) throws SQLException + public Serialize(Connection c, Class cls) throws SQLException { this(c, cls.getName()); } @@ -221,7 +221,7 @@ public class Serialize sb.append(oid); if (Driver.logDebug) Driver.debug("Serialize.fetch: " + sb.toString()); - ResultSet rs = conn.ExecSQL(sb.toString()); + ResultSet rs = ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).ExecSQL(sb.toString()); if (rs != null) { @@ -390,7 +390,7 @@ public class Serialize } if (Driver.logDebug) Driver.debug("Serialize.store: " + sb.toString() ); - org.postgresql.ResultSet rs = (org.postgresql.ResultSet) conn.ExecSQL(sb.toString()); + ResultSet rs = ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).ExecSQL(sb.toString()); // fetch the OID for returning if (update) @@ -403,7 +403,7 @@ public class Serialize else { // new record inserted has new oid; rs should be not null - long newOID = ((org.postgresql.ResultSet)rs).getLastOID(); + long newOID = ((org.postgresql.jdbc1.AbstractJdbc1ResultSet)rs).getLastOID(); rs.close(); // update the java object's oid field if it has the oid field if (hasOID) @@ -472,7 +472,7 @@ public class Serialize * @param o Object to base table on * @exception SQLException on error */ - public static void create(org.postgresql.Connection con, Object o) throws SQLException + public static void create(Connection con, Object o) throws SQLException { create(con, o.getClass()); } @@ -485,7 +485,7 @@ public class Serialize * @param o Class to base table on * @exception SQLException on error */ - public static void create(org.postgresql.Connection con, Class c) throws SQLException + public static void create(Connection con, Class c) throws SQLException { if (c.isInterface()) throw new PSQLException("postgresql.serial.interface"); @@ -493,7 +493,7 @@ public class Serialize // See if the table exists String tableName = toPostgreSQL(c.getName()); - ResultSet rs = con.ExecSQL("select relname from pg_class where relname = '" + tableName + "'"); + ResultSet rs = ((org.postgresql.jdbc1.AbstractJdbc1Connection)con).ExecSQL("select relname from pg_class where relname = '" + tableName + "'"); if ( rs.next() ) { if (Driver.logDebug) Driver.debug("Serialize.create: table " + tableName + " exists, skipping"); @@ -549,7 +549,7 @@ public class Serialize // Now create the table if (Driver.logDebug) Driver.debug("Serialize.create: " + sb ); - con.ExecSQL(sb.toString()); + ((org.postgresql.jdbc1.AbstractJdbc1Connection)con).ExecSQL(sb.toString()); } // This is used to translate between Java primitives and PostgreSQL types. |