End-User Documentation

Validate a Simple SELECT Query

Validate a Simple SELECT Query

A SqlQuery is the smallest useful entry point: create it, inspect IsValid, and review the resulting diagnostics when validation fails.

Steps

  1. Construct a SqlQuery with your raw SQL text.
  2. Read IsValid for a quick yes-or-no assertion.
  3. If it fails, inspect Errors, Warnings, or ErrorSummary.
  4. Promote common failures into dedicated tests so regressions stay easy to diagnose.

Example

var validQuery = new SqlQuery("SELECT id, name FROM customers");
Assert.True(validQuery.IsValid);

var invalidQuery = new SqlQuery("SELECT FROM customers");
Assert.False(invalidQuery.IsValid);
Assert.Contains(invalidQuery.Errors, issue => issue.Code == "QL0001");

Related