Work with the SQL Editor

The SQL Editor is only available if you have installed and enabled the Tosca Data Integrity AddIn in Tosca Commander.

The SQL Editor allows you to create and test SQL statements for your TestCase before you run it.

It offers an auto-escape function, so you don't have to escape special characters in your SQL statements.

If you use dynamic expressions in your SQL statements, the Translate function of the SQL Editor enables you to see the value that Tosca DI uses at runtime.

You can use the SQL Editor in TestCases that you create with the following Modules:

Use the SQL Editor

To enter and test your SQL statement via SQL Editor, follow the steps below:

  1. Ensure that you defined a connection to your data source. How you define it, depends on the Module you used to create your TestCase:

    • DI DB Expert Module: select your connection from the Connection drop-down.

    • TBox DB Expert Module: specify your connection in the Open Connection TestStepValues.

    • Metadata Comparison Module: specify your connection in the TestStepValues Connection, DSN, or Connection string.

    • Row by Row Comparison Module: specify your connection in the TestStepValues Source and Target.

    • Load Data into Database Module: select your connection from the Connection drop-down.

    • Preview: Row by Row Comparison (DI Agent) Module: specify your connection in the TestStepValues Agent, Source, and Target.

    • Preview: DB Expert module (DI Agent): specify your connection in the TestStepValues Agent and JDBC.

  2. Select the TestStep or TestStepValue in the project tree on the left side.

  3. Click the SQL Editor tab.

SQL Editor tab in Tosca Commander

  1. Enter your SQL statement into the SQL Query field.

    The SQL Editor offers syntax highlighting for keywords, strings, quoted identifiers, and support comments.

  1. If you use dynamic expressions, click Translate to translate them.

Translation of a dynamic expressions in the SQL Editor

  1. To test your SQL statement, click Run SQL.

    By default, you can see at maximum the top 1000 rows in the Results Table of the SQL Editor.

Switch from source to target

If you use the Row by Row Comparison Module or Preview - Row by Row Comparison (DI Agent), you can switch between SQL statements of Source and Target.

To do so, click on Source or Target in the SQL Editor.

Source and Target in the SQL Editor