DB2 Version 9.7 for Linux, UNIX, and Windows

SQLSetParam function (CLI) - Bind a parameter marker to a buffer or LOB locator

Deprecated

Note:

In ODBC 2.0 and above, SQLSetParam() is deprecated and replaced with SQLBindParameter().

Although this version of CLI continues to support SQLSetParam(), use SQLBindParameter() in your CLI programs so that they conform to the latest standards.

Equivalent function: SQLBindParameter()

The CLI function SQLBindParameter() is functionally the same as the SQLSetParam() function. Both take a similar number and type of arguments, behave the same, and return the same return codes. The difference is that SQLSetParam() does not have the InputOutputType or BufferLength arguments to specify the parameter type and maximum buffer length. Calling SQLSetParam() is functionally equivalent to calling SQLBindParameter() with the InputOutputType argument set to SQL_PARAM_INPUT and the BufferLength argument set to SQL_SETPARAM_VALUE_MAX.

Migrating to the new function

The statement:
   SQLSetParam(hstmt, 1, SQL_C_SHORT, SQL_SMALLINT, 0, 0,
               &parameter1, NULL);
for example, would be rewritten using the new function as:
   SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SHORT,
                    SQL_SMALLINT, 0, 0, &parameter1,
                    SQL_SETPARAM_VALUE_MAX, NULL);