DERBY-4160: getMetaData().getIndexInfo crashes with "ERROR X0Y68: Column 'PARAM1' already exists."

Use a shared code path for adding parameters to SYS.SYSCOLUMNS on the
first compilation and subsequent compilations of a meta-data query.
Previously, the first compilation took a different code path, but that
caused problems if two threads compiled a meta-data query at the same
time, and both threads thought they were first.

Set a savepoint before attempting to write a stored prepared statement
to the system tables in a nested transaction, and roll back to the
savepoint if an error happens. This prevents partially stored prepared
statements from lying around in the system tables after an error.

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