%SSC_BIND
Bind host variables for non-SELECT statement
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
value = %SSC_BIND(dbchannel, stcursor, numvars, var[, ...])
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)
stcursor
The ID number of an open statement cursor (opened with %SSC_OPEN). This must be in the range 1 through the number specified by maxcur when the database channel was initialized (with %SSC_INIT). (n)
numvars
The number of bind variables in the non-SELECT statement, up to the maximum number of columns specified by the maxcol argument in %SSC_INIT. If numvars is negative, the bind variables are overwritten rather than appended. If numvars is positive, the bind variables are appended to the variables for the non-SELECT statement. (n)
var
Host variable(s) to be bound to the non-SELECT statement parameter. The number of var variables passed must equal the value of numvars. (a, n, or String)
Discussion
%SSC_BIND binds host variables to variables for a non-SELECT statement. It affects only variables that are used when %SSC_EXECUTE is called. See Binding data for more information on binding, and note the following:
- The total number of bind variables defined with %SSC_BIND must match the number of columns in the non-SELECT statement. For example, if there are 20 host variables in an UPDATE statement, you could use one %SSC_BIND call to append definitions for all 20 variables, or two %SSC_BIND calls with 10 variables each, or any other combination, as long as the number of variables defined by %SSC_BIND exactly matches the number of variables described by %SSC_OPEN in the non-SELECT statement before %SSC_EXECUTE is called.
- The String data type (System.String) is not supported for var for array-based operations.
- If you use ^VARARGARRAY, note that numvars is the last declared argument for this routine.
Examples
The following example shows how to bind two Synergy DBL variables associated with cur1.
record order_rec ord_num ,d6 ord_cust ,d6 . . . sqlp = "UPDATE orders SET or_number = :1 WHERE or_customer = :2 if (%ssc_open(dbchn, cur1, sqlp, SSQL_NONSEL)) goto err_exit if (%ssc_bind(dbchn, cur1, 2, ord_num, ord_cust)) goto err_exit if (%ssc_execute(dbchn, cur1, 1)) goto err_exit