The following are the types of variables:
Follow these steps:
They facilitate executing ODBC/JDBC statements. Use the Global Variable Declarations section of the inline code statement.
The Global Variable Declarations fields lets you specify any variables that you need to define globally within the action diagram that may be used by multiple Inline Code statements.
/* To execute SQL (INSERT) query */
static TIHSTMT create_stmt = {SQL_NULL_HSTMT, NULL};
static RETCODE ret_code = 0;
/* To execute SQL (SELECT) query*/
static TIHSTMT read_stmt = {SQL_NULL_HSTMT, NULL};
static RETCODE ret_code = 0;
/* To execute SQL (UPDATE) query*/
static TIHSTMT update_stmt = {SQL_NULL_HSTMT, NULL};
static RETCODE ret_code = 0;
/* To execute SQL (INSERT) query */ IAbstractCommand create_cmd; IAbstractResultSet create_rs; Exception sql_ex = null; /* To execute SQL (SELECT) query*/ IAbstractCommand read_cmd; IAbstractResultSet read_rs; Exception sql_ex = null; /* To execute SQL (UPDATE) query*/ IAbstractCommand update_cmd; IAbstractResultSet update_rs; Exception sql_ex = null;
/* To execute SQL (INSERT) query */ PreparedStatement create_cmd; ResultSet create_rs; Exception sql_ex = null; /* To execute SQL (SELECT) query */ PreparedStatement read_cmd; ResultSet read_rs; Exception sql_ex = null; /* To execute SQL (UPDATE) query */ PreparedStatement update_cmd; ResultSet update_rs; Exception sql_ex = null;
They will be used to bind either columns or parameters while constructing the SQL statement. Use either of the declaration sections of the Inline Code statement because no pre-compilation is required to process the ODBC / ADO.NET / JDBC SQL declarations.
The SQL Declaration field lets you specify any host variables that may be needed by the Inline Code statement especially containing embedded SQL statements. They are collected separately from the Inline Code statement so that they may be included in the EXEC SQL DECLARE section of the generated code. These variables are used with SQL statements to retrieve information from the database or add information to the database. To enable this field, select the SQL option on the dialog.
Note: Even though you may have entity action views defined in the action diagram, the host variables generated for those views are not accessible to the Inline Code statement.
static SDWORD hv_number; static UCHAR FAR hv_name[31]; static UCHAR FAR hv_work_phone[17]; static SQLLEN hvind_work_phone;
int hv_number; string hv_name; string hv_work_phone; bool hvind_work_phone;
int hv_number; String hv_name; String hv_work_phone; boolean hvind_work_phone;
Use the following native data types for declaring host variables corresponding to available GEN types.
|
Gen Data Type |
Native Data Type |
|---|---|
|
TEXT |
static UCHAR FAR[] |
|
NUMBER (with precision enabled) |
static UCHAR FAR[] |
|
DATE |
static DATE_STRUCT |
|
TIME |
static TIMESTAMP_STRUCT |
|
TIMESTAMP |
static TIMESTAMP_STRUCT |
|
BLOB |
<none> |
|
Gen Data Type |
Native Data Type |
|---|---|
|
TEXT |
string |
|
NUMBER |
short int double |
|
NUMBER (with precision enabled) |
decimal |
|
DATE |
DateTime |
|
TIME |
DateTime |
|
TIMESTAMP |
DateTime |
|
BLOB |
byte[] |
|
Gen Data Type |
Native Data Type |
|---|---|
|
TEXT |
String |
|
NUMBER |
short int double |
|
NUMBER (with precision enabled) |
BigDecimal |
|
DATE |
java.sql.Date |
|
TIME |
java.sql.Time |
|
TIMESTAMP |
java.sql.Timestamp |
|
BLOB |
byte[] |
|
Copyright © 2014 CA.
All rights reserved.
|
|