loadrunner Lr_类函数之lr_db_executeSQLStatement()
2017-10-01 15:24
543 查看
lr_db_executeSQLStatement()--常用函数
向数据库提交SQL语句。int lr_db_executeSQLStatement(“StepName = <step_name>”,“ConnectionName =<connection_name>”,“SQLStatement = <statement>”,[“DatasetName= <dataset_name>”,] LAST);
参数说明:
StepName:步骤的名称,它出现在测试树中。可以使用任何文本。
ConnectionName:在lr_db_connect中指定的连接的逻辑名称。
SQLStatement SQL语句,例如SELECT,INSERT,DELETE和UPDATE。语法是数据库相关的。
SQLStatement可以参数化。
DatasetName:SQL查询中结果数据集的逻辑名称,您可以在后续步骤中参考该数据集。仅当SQLStatement是SELECT语句时使用。
LAST:此分隔符标记参数列表的结尾。
lr_db_executeSQLStatement向数据库提交SQL语句。
要点:此功能仅在Web服务脚本中可用。
当SQLStatement是SELECT语句时,DatasetName指向结果数据集。在本上下文中,术语数据集用于描述数据表(格式为行和列)。数据集中的数据可以通过脚本中的后续步骤操作。
当SQLStatement为DELETE,INSERT或UPDATE时,会向重播日志和测试结果摘要发出警告。
调用此函数后,行未定义。在这种情况下,确保在此函数后调用lr_db_getValue时将Row设置为next或1。
示例:lr_db_executeSQLStatement
在以下示例中,lr_db_executeSQLStatement向数据库提交查询。数据集由MyDataset指向,数据集中的行数保存到NumRows变量。
int NumRows = 0;
NumRows = lr_db_executeSQLStatement(“StepName = PerformQuery”,
“ConnectionName= db1”,
“SQLStatement= SELECT dbo.Customer.CustID,dbo.Customer.FirstName,dbo.Customer.LastName
FROM dbo.Customer”,
“DatasetName =MyDataset”,
LAST);
lr_output_message(“查询返回%d行。”,NumRows);
相关文章推荐
- loadrunner Lr_类函数之lr_db_connect()
- loadrunner Lr_类函数之lr_db_dataset_action()
- loadrunner Lr_类函数之lr_db_disconnect()
- loadrunner Lr_类函数之lr_db_getValue()
- struts “could not execute statement; SQL [n/a]; constraint [null];” 错误
- Cause: java.sql.SQLException: Cannot execute statement: impossible to write to binary log
- loadrunner Lr_类函数之 lr_paramarr_random()
- Statement 的 execute(sql) 方法的返回值
- loadrunner Lr_类函数之lr_set_transaction_instance_status()
- LoadRunner lr_eval_string() 函数使用及LR中变量、参数的简单使用
- loadrunner Lr_类函数之 lr_peek_events()
- loadrunner Lr_类函数之lr_set_transaction_status()和lr_end_transaction_instance()
- loadrunner Lr_类函数之 lr_rendezvous()
- [BTS]Failed to execute SQL Statement.
- org.hibernate.exception.SQLGrammarException: could not execute statement
- loadrunner Lr_类函数之lr_set_transaction_status_by_name()
- loadrunner Lr_类函数之 lr_rendezvous_ex()
- PDOstament对象执行execute()函数,只要是sql语句正确都是返回true
- org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.
- [K/3Cloud]DBServiceHelper.ExecuteDataSet(this.Context, sql)) 返回数据问题