%SSC_RELEASE

Release a database channel

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
value = %SSC_RELEASE(dbchannel[, force_release])

value

This function returns SSQL_NORMAL (success) or SSQL_FAILURE (failure). (i)

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)

%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.

These options can be overridden by passing force_release as a non-zero value:

%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.

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