Database Query Results in Result Details

Document created by Chris Sommerstad Employee on Jul 20, 2017Last modified by Jijius Jabez on Aug 10, 2017
Version 2Show Document
  • View in full screen mode

Database Query Results in Result Details

The query results for Database actions are presented differently in the Result Details, Summary and Events list tabs. The form of the response is also determined by the database action specified in the database action detail.

The Summary panel presents query results in a tabular format, while the Events panel presents them in the form in which they are returned. This unformatted result is accessed by testers (such as through scripts or for extractions (such as in Property Sets), as well as for validations and so forth.

Note: Refer to the Direct to Database Testing, Defining a Database Action for a complete overview of database action outputs.

The following screenshot shows formatted CSV data in tabular format as it is presented in the Summary tab.

The following screenshot shows unformatted CSV data as it is presented in the Events List tab.

Examples Query Results using Output Options

The following example query results correspond to the specified output option.

For example, this query SELECT column_int, column_varchar, column_numeric FROM __database_testing__ returns the following formatted Result in the Results Details, Summary panel:

column_intcolumn_varcharcolumn_numeric
1Oracle 11g123456.780
2PostgreSQL "9.3"234567.890
3SQL Server 2012345678.900
4(null)(null)

In the remaining examples, query results are shown per output type in their raw form, as they are shown in the Result Details, Events List panel.

The query results if the output option is summary or read-and-discard:

The SQL statement was executed successfully. (4 rows affected)

 

The query results if the output option is csv-with-header:

column_int,column_varchar,column_numeric
1,Oracle 11g,123456.780
2,"PostgreSQL ""9.3""",234567.890
3,SQL Server 2012,345678.900
4,\N,\N

 

The query results if the output option is csv:

1,Oracle 11g,123456.780
2,"PostgreSQL ""9.3""",234567.890
3,SQL Server 2012,345678.900
4,\N,\N

 

The query results if the output option is xml:

<Output>
<Results>
<Result>
<Data>
<Row>
<Column value="1" />
<Column value="Oracle 11g" />
<Column value="123456.780" />
</Row>
<Row>
<Column value="2" />
<Column value="PostgreSQL "9.3"" />
<Column value="234567.890" />
</Row>
<Row>
<Column value="3" />
<Column value="SQL Server 2012" />
<Column value="345678.900" />
</Row>
<Row>
<Column value="4" />
<Column value="" isNull="true" />
<Column value="" isNull="true" />
</Row>
</Data>
</Result>
</Results>
</Output>

 

The query results if the output option is xml-with-summary:

Note: Column sizes are approximate for some column data types.

<Output>
<Results>
<Result>
<Summary>
<Result rowCount="4">
The SQL statement was executed successfully. (4 rows affected)</Result>
<Columns>
<Column name="column_int" type="int2" size="5" />
<Column name="column_varchar" type="varchar" size="255" />
<Column name="column_numeric" type="numeric" size="12" />
</Columns>
</Summary>
<Data>
<Row>
<Column value="1" />
<Column value="Oracle 11g" />
<Column value="123456.780" />
</Row>
<Row>
<Column value="2" />
<Column value="PostgreSQL "9.3"" />
<Column value="234567.890" />
</Row>
<Row>
<Column value="3" />
<Column value="SQL Server 2012" />
<Column value="345678.900" />
</Row>
<Row>
<Column value="4" />
<Column value="" isNull="true" />
<Column value="" isNull="true" />
</Row>
</Result>
</Results>
</Output>

 

The query results if the output option is json-with-summary:

Note: The Result is one long line. Here, the line is wrapped into multiple lines for easier viewing.

{
    "output": {
    "results": [
         {
          "summary": {
              "result": {
               "rowCount": 4,
               "message": "The SQL statement was executed successfully. (4 rows affected)"
              },
              "columns": [
               {
                "name": "column_int",
                "type": "int2",
                "size": 5
               },
               {
                "name": "column_varchar",
                "type": "varchar",
                "size": 255
               },
               {
                "name": "column_numeric",
                "type": "numeric",
                "size": 12
               }
              ]
          },
          "data": [
              [
               "1",
               "Oracle 11g",
             "123456.780"
              ],
              [
             "2",
             "PostgreSQL \"9.3\"",
             "234567.890"
              ],
              [
               "3",
             "SQL Server 2012",
             "345678.900"
              ],
              [
             "4",
             null,
             null
              ]
         ]
         }
     ]
    }
}

 

 

The query results if the output option is json:

Note: The Result is one long line. Here, the line is wrapped into multiple lines for easier viewing.

{
    "output": {
         "results": [
              {
                   "data": [
                        [
                        "1",
                        "Oracle 11g",
                        "123456.780"
                        ],
                        [
                        "2",
                        "PostgreSQL \"9.3\"",
                        "234567.890"
                        ],
                        [
                        "3",
                        "SQL Server 2012",
                        "345678.900"
                        ],
                        [
                        "4",
                        null,
                        null
                        ]
                   ]
              }
         ]
    }
}

Attachments

    Outcomes