try { catalog.run("ttq-drop-table"); } catch (ProcException e) {  }
    public void testTableQueries() throws Exception {        try {            catalog.run("ttq-drop-table");        } catch (ProcException e) {            // ignore        }        catalog.run("ttq-create-table");        catalog.run("ttq-create-data");        // queries for zero rows        rs = catalog.query("ttq-q-no-rows-get-zero");        assertNull(rs);        try {            rs = catalog.query("ttq-q-no-rows-get-one");            fail("query should throw exception");        } catch (ProcException e) {            assertTrue(e instanceof TooManyRowsException);        }        try {            rs = catalog.query("ttq-q-no-rows-get-many");            fail("query should throw exception");        } catch (ProcException e) {            assertTrue(e instanceof TooManyRowsException);        }        // queries for zero or one row        rs = catalog.query("ttq-q-zero-or-one-rows-get-zero");        assertNull(rs);        rs = catalog.query("ttq-q-zero-or-one-rows-get-one");        assertNotNull(rs);        if (rs != null) {            assertEquals(1, rs.getInt(1));            assertEquals("mhw", rs.getString(2));            rs.close();        }        try {            rs = catalog.query("ttq-q-zero-or-one-rows-get-many");            assertEquals(1, rs.getInt(1));            rs.next();            fail("query should throw exception");        } catch (SQLException e) {            assertTooManyRows(e);        } finally {            rs.close();        }        try {            rs = catalog.query("ttq-q-zero-or-one-rows-get-many");            assertNotNull(rs);            if (rs != null) {                assertEquals(1, rs.getInt(1));                assertEquals("mhw", rs.getString(2));                rs.close();            }            fail("query should throw exception");        } catch (SQLException e) {            assertTooManyRows(e);        }        // queries for one row        try {            rs = catalog.query("ttq-q-one-row-get-zero");            fail("query should throw exception");        } catch (ProcException e) {            assertTrue(e instanceof TooFewRowsException);        }        rs = catalog.query("ttq-q-one-row-get-one");        assertEquals(1, rs.getInt(1));        assertEquals("mhw", rs.getString(2));        assertFalse(rs.next());        rs.close();        rs = catalog.query("ttq-q-one-row-get-many");        assertEquals(1, rs.getInt(1));        assertEquals("mhw", rs.getString(2));        try {            rs.close();            fail("close should throw exception");        } catch (SQLException e) {            assertTooManyRows(e);        }        rs = catalog.query("ttq-q-one-row-get-many");        assertEquals(1, rs.getInt(1));        assertEquals("mhw", rs.getString(2));        try {            rs.next();            fail("next should throw exception");        } catch (SQLException e) {            assertTooManyRows(e);        }        rs.close();        // queries for one or more rows        try {            rs = catalog.query("ttq-q-one-or-more-rows-get-zero");            fail("query should throw exception");        } catch (ProcException e) {            assertTrue(e instanceof TooFewRowsException);        }        rs = catalog.query("ttq-q-one-or-more-rows-get-one");        assertEquals(1, rs.getInt(1));        assertEquals("mhw", rs.getString(2));        assertFalse(rs.next());        rs.close();        rs = catalog.query("ttq-q-one-or-more-rows-get-many");        assertEquals(1, rs.getInt(1));        assertEquals("mhw", rs.getString(2));        assertTrue(rs.next());        assertEquals(2, rs.getInt(1));        assertEquals("fred", rs.getString(2));        assertTrue(rs.next());        assertEquals(42, rs.getInt(1));        assertEquals("answer", rs.getString(2));        assertFalse(rs.next());        rs.close();        // queries for zero or more rows        rs = catalog.query("ttq-q-zero-or-more-rows-get-zero");        assertNull(rs);        rs = catalog.query("ttq-q-zero-or-more-rows-get-one");        assertEquals(1, rs.getInt(1));        assertEquals("mhw", rs.getString(2));        assertFalse(rs.next());        rs.close();        rs = catalog.query("ttq-q-zero-or-more-rows-get-many");        assertEquals(1, rs.getInt(1));        assertEquals("mhw", rs.getString(2));        assertTrue(rs.next());        assertEquals(2, rs.getInt(1));        assertEquals("fred", rs.getString(2));        assertTrue(rs.next());        assertEquals(42, rs.getInt(1));        assertEquals("answer", rs.getString(2));        assertFalse(rs.next());        rs.close();        catalog.run("ttq-drop-table");    }