From d634a5903f615a45cb463155c04d3df904e1b91a Mon Sep 17 00:00:00 2001 From: Barry Lind Date: Wed, 11 Sep 2002 05:38:45 +0000 Subject: Patches submitted by Kris Jurka (jurka@ejurka.com) for the following bugs: - Properly drop tables in jdbc regression tests with cascade for 7.3 - problem with Statement.execute() and executeUpdate() not clearing binds - problem with ResultSet not correctly handling default encoding - changes to correctly support show transaction isolation level in 7.3 - changed DatabaseMetaDataTest to handle differences in FK names in 7.3 - better fix for dynamically checking server NAME data length (With the fixes above the jdbc regression tests pass on jdbc2 and jdbc3 against both a 7.2 and 7.3 server) Patchs submitted by David Wall (d.wall@computer.org): - problem with getBlob when largeobject oid is null - improvements to BlobOutputStream Patch submitted by Haris Peco (snpe@snpe.co.yu): - problem with callable statement not supporting prepared statement methods Modified Files: jdbc/org/postgresql/Driver.java.in jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java jdbc/org/postgresql/largeobject/BlobOutputStream.java jdbc/org/postgresql/largeobject/LargeObject.java jdbc/org/postgresql/test/TestUtil.java jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java jdbc/org/postgresql/test/jdbc2/UpdateableResultTest.java jdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java jdbc/org/postgresql/test/jdbc2/optional/SimpleDataSourceTest.java --- src/interfaces/jdbc/org/postgresql/test/TestUtil.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/interfaces/jdbc/org/postgresql/test/TestUtil.java') diff --git a/src/interfaces/jdbc/org/postgresql/test/TestUtil.java b/src/interfaces/jdbc/org/postgresql/test/TestUtil.java index a9f9dfdf3f..fc8dc70deb 100644 --- a/src/interfaces/jdbc/org/postgresql/test/TestUtil.java +++ b/src/interfaces/jdbc/org/postgresql/test/TestUtil.java @@ -109,11 +109,26 @@ public class TestUtil Statement stmt = con.createStatement(); try { - stmt.executeUpdate("DROP TABLE " + table); + String sql = "DROP TABLE " + table; + if (con instanceof org.postgresql.jdbc1.AbstractJdbc1Connection && ((org.postgresql.jdbc1.AbstractJdbc1Connection)con).haveMinimumServerVersion("7.3")) { + sql += " CASCADE "; + } + stmt.executeUpdate(sql); } catch (SQLException ex) { - // ignore + // 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) -- cgit v1.2.1