Host variables

Host variables are data items declared in a host application program and used in both host language statements and embedded SQL statements. They provide communication between SQL statements and the host language statements. An input host variable transfers data from a host language program to an SQL/MX database, and an output host variable transfers data from a database to the program. A host variable is a C variable with a data type that corresponds to an SQL data type.
    You use host variables to provide communication between C and SQL statements and to receive data from a database or to insert data into a database. When you specify a host variable in an SQL statement, precede the host variable name with a colon (:). In C statements, you do not need the colon, as shown:
EXEC SQL SELECT column1 INTO :host_variable1 FROM =table
WHERE column1 > :host_variable2;
strcpy(new_name, host_variable1);

 





posted @ 2015-06-30 18:17  ECNB  阅读(315)  评论(0编辑  收藏  举报