注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

幸福边缘

紫枫

 
 
 

日志

 
 
 
 

Robotframework-DatabaseLibrary 中execute sql script使用  

2016-08-09 17:11:06|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Name:

Execute Sql Script

Source:

DatabaseLibrary <test library>

Arguments:

[ sqlScriptFileName ]

Executes the content of the `sqlScriptFileName` as SQL commands. Useful for setting the database to a known state before running your tests, or clearing out your test data after running each a test.

Sample usage :

Execute Sql Script

${EXECDIR}${/}resources${/}DDL-setup.sql

Execute Sql Script

${EXECDIR}${/}resources${/}DML-setup.sql

#interesting stuff here

Execute Sql Script

${EXECDIR}${/}resources${/}DML-teardown.sql

Execute Sql Script

${EXECDIR}${/}resources${/}DDL-teardown.sql

SQL commands are expected to be delimited by a semi-colon (';').

Sql命令都是以分号隔开。

For example: DELETE FROM person_employee_table; DELETE FROM person_table; DELETE FROM employee_table;

例如:DELETE FROM person_employee_table; DELETE FROM person_table; DELETE FROM employee_table;

Also, the last SQL command can optionally omit its trailing semi-colon.

最后一个sql命令可以省略分隔符号。

For example: DELETE FROM person_employee_table; DELETE FROM person_table; DELETE FROM employee_table

Given this, that means you can create spread your SQL commands in several lines.

鉴于此,这就意味着你可以创建多行sql命令。

For example: DELETE FROM person_employee_table; DELETE FROM person_table; DELETE FROM employee_table

However, lines that starts with a number sign (`#`) are treated as a commented line. Thus, none of the contents of that line will be executed.

以#开头的行,表示注释。将不被执行。

For example: # Delete the bridging table first... DELETE FROM person_employee_table; # ...and then the bridged tables. DELETE FROM person_table; DELETE FROM employee_table

 

说明:

  1. 如果要执行sql,需要有数据库的DML、DDL权限才行;
  2. Execute sql script如果脚本里面写的是select,执行的时候可能报

中文就是:标识符过长

  评论这张
 
阅读(76)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017