Use the Code section of the inline code statement to type statements that will retrieve data. Retrieval of data applies to SELECT SQL statements only.
SQLFetch ODBC API fetches rows and returns data for all bound columns.
/* To execute SQL (SELECT) query */ ret_code = SQLFetch(read_stmt.hstmt);
Now the host variables are ready to read. Check for the data availability of NULLABLE columns using the indicator variables. Indicator value -1 represents NULL, that is, there is no value for the corresponding column.
Place a cursor position on a row before reading data in result set.
/* To execute SQL (SELECT) query */
if (hstmt_rs.MoveNext()) {
hv_number = Globdata.GetDBMSData().GetDBMSManager().GetInt32(
IefRuntimeParm2, "IEFDB", read_rs.GetValue(0));
hv_name = Globdata.GetDBMSData().GetDBMSManager().GetString(
IefRuntimeParm2, "IEFDB", read_rs.GetValue(1));
hv_work_phone = Globdata.GetDBMSData().GetDBMSManager().GetString(
IefRuntimeParm2, "IEFDB", read_rs.GetValue(2));
hvind_work_phone = read_rs.IsNull(2);
}
Select an appropriate method to read the column data depending on the data type. Check for the data availability of NULLABLE columns using the IsNull method.
Note: Refer to Table 4 in Appendix section about retrieval methods for various Gen data types.
Place a cursor position on a row before reading data in result set.
/* To execute SQL (SELECT) query */
if (hstmt_rs.next()) {
hv_number = read_rs.getInt(1);
hv_name = globdata.getDBMSData().getDBMSManager().getStringFromResultSet(
"IEFDB", read_rs, 2);
hv_work_phone = globdata.getDBMSData().getDBMSManager().
getStringFromResultSet("IEFDB", read_rs, 3);
hvind_work_phone = read_rs.wasNull();
}
Select an appropriate method to read column data depending on the data type. Check for the data availability using the wasNull method.
Note: Refer to Table 5 in Appendix section about retrieval methods for various Gen data types.
|
Copyright © 2014 CA.
All rights reserved.
|
|