Derby
  1. Derby
  2. DERBY-2536

Convert lang/procedureInTrigger.sql to JUnit

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.3.1.4
    • Fix Version/s: 10.3.1.4
    • Component/s: Test
    • Labels:
      None

      Description

      Convert lang/procedureInTrigger.sql to JUnit

        Activity

        Hide
        Kathey Marsden added a comment -

        This test has a case where it needs to count the number of executions of a NO SQL procedure in a trigger.
        This was tested with a System.out.println statement in the old SQL test, e.g.

        public static void zeroArg()

        { System.out.println("zeroArg() called"); }

        The sql is a follows:

        create procedure proc_no_sql() parameter style java language java NO SQL external name 'org.apache.derbyTesting.functionTests.tests.lang.ProcedureInTriggerTest.zeroArg

        create trigger after_stmt_trig_no_sql AFTER insert on t2 for each STATEMENT call proc_no_sql()

        insert into t2 values (1,2), (2,4);

        I want to check that zeroArg was called only once but can't figure out how to do it without adding sql to insert into a table. Any thoughts on this?

        Show
        Kathey Marsden added a comment - This test has a case where it needs to count the number of executions of a NO SQL procedure in a trigger. This was tested with a System.out.println statement in the old SQL test, e.g. public static void zeroArg() { System.out.println("zeroArg() called"); } The sql is a follows: create procedure proc_no_sql() parameter style java language java NO SQL external name 'org.apache.derbyTesting.functionTests.tests.lang.ProcedureInTriggerTest.zeroArg create trigger after_stmt_trig_no_sql AFTER insert on t2 for each STATEMENT call proc_no_sql() insert into t2 values (1,2), (2,4); I want to check that zeroArg was called only once but can't figure out how to do it without adding sql to insert into a table. Any thoughts on this?
        Hide
        Kathey Marsden added a comment -

        I have the same issue of not being able to verify calls for "CONTAINS SQL" and "READ SQL DATA". CONTAINS SQL is particularly curious. It says "Indicates that SQL statements that neither read nor modify SQL data can be executed by the stored procedure" I wonder what kind of SQL Statement would neither read nor write data. The existing test has only getConnection() for CONTAINS SQL.

        Show
        Kathey Marsden added a comment - I have the same issue of not being able to verify calls for "CONTAINS SQL" and "READ SQL DATA". CONTAINS SQL is particularly curious. It says "Indicates that SQL statements that neither read nor modify SQL data can be executed by the stored procedure" I wonder what kind of SQL Statement would neither read nor write data. The existing test has only getConnection() for CONTAINS SQL.
        Hide
        Kathey Marsden added a comment -

        I found a solution to the problem of verifying procedure calls. It seems to work to increment a static variable in the stored procedure, then check and reset it after it is called by the trigger.

        Show
        Kathey Marsden added a comment - I found a solution to the problem of verifying procedure calls. It seems to work to increment a static variable in the stored procedure, then check and reset it after it is called by the trigger.

          People

          • Assignee:
            Kathey Marsden
            Reporter:
            Kathey Marsden
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development