skip to main content
Supported SQL Functionality : Data Definition Language (DDL) : Native and Refresh Escape Clauses
  

Try DataDirect Drivers Now

Native and Refresh Escape Clauses

The driver supports ODBC-native-escape and ODBC-refresh-schema-escape clauses to embed data store-specific commands in SQL-92 statements. The ODBC-native-escape clause allows you to execute native commands directly through the client application, while the ODBC-refresh-schema-escape clause is used to incorporate any changes introduced by the ODBC-native-escape clause into the driver's relational map of the data.
Note: The native and refresh escape clauses are mainly intended for the execution of DDL commands, such as ALTER, CREATE, and DROP. A returning clause for the native escape is not currently supported by the driver. Therefore, results cannot be retrieved using the native escape clause.
The ODBC-native-escape clause is defined as follows:
ODBC-native-escape ::= ODBC-esc-initiator native (command_text)}
where:
command_text
is a data store-specific command.
The ODBC-refresh-schema-escape clause is defined as follows:
ODBC-refresh-schema-escape ::= ODBC-esc-initiator refresh ODBC-esc-terminator
The following example shows the execution of two data store-specific commands with a refresh of the driver's relational map of the data. Note that each Native escape clause must have its own execute. The Refresh escape, however, can be used in the same execute statement as the Native escape.
SQLExecDirect(
pstmt,
"{native (CREATE TABLE emp (empid int primary key, title varchar))}",
SQL_NTS);
SQLExecDirect(
pstmt,
"{native (CREATE TABLE dept (deptid int primary key, city varchar))}{refresh}",
SQL_NTS);