Ravinder Reddy wrote:

    hi,
After working for a long time to reflect some structural changes suggested by John and some refinement , for any additional suggestions/comments I am sending a small (sample) fixture.

        public void testSchemaName() {
                try
                {
                         s.executeUpdate("set schema APP");
s.executeUpdate("DECLARE GLOBAL TEMPORARY TABLE APP.t2(c21 int)
on commit delete rows not logged");
fail("The qualifier for a declared global temporary table name
must be SESSION");

The first statement needs to be outside the try catch block as you are not expecting that to fail.

s.executeUpdate("set schema APP");
try
{
  s.executeUpdate("428EK"

etc.

Then there are utility methods for asserting a statement is expected to fail. See the various assert methods in BaseJDBCTestCase. Thus the code can be simply re-written as:

s.executeUpdate("set schema APP");
assertStatementError("428EK", s, "DECLARE GLOBAL TEMPORARY TABLE APP.t2(c21 int) on commit delete rows not logged");

The javadoc for assertStatementError says the sql is a query but it actually supports any SQL statement.

HTH,
Dan.


Reply via email to