|
想压存储过程,录制下来都是这种信息,我怎样进行参数化呢?
lrd_init(&InitInfo, DBTypeVersion);
lrd_initialize_db(LRD_DBTYPE_ORACLE, 2, 0);
lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
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, "test111", 7, 0, 0);
lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);
lrd_ora8_attr_set(OraSes1, USERNAME, "portaluser", -1, 0);
lrd_ora8_attr_set(OraSes1, PASSWORD, lr_decrypt("4cbfe1dbe3b5e07d"), -1, 0);
lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);
lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);
lrd_ora8_stmt(OraStm1, "SELECT USER FROM DUAL", 1, 32, 0);
lrd_ora8_exec(OraSvc1, OraStm1, 0, 0, &uliRowsProcessed, 0, 0, 0, 0,
0);
lrd_ora8_bind_col(OraStm1, &OraDef1, 1, &USER_D1, 0, 0);
lrd_ora8_fetch(OraStm1, -1, 1, &uliFetchedRows, PrintRow2, 2, 0, 0);
GRID8(2);
lrd_handle_free(&OraStm1, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm2, 0);
lrd_ora8_stmt(OraStm2, "BEGIN DBMS_OUTPUT.DISABLE; END;", 1, 32, 0);
lrd_ora8_exec(OraSvc1, OraStm2, 1, 0, &uliRowsProcessed, 0, 0, 0, 0,
0);
lrd_handle_free(&OraStm2, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm3, 0);
lrd_ora8_stmt(OraStm3, "SELECT ATTRIBUTE,SCOPE,NUMERIC_VALUE,CHAR_VALUE,DATE_VALUE FROM "
"SYSTEM.PRODUCT_PRIVS WHERE (UPPER('SQL*Plus') LIKE UPPER"
"(PRODUCT)) AND (UPPER(USER) LIKE USERID)", 1, 32, 0);
lrd_ora8_exec(OraSvc1, OraStm3, 0, 0, &uliRowsProcessed, 0, 0, 0, 0,
0);
lrd_ora8_bind_col(OraStm3, &OraDef2, 1, &ATTRIBUTE_D2, 0, 0);
lrd_ora8_bind_col(OraStm3, &OraDef3, 2, &SCOPE_D3, 0, 0);
lrd_ora8_bind_col(OraStm3, &OraDef4, 3, &NUMERIC_VALUE_D4, 0, 0);
lrd_ora8_bind_col(OraStm3, &OraDef5, 4, &CHAR_VALUE_D5, 0, 0);
lrd_ora8_bind_col(OraStm3, &OraDef6, 5, &DATE_VALUE_D6, 0, 0);
lrd_ora8_fetch(OraStm3, -0, 1, &uliFetchedRows, 0, 2, 0, 0);
lrd_handle_free(&OraStm3, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm4, 0);
lrd_ora8_stmt(OraStm4, "SELECT CHAR_VALUE FROM SYSTEM.PRODUCT_PRIVS WHERE (UPPER"
"('SQL*Plus') LIKE UPPER(PRODUCT)) AND ((UPPER(USER) LIKE "
"USERID) OR (USERID = 'PUBLIC')) AND (UPPER(ATTRIBUTE) = "
"'ROLES')", 1, 32, 0);
lrd_ora8_exec(OraSvc1, OraStm4, 0, 0, &uliRowsProcessed, 0, 0, 0, 0,
0);
lrd_ora8_bind_col(OraStm4, &OraDef7, 1, &CHAR_VALUE_D7, 0, 0);
lrd_ora8_fetch(OraStm4, -0, 1, &uliFetchedRows, 0, 2, 0, 0);
lrd_handle_free(&OraStm4, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm5, 0);
lrd_ora8_stmt(OraStm5, "BEGIN DBMS_APPLICATION_INFO.SET_MODULE(:1,NULL); END;", 1, 32, 0);
lrd_assign(&P1D8, "SQL*Plus", 0, 0, 0);
lrd_ora8_bind_placeholder(OraStm5, &OraBnd1, "1", &P1D8,
LRD_BIND_BY_POS, 0, 0);
lrd_ora8_exec(OraSvc1, OraStm5, 1, 0, &uliRowsProcessed, 0, 0, 0, 0,
0);
GRID0(4);
lrd_handle_free(&OraStm5, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm6, 0);
lrd_ora8_stmt(OraStm6, "SELECT DECODE('A','A','1','2') FROM DUAL", 1, 32, 0);
lrd_ora8_bind_col(OraStm6, &OraDef8, 1, &DECODE_A_A_1_2_D9, 0, 0);
lrd_ora8_exec(OraSvc1, OraStm6, 1, 0, &uliRowsProcessed, 0, 0, 0, 0,
0);
lrd_ora8_print(OraStm6, PrintRow6);
GRID0(6);
lrd_handle_free(&OraStm6, 0);
lrd_ora8_commit(OraSvc1, 0, 0);
lrd_ora8_commit(OraSvc1, 0, 0);
return 0; |
|