51Testing软件测试论坛

标题: oracle的脚本例子 [打印本页]

作者: tacy_lee    时间: 2005-4-30 11:29
标题: oracle的脚本例子
oracle的脚本,用sqlplus录的

vuser_init()
{
       
        int i;

        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, "apache_192.168.4.10", -1, 0, 0);
        lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);
        lrd_ora8_attr_set(OraSes1, USERNAME, "test", -1, 0);
        lrd_ora8_attr_set(OraSes1, PASSWORD, "test", -1, 0);
        lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);
        lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);
       
        for(i=1;i<10;i++){
                lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);
                lrd_ora8_stmt(OraStm1, "select * from test", 1, 0, 0);
                lrd_ora8_exec(OraSvc1, OraStm1, 0, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);
        }

        lrd_session_end(OraSvc1, OraSes1, 0, 0);
        lrd_server_detach(OraSrv1, 0, 0);
        lrd_handle_free(&OraEnv1, 0);

        return 0;
}




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2