DERBY-5823: Multi-row insert fails on table without generated keys with RETURN_GENERATED_KEYS

The fix contains two parts:

1. Don't collect generated keys if the statement does not actually
   generate key values. (This is the fix for the reported problem.)

2. Cache the array of generated key columns between executions. In the
   existing code, the array of key columns was created only on the
   first execution. Since it wasn't cached, it was null on all
   subsequent executions. When it is null, all columns are collected
   into the temporary row holder, which wastes space. Now, only the
   key columns are collected, also on re-execution.

The test case was contributed by Kristian Waagan.

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