LP#1847805: Use WITHOUT HOLD cursor
authorMike Rylander <mrylander@gmail.com>
Thu, 20 Feb 2020 15:43:22 +0000 (10:43 -0500)
committerMike Rylander <mrylander@gmail.com>
Thu, 20 Feb 2020 19:43:41 +0000 (14:43 -0500)
commit016009f63448e9f724ce619a0fd3c775acd9d144
treea98043497534de294ddb3e8b5ce58c579aa0a846
parenta455f7c3e883fd8f46c12177e7732809b3267fae
LP#1847805: Use WITHOUT HOLD cursor

If we're not inside an explicit transaction, we start one ourselves so
that we can use WITHOUT HOLD cursors.  Unfortunately, WITH HOLD cursors
can create large temp files which may be an attack vector.

The commit also includes leak avoidance for the cursor_name string.  It
is now a single global variable, which is safe in the current code
because fleshing sub-calls occur after the full set of results are
retrieved at the current level, allowing any implicit transaction to be
closed.

NOTE: Using cursors could allow us to interleve fleshing sub-calls which
could allow a faster TTFB, but cursor names would need to live on the
stack rather than be the new single global.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/c-apps/oils_sql.c