Example: lrd_oci8_to_oci7

The following example shows how both OCI 8 and OCI 7 functions are recorded within a script. First, lrd_server_attach opens an OCI 8 connection to a server using the OCI 8 service context handle, OraSvc1. The function lrd_open_connection then opens a new connection to deal with the OCI 7 functions that follow. However, lrd_open_connection has now been commented out and lrd_oci8_to_oci7 is substituted to convert the connection, Con1, to be able to handle the OCI 7 calls. Note that the subsequent OCI 8 functions (e.g., lrd_ora8_stmt) are unaffected by the modification of the connection.

lrd_init(&InitInfo, DBTypeVersion);
lrd_initialize_db(LRD_DBTYPE_ORACLE, 2, 0);
lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
 /* ORA 8 calls */
lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);
lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);
lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);
lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes2, 0);
lrd_server_attach(OraSrv1, "rman", -1, 0, 0);
lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);
lrd_ora8_attr_set(OraSes1, USERNAME, "qatest", -1, 0);
lrd_ora8_attr_set(OraSes1, PASSWORD, lr_unmask("3c0f3f4fcf9b606126ca"), -1, 0);
lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);
lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);
 /* lrd_open_connection call has been commented out:- 
 lrd_open_connection(&Con1, LRD_DBTYPE_ORACLE, "qatest", "qatest", "rman", "", 0, 0, 0); */
lrd_oci8_to_oci7(OraSvc1, &Con1, 0);
/* ORA 7 functions */
lrd_open_cursor(&Csr1, Con1, 0);
lrd_stmt(Csr1, "SELECT USER FROM DUAL", -1, 0, 1, 0);
lrd_bind_cols(Csr1, BCInfo_D2, 0);
lrd_exec(Csr1, 0, 0, 0, 0, 0);
lrd_fetch(Csr1, 1, 1, 0, PrintRow2, 0);
GRID(2);
lrd_close_cursor(&Csr1, 0);
 /* ORA 8 functions */
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);
lrd_ora8_stmt(OraStm1, "BEGIN DBMS_OUTPUT.DISABLE; END;", 1, 0, 0);
lrd_ora8_exec(OraSvc1, OraStm1, 1, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);
lrd_handle_free(&OraStm1, 0);