|
2#
楼主 |
发表于 2005-9-27 10:34:02
|
只看该作者
通过oracle 2-Tier录制,录制脚本如下:
vuser_init()
{
lrd_init(&InitInfo, DBTypeVersion);
lrd_initialize_db(LRD_DBTYPE_ORACLE, 1, 0);
lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);
lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);
lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);
lrd_server_attach(OraSrv1, "?", -1, 0, 0);
lrd_ora8_attr_set(OraSrv1, EXTERNAL_NAME, "", -1, 0);
lrd_ora8_attr_set(OraSrv1, INTERNAL_NAME, "", -1, 0);
lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);
lrd_ora8_attr_set(OraSes1, USERNAME, "?", -1, 0);
lrd_ora8_attr_set(OraSes1, PASSWORD, lr_decrypt("4338a045ba765169cd01a1"), -1, 0);
lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);
lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);
lrd_ora8_stmt(OraStm1, "ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS' "
"NLS_NUMERIC_CHARACTERS = '.,' NLS_CALENDAR = 'GREGORIAN' ", 1, 0, 0);
lrd_ora8_exec(OraSvc1, OraStm1, 1, 0, &uliRowsProcessed, 0, 0, 0, 0,
0);
lrd_handle_free(&OraStm1, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm2, 0);
lrd_ora8_attr_set(OraStm2, PREFETCH_ROWS, "10", -1, 0);
lrd_ora8_stmt(OraStm2, "SELECT PARAMETER, VALUE FROM SYS.NLS_DATABASE_PARAMETERS WHERE "
"PARAMETER IN ('NLS_CHARACTERSET', 'NLS_NCHAR_CHARACTERSET')", 1, 0, 0);
lrd_ora8_exec(OraSvc1, OraStm2, 0, 0, &uliRowsProcessed, 0, 0, 0, 0,
0);
lrd_ora8_bind_col(OraStm2, &OraDef1, 1, &PARAMETER_D1, 0, 0);
lrd_ora8_attr_set(OraDef1, CHARSET_ID, "1", -1, 0);
lrd_ora8_bind_col(OraStm2, &OraDef2, 2, &VALUE_D2, 0, 0);
lrd_ora8_attr_set(OraDef2, CHARSET_ID, "1", -1, 0);
lrd_ora8_fetch(OraStm2, 2, 1, &uliFetchedRows, PrintRow2, 2, 0, 0);
GRID8(2);
lrd_handle_free(&OraStm2, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm3, 0);
lrd_handle_free(&OraStm3, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm4, 0);
lrd_ora8_stmt(OraStm4, "SELECT code,sender,receiver,sendtime,nvl(content,' ') FROM messages "
"WHERE receiver='?' AND receivetime IS NULL ORDER BY "
"sendtime DESC", 1, 0, 0);
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm5, 0);
lrd_ora8_stmt(OraStm5, "SELECT code,sender,receiver,sendtime,nvl(content,' ') FROM messages "
"WHERE receiver='?' AND receivetime IS NULL ORDER BY "
"sendtime DESC", 1, 0, 0);
lrd_ora8_stmt(OraStm5, "SELECT code , sender , receiver , sendtime , nvl(content,' ') FROM "
"messages WHERE receiver='?' AND receivetime IS NULL "
"ORDER BY sendtime DESC ", 1, 0, 0);
lrd_ora8_attr_set(OraStm5, PREFETCH_ROWS, "100", -1, 0);
lrd_ora8_exec(OraSvc1, OraStm5, 0, 0, &uliRowsProcessed, 0, 0, 0, 0,
0);
lrd_ora8_bind_col(OraStm5, &OraDef3, 1, &CODE_D3, 0, 0);
lrd_ora8_bind_col(OraStm5, &OraDef4, 2, &SENDER_D4, 0, 0);
lrd_ora8_bind_col(OraStm5, &OraDef5, 3, &RECEIVER_D5, 0, 0);
lrd_ora8_bind_col(OraStm5, &OraDef6, 4, &SENDTIME_D6, 0, 0);
lrd_ora8_bind_col(OraStm5, &OraDef7, 5, &NVL_CONTENT_D7, 0, 0);
lrd_ora8_fetch(OraStm5, -0, 100, &uliFetchedRows, 0, 2, 0, 0);
lrd_ora8_attr_set(OraStm5, PREFETCH_ROWS, "0", -1, 0);
lrd_handle_free(&OraStm5, 0);
lrd_handle_free(&OraStm4, 0);
lrd_session_end(OraSvc1, OraSes1, 0, 0);
lrd_server_detach(OraSrv1, 0, 0);
lrd_handle_free(&OraSvc1, 0);
lrd_handle_free(&OraSrv1, 0);
lrd_handle_free(&OraSes1, 0);
lrd_handle_free(&OraEnv1, 0);
return 0;
100个vuser的运行状态都是pass,觉得这段脚本与sever没有关系,也就是说,没有测试到sever。 |
|