Index: src/interfaces/jdbc/org/postgresql/test/JDBC2Tests.java =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/test/JDBC2Tests.java,v retrieving revision 1.5 diff -c -r1.5 JDBC2Tests.java *** src/interfaces/jdbc/org/postgresql/test/JDBC2Tests.java 2001/09/06 03:11:59 1.5 --- src/interfaces/jdbc/org/postgresql/test/JDBC2Tests.java 2001/09/06 21:30:35 *************** *** 59,107 **** } } ! /** ! * Helper - creates a test table for use by a test ! */ ! public static void createTable(Connection conn,String columns) { ! try { ! Statement st = conn.createStatement(); ! ! // Ignore the drop ! try { ! st.executeUpdate("drop table "+getTableName()); ! } catch(SQLException se) { ! } ! ! // Now create the table ! st.executeUpdate("create table "+getTableName()+" ("+columns+")"); ! ! st.close(); ! } catch(SQLException ex) { ! TestCase.assert(ex.getMessage(),false); ! } ! } ! ! /** ! * Variant used when more than one table is required ! */ ! public static void createTable(Connection conn,String id,String columns) { ! try { ! Statement st = conn.createStatement(); ! ! // Ignore the drop ! try { ! st.executeUpdate("drop table "+getTableName(id)); ! } catch(SQLException se) { ! } ! ! // Now create the table ! st.executeUpdate("create table "+getTableName(id)+" ("+columns+")"); ! ! st.close(); ! } catch(SQLException ex) { ! TestCase.assert(ex.getMessage(),false); ! } ! } /** * Helper - generates INSERT SQL - very simple --- 59,96 ---- } } ! /** ! * Helper - creates a test table for use by a test ! */ ! public static void createTable( ! Connection conn, String table, String columns) { ! try { ! Statement st = conn.createStatement(); ! try { ! try { ! st.executeUpdate("drop table " + table); ! } catch(SQLException se) { ! // Intentionally ignore exception ! } ! ! // Now create the table ! st.executeUpdate( "create table " + table + " (" + columns + ! ")" ); ! } finally { ! st.close(); ! } ! } catch(SQLException ex) { ! TestCase.assert(ex.getMessage(),false); ! } ! } ! ! // Create the test table whose name is passed via the properties ! // (see ../../../build.xml). It appears that the original author of ! // this test suite intended to specify all test table names via the ! // properties, but this was never fully implemented. ! public static void createTable(Connection conn, String columns) { ! createTable(conn, getTableName(), columns); ! } /** * Helper - generates INSERT SQL - very simple Index: src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java,v retrieving revision 1.2 diff -c -r1.2 ConnectionTest.java *** src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java 2001/02/13 16:39:05 1.2 --- src/interfaces/jdbc/org/postgresql/test/jdbc2/ConnectionTest.java 2001/09/06 21:30:35 *************** *** 22,27 **** --- 22,51 ---- super(name); } + // Set up the fixture for this testcase: the tables for this test. + protected void setUp() throws Exception { + Connection con = JDBC2Tests.openDB(); + + JDBC2Tests.createTable( con, "test_a", + "imagename name,image oid,id int4" ); + + JDBC2Tests.createTable( con, "test_c", + "source text,cost money,imageid int4" ); + + JDBC2Tests.closeDB(con); + } + + // Tear down the fixture for this test case. + protected void tearDown() throws Exception { + Connection con = JDBC2Tests.openDB(); + Statement stmt = con.createStatement(); + + stmt.executeUpdate("DROP TABLE test_a"); + stmt.executeUpdate("DROP TABLE test_c"); + stmt.close(); + JDBC2Tests.closeDB(con); + } + /** * Tests the two forms of createStatement() */ *************** *** 234,237 **** assert(ex.getMessage(),false); } } ! } \ No newline at end of file --- 258,261 ---- assert(ex.getMessage(),false); } } ! } Index: src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java,v retrieving revision 1.1 diff -c -r1.1 JBuilderTest.java *** src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java 2001/02/13 16:39:05 1.1 --- src/interfaces/jdbc/org/postgresql/test/jdbc2/JBuilderTest.java 2001/09/06 21:30:35 *************** *** 18,23 **** --- 18,43 ---- super(name); } + // Set up the fixture for this testcase: the tables for this test. + protected void setUp() throws Exception { + Connection con = JDBC2Tests.openDB(); + + JDBC2Tests.createTable( con, "test_c", + "source text,cost money,imageid int4" ); + + JDBC2Tests.closeDB(con); + } + + // Tear down the fixture for this test case. + protected void tearDown() throws Exception { + Connection con = JDBC2Tests.openDB(); + Statement stmt = con.createStatement(); + + stmt.executeUpdate("DROP TABLE test_c"); + stmt.close(); + JDBC2Tests.closeDB(con); + } + /** * This tests that Money types work. JDBCExplorer barfs if this fails. */