软件测试开源工具Rational Robot SQABasic数据库操作相关命令[5] 软件测试工具
关键字:SQABasic 数据库 命令
语法: 参数 解释
connection& 必需项,long
destination$ 必需项,包含用来存储结果的文件和路径的字符串。
columnNames% 整型,非0时,文件首行将存储数据库计划指定的栏列名称。如果缺省,默认为0。
columnDelimiter$ 每行内界定域用的字符串。如果缺省,tab键用来分隔域。
注解:
成功完成操作情况下,返回值是结果集的行数目。如果函数不能在指定连接上获得结果,返回-1。
参数是必需参数。返回变量。 SQLRetrieveToFile Example
This example opens a connection to a data source and retrieves information to a file.
Sub main
'' Declarations
''
Dim connection As Long
Dim destination As String
Dim retcode As Long
Dim query as String
Dim outputStr as String
Dim filename as String
Dim columnDelimiter as String
''
'' Open the connection
connection = SQLOpen("DSN=SblTest",outputStr,prompt:=3)
'' Execute the query
''
query = "select * from customer"
retcode = SQLExecQuery(connection,query)
'' Place the results of the previous query in the file named by
'' filename and put the column names in the file as the first row.
'' The field delimiter is %
''
filename = "c:\myfile.txt"
columnDelimiter = "%"
retcode = SQLRetrieveToFile(connection:=connection,destination:=filename, columnNames:=1,columnDelimiter:=columnDelimiter)
retcode = SQLClose(connection)
End Sub