When a Unicode application calls
SQLBindParameter in an ANSI driver, the ODBC Driver Manager does not immediately convert the Unicode parameter data to ANSI. The Driver Manager does an in-place conversion to ANSI only during the call to
SQLExecute or
SQLExecDirect, and then immediately converts the parameters back to Unicode. This is how the Driver Manager handles compatibility between Unicode applications and ANSI drivers.
It is risky if the ANSI driver saves this parameter data while it is still in Unicode format (before the
SQLExecute or
SQLExecDirect call) and then tries to use it later.
As per the ODBC specification, the
ParameterValuePtr, which is one of the input parameters to the
SQLBindParameter, is defined as follows:
The ParameterValuePtr argument points to a buffer that, when SQLExecute or SQLExecDirect is called, contains the actual data for the parameter.