[ 
https://issues.apache.org/jira/browse/DERBY-534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-534:
-------------------------------------

    Attachment: derby-534-13-a-dblook.diff

Attaching derby-534-13-a-dblook.diff which makes dblook show the WHEN clause 
for triggers that have one.

It changes DB_Trigger.doTriggers() so that it looks for the WHENCLAUSETEXT 
column when it scans SYS.SYSTRIGGERS.

Since the WHENCLAUSETEXT column is not present in soft-upgraded databases, 
dblook should not look for that column unless the data dictionary has been 
upgraded to 10.11. Instead of executing different queries against 
SYS.SYSTRIGGERS depending on whether or not the WHENCLAUSETEXT column is 
present, I changed the SELECT query to always fetch all column from 
SYS.SYSTRIGGERS (using {{SELECT *}}). I also changed the calls to ResultSet 
getter methods so that they referenced the columns by name instead of index, 
which makes it easier to understand them if you don't remember the order of the 
columns in the SYS.SYSTRIGGERS table.

For formatting of the WHEN clause I reused the logic that formats the triggered 
SQL statement. This means the WHEN clause inherits any bugs in that code, such 
as DERBY-6384.

The patch adds triggers with WHEN clauses to dblook_test and updates the test 
canons accordingly.

All regression tests ran cleanly with the patch.

> Support use of the WHEN clause in CREATE TRIGGER statements
> -----------------------------------------------------------
>
>                 Key: DERBY-534
>                 URL: https://issues.apache.org/jira/browse/DERBY-534
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Kristian Waagan
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>              Labels: derby_triage10_11
>         Attachments: derby-534-01-a-syntax.diff, 
> derby-534-02-a-refactor.diff, derby-534-03-a-npe-testcase.diff, 
> derby-534-04-a-referencing.diff, derby-534-05-a-generated-cols.diff, 
> derby-534-06-a-temptables.diff, derby-534-07-a-more-restrictions.diff, 
> derby-534-08-a-test-invalidation.diff, derby-534-09-a-drop-column-deps.diff, 
> derby-534-09-b-drop-column-deps.diff, derby-534-10-a-get-sps.diff, 
> derby-534-11-a-more-tests.diff, derby-534-12-a-subquery-npe.diff, 
> derby-534-13-a-dblook.diff, parser.diff, WhenClause.html, WhenClause.html, 
> WhenClause.html, WhenClause.html
>
>
> Support use of the WHEN clause in CREATE TRIGGER statements. The clause is 
> described in the SQL standard (2003) in chapter "11.39 <trigger definition>" 
> under "<triggered action>".
> There are traces in the code that suggests some work has been done on this 
> earlier. If anyone knows something about this, please add a comment to this 
> issue.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to