SQL Parsing and Verification

Before an SQL query can be executed, it has to run through several phases within the ClearSCADA Query Processor, the first of which is the parsing and verification phase. During the parsing and verification phase, the Query Processor checks that your SQL query is correct both syntactically and semantically (complies with the rules for SQL queries).

When a query is submitted, the Query Processor undertakes the two stages of the SQL Parsing and Verification phase:

  1. The Query Processor begins the Parsing and Verification stage by checking the syntax of your query. This involves checking that the form of the query complies with the rules for Structured Query Language.
    • If the syntax of your query is valid, it passes the parsing check and the Query Processor will proceed to the verification check.
    • If the syntax of your query is invalid, the Query Processor stops attempting to process the query and an error is logged in ClearSCADA. Your query is not executed.
  2. During the verification check, the Query Processor tests the semantics (the meaning) of your query. This involves checking that:
    • Every column and table reference is valid
    • The types and operands for a given operator are valid, for example, CurrentValue+2 is valid, but CurrentValue+'Teststring' is invalid
    • The types of the arguments for a given function are valid, for example, ABS(CurrentValue) is valid, but ABS(FullName) is invalid
    • Your query complies with the other SQL rules, including aliases being used consistently, columns being grouped correctly (if GROUP BY is used), and so on.
  3. If your query passes the verification check, the Query Processor continues to process the query by progressing to the join optimization phase (see SQL Join Optimization).
  4. If your query fails the verification check, the Query Processor stops processing your query and an error is logged in ClearSCADA. Your query is not executed.

Disclaimer

ClearSCADA 2017 R2