ebuluo 2008-5-6 01:44
如何实现在做lr sql参数化时sql语句中的变量的参数化?
题目有点绕口。忽发奇想,权当作一个技术问题来讨论。
我们知道参数化时可以用sql向导用sql语句从数据库中提取数据,
比如 select salary from username,
现在我的问题是,如果我想对username进行参数化(比如lily,bobo,terry) ,在loadrunner里面应该怎么做?
ebuluo 2008-5-6 01:47
也就是说我想在脚本运行的时候取到的数据是
select salary from lily;
select salary from bobo;
select salary from terry;
的一个集合,而不是单个人的值。
如果不通过预先取出这些值放在文件中然后读取的这种方法,是否有其他的方法?
[[i] 本帖最后由 ebuluo 于 2008-5-6 01:50 编辑 [/i]]
AJan1000 2008-5-6 08:34
可以在脚本当中替换参数的形式把。
在lrd_stmt(lsr14,"select salary from username \r\n",-1,1,0,0)函数当中
右击"select salary from username "替换为参数,在参数列表中输入其它语句
select salary from lily;
select salary from bobo;
select salary from terry;
应该也可以的吧。
:)
1qazse4 2008-5-6 08:56
确实是个不错的idea
关注中..... :victory:
ebuluo 2008-5-6 12:08
[quote]原帖由 [i]AJan1000[/i] 于 2008-5-6 08:34 发表 [url=http://bbs.51testing.com/redirect.php?goto=findpost&pid=962143&ptid=113867][img]http://bbs.51testing.com/images/common/back.gif[/img][/url]
可以在脚本当中替换参数的形式把。
在lrd_stmt(lsr14,"select salary from username \r\n",-1,1,0,0)函数当中
右击"select salary from username "替换为参数,在参数列表中输入其它语句
select salary from lily ... [/quote]
这是一个不错的方法~0~不过这个函数可以和http协议的脚本混用吗?
AJan1000 2008-5-6 12:31
[quote]原帖由 [i]ebuluo[/i] 于 2008-5-6 12:08 发表 [url=http://bbs.51testing.com/redirect.php?goto=findpost&pid=962448&ptid=113867][img]http://bbs.51testing.com/images/common/back.gif[/img][/url]
这是一个不错的方法~0~不过这个函数可以和http协议的脚本混用吗? [/quote]
好像不可以,之前我试了一下,在HTTP协议当中,不识别这个函数。
ebuluo 2008-5-6 13:02
[quote]原帖由 [i]AJan1000[/i] 于 2008-5-6 12:31 发表 [url=http://bbs.51testing.com/redirect.php?goto=findpost&pid=962469&ptid=113867][img]http://bbs.51testing.com/images/common/back.gif[/img][/url]
好像不可以,之前我试了一下,在HTTP协议当中,不识别这个函数。 [/quote]
我印象中不是一个协议的,而且貌似这2个协议不能混用才多问了一句呵呵。不过也是个思路吧
demit1 2008-5-7 23:19
http协议中的DataWizard,好像不是实时获取数据库中的数据的吧,只是一次性将select结果down到本地,所以也就没有参数化的概念了
ebuluo 2008-5-8 14:34
[quote]原帖由 [i]demit1[/i] 于 2008-5-7 23:19 发表 [url=http://bbs.51testing.com/redirect.php?goto=findpost&pid=963961&ptid=113867][img]http://bbs.51testing.com/images/common/back.gif[/img][/url]
http协议中的DataWizard,好像不是实时获取数据库中的数据的吧,只是一次性将select结果down到本地,所以也就没有参数化的概念了 [/quote]
正因为这样,我才提这个问题。如果我正好有这样的需求,有没有好的方法实现?
qq33046881 2008-5-12 10:54
顶!
zhicl 2008-5-12 11:05
数据库中建个临时视图?不过如果真有这个需求也挺奇怪的,程序中又是怎么实现这个值的变化的呢?如果程序中可以,我想我们也能取得到吧,否则数据库设计就不合理了
Testingpig 2008-5-14 15:24
再套一层SELECT 语句吧
楼主这个
select salary from lily;
select salary from bobo;
select salary from terry;
这个例子可行性不大,一般数据表不会按人名来建,这样数据太庞大了
一般结构好的数据表,可以多套几层SELECT语句,就实现你要集合效果
或许LR里有其它函数可以实现,但我现在还不知道,
也等待有高手出现,指教一下