国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > Oracle > 正文

利用loadrunner測試ORACLE存儲(chǔ)過程的性能

2024-08-29 13:32:22
字體:
供稿:網(wǎng)友

  首先需要安裝 lr的.net add-in ,在開發(fā)環(huán)境編寫代碼,做數(shù)據(jù)庫連接,然后調(diào)用執(zhí)行存儲(chǔ)過程。

  裝好以后,打開程序,應(yīng)該看到菜單欄里多了一個(gè):

  然后添加一個(gè)lr項(xiàng)目:

  之后就可以編碼了,我寫了個(gè)代碼,如下:

using system;
using system.runtime.interopservices;
using system.componentmodel;
using system.data;
using system.data.oracleclient;
using shangxin.data;
using system.collections;
using system.web;
  namespace loadrunneruser
{
/// <summary>
/// summary description for vuserclass.
/// </summary>
[classinterface(classinterfacetype.autodual)]
public class vuserclass
{
loadrunner.lrapi lr;
protected system.data.oracleclient.oracledataadapter oracleda;
protected system.data.oracleclient.oraclecommand loadcommand;
protected system.data.oracleclient.oracleconnection oracleconnection;
  
public vuserclass()
{
// loadrunner standard api interface :: do not remove!!!
lr = new loadrunner.lrapi();
}
  protected system.data.oracleclient.oracleconnection getoracleconnection()////sqlconnection
{
if (oracleconnection==null)
oracleconnection=new system.data.oracleclient.oracleconnection();
oracleconnection.connectionstring="user id=test;password=write;data source=escalade";
return oracleconnection;
}
  
// ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
public int initialize()
{
// to do: add virtual user's initialization routines
  return lr.pass;
}
  // ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
public int actions()
{
try
{
lr.start_transaction("testgetwithdraworderbycode");
system.data.oracleclient.oracleconnection conn = new oracleconnection("user id=test;password=write;data source=escalade");
system.data.oracleclient.oraclecommand comm = new oraclecommand();
comm.connection = conn;
comm.commandtext = "bill.getwithdraworderbycode";
comm.commandtype = commandtype.storedprocedure;
//輸入?yún)?shù)
system.data.oracleclient.oracleparameter param1=comm.parameters.add("v_code",oracletype.varchar,20);
param1.direction = parameterdirection.input;
param1.value ="th15";
//輸出參數(shù)
system.data.oracleclient.oracleparameter param2=comm.parameters.add("retcursor",oracletype.cursor);
param2.direction = parameterdirection.output;
datatable dt = new datatable();
oracleda = new system.data.oracleclient.oracledataadapter();
oracleda.selectcommand = comm;
oracleda.fill(dt);
int icount=convert.toint32(dt.rows.count.tostring());
if(icount>0)
lr.end_transaction("testgetwithdraworderbycode",lr.pass);
else
lr.end_transaction("testgetwithdraworderbycode",lr.fail);
}
  catch(exception ex)
{
string error = ex.message;
}
  return lr.pass;
}
  // ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
public int terminate()
{
// to do: add virtual user's termination routines
  return lr.pass;
}
  }
}

  記得添加必要的引用,具體使用靈活掌握吧


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 邢台县| 扎赉特旗| 英吉沙县| 云和县| 台南县| 绥棱县| 门头沟区| 花莲县| 澜沧| 阿拉善左旗| 加查县| 遵义市| 临朐县| 鄂托克前旗| 沛县| 蒲城县| 济源市| 辽源市| 和静县| 清水县| 临夏市| 石楼县| 五指山市| 唐海县| 星子县| 大理市| 吴川市| 天全县| 夏津县| 常德市| 东源县| 封丘县| 濮阳县| 黔南| 蕲春县| 阿图什市| 海丰县| 永胜县| 越西县| 屯昌县| 嘉鱼县|