Group: ODBC API - Library: odbc32
SQLNativeSql returns the SQL string as modified by the driver. SQLNativeSql does not execute the SQL statement.
Using vendor-neutral SQL constructs
SQLRETURN SQLNativeSql(
SQLHDBC ConnectionHandle,
SQLCHAR * InStatementText,
SQLINTEGER TextLength1,
SQLCHAR * OutStatementText,
SQLINTEGER BufferLength,
SQLINTEGER * TextLength2Ptr);
DECLARE SHORT SQLNativeSql IN odbc32;
INTEGER ConnectionHandle,;
STRING InStatText,;
INTEGER TextLen1,;
STRING @ OutStatText,;
INTEGER BufferLen,;
INTEGER @ TextLen2Ptr
ConnectionHandle [Input] Connection handle.
InStatementText [Input] SQL text string to be translated.
TextLength1 [Input] Length of *InStatementText text string.
OutStatementText [Output] Pointer to a buffer in which to return the translated SQL string.
BufferLength [Input] Length of the *OutStatementText buffer.
TextLength2Ptr [Output] Pointer to a buffer in which to return the total number of bytes (excluding the null-termination byte) available to return in *OutStatementText.
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.
Not all ODBC drivers support this function. As well not all of them support escape sequences. Both are supported by MS Access (MSDAO) and MS SQL Server. To my disappointment I found this functionality not supported by Visual FoxPro ODC driver (ver. 6.01.8629.01)
SQLNativeSql returns the SQL string as modified by the driver. SQLNativeSql does not execute the SQL statement..
Some links on vendor-neutral constructs:
Escape Sequences in ODBC
Using Interoperable SQL. By Ken North