DERBY-534: Support use of the WHEN clause in CREATE TRIGGER statements

Fix incorrect null check when merging subqueryTrackingArray and
materializedSubqueries in GenericStatementContext.setTopResultSet().
Used to cause NullPointerException in some cases when a WHEN clause
contained a subquery.

Add more tests for scalar subqueries in WHEN clauses.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1532666 13f79535-47bb-0310-9956-ffa450edef68