OTX Reference  
OpenTestSystem.Otx.Extensions.SQL.Actions.ExecuteQuery Class Reference

Executes the given SQL statement More...

Inheritance diagram for OpenTestSystem.Otx.Extensions.SQL.Actions.ExecuteQuery:
Inheritance graph

Public Attributes

ConnectionTerm connection
 This element represents an open Connection. More...
 
ResultSetVariable resultSet
 Returns a ResultSet which contains the result of the executed reading command. More...
 
StringTerm statement
 Mandatory SQL statement string which is send to the database, typically a static SQL SELECT statement. More...
 
- Public Attributes inherited from OpenTestSystem.Otx.Core.Actions.ActionRealisation
OtxLink validFor
 Validity of ActionRealisation. More...
 

Detailed Description

Executes the given SQL statement

The ExecuteQuery action shall execute the given SQL statement, which returns a single ResultSet object.

Note
After executing a command the ResultSet cursor is initially positioned before the first row.
Exceptions
Exceptions.CommandException
Exceptions.ConnectionException
Syntax
SQL.ExecuteQuery(ConnectionTerm connection, StringTerm statement, ResultSetVariable resultSet);
ResultSetVariable resultSet
Returns a ResultSet which contains the result of the executed reading command.
Definition: SQL.cs:596
StringTerm statement
Mandatory SQL statement string which is send to the database, typically a static SQL SELECT statement...
Definition: SQL.cs:586
ConnectionTerm connection
This element represents an open Connection.
Definition: SQL.cs:576
Examples
// Local Declarations
SQL.Connection Connection1;
SQL.ResultSet ResultSet1;
Boolean Boolean1;
List<Boolean> List1;
// Flow
try
{
// connect with DotNet platform
Connection1 = SQL.CreateConnection("DRIVER={SQL Server};Server=.;InitialCatalog=classicmodels;username=sa;password=saas");
}
catch (Exception)
{
// connect with Java platform
Connection1 = SQL.CreateConnection("jdbc:sqlserver://localhost;databaseName=classicmodels;username=sa;password=saas");
}
catch (Exception Exception1)
{
throw Exception1;
}
SQL.ExecuteQuery(Connection1, "select * from classicmodels.dbo.orders", ResultSet1);
while (SQL.NextResult(ResultSet1)) : WhileLoop1
{
Boolean1 = SQL.GetResultValueAsBoolean(ResultSet1, "hasComments");
ListAppendItems(List1, { Boolean1});
}
if (Util.Compare({List1, {false, true, false, false, false, false, false}}))
{
Result = true;
}
SQL.CloseConnection(Connection1);

Member Data Documentation

◆ connection

ConnectionTerm OpenTestSystem.Otx.Extensions.SQL.Actions.ExecuteQuery.connection

This element represents an open Connection.

◆ resultSet

ResultSetVariable OpenTestSystem.Otx.Extensions.SQL.Actions.ExecuteQuery.resultSet

Returns a ResultSet which contains the result of the executed reading command.

◆ statement

StringTerm OpenTestSystem.Otx.Extensions.SQL.Actions.ExecuteQuery.statement

Mandatory SQL statement string which is send to the database, typically a static SQL SELECT statement.