%SSC_RELEASE
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
value = %SSC_RELEASE(dbchannel[, force_release])
Return value
value
This function returns SSQL_NORMAL (success) or SSQL_FAILURE (failure). (i)
Arguments
dbchannel
An internal database channel previously initialized using %SSC_INIT and connected by %SSC_CONNECT. (n)
force_release
(optional) Overrides the %SSC_CMD options SSQL_CACHE_CHAIN and SSQL_CACHE_CONNECTION when passed as non-zero. (n)
Discussion
%SSC_RELEASE closes all cursors, rolls back pending transactions, and frees the database channel number. It also closes the associated database connection unless one of the following %SSC_CMD options is set. Note that these options are available only on Windows and UNIX.
- SSQL_CACHE_CHAIN—This option instructs %SSC_RELEASE to cache connections and preserves the cache when chaining to other programs.
- SSQL_CACHE_CONNECTION—This option also instructs %SSC_RELEASE to cache connections, but preserves the cache only for the life of the current program. Cached connections are closed when chaining to other programs.
These options can be overridden by passing force_release as a non-zero value:
- If force_release is passed as non-zero, %SSC_RELEASE closes connections, regardless of SSQL_CACHE_CHAIN or SSQL_CACHE_CONNECTION settings.
- If force_release is not passed or is passed as zero, %SSC_RELEASE caches connections if either option is in force.
%SSC_RELEASE should be the last function call for a database channel unless you want to keep the connection open (not cached) across a chain of applications. In this case, use %SSC_CMD and set the SSQL_KEEP_OPEN option, which is available only on Windows and UNIX.
After a call to %SSC_RELEASE, a call to %SSC_INIT must be issued prior to a call to %SSC_CONNECT. Every call to %SSC_CONNECT should be paired with calls to %SSC_RELEASE and %SSC_INIT.
Examples
The following code segment demonstrates how to release connections when multiple connections have been made.
if (%ssc_connect(dbchn, user)) goto err_exit if (%ssc_connect(dbchn1, user)) goto err_exit . . . if (%ssc_release(dbchn1)) begin sts = %ssc_getemsg(dbchn1, msg, len) if (len) writes(1, "DB1: " + msg(1,len)) else writes(1, "DB1: Release failed - No error message available.") sts = %ssc_release(dbchn1) end . . . if (%ssc_release(dbchn)) begin sts = %ssc_getemsg(dbchn, msg, len) if (len) writes(1, "DB0:" + msg(1,len)) else writes(1, "DB0: Release failed - No error message available.") sts = %ssc_release(dbchn) end