Database-Specific Validation
QueryLens can validate SQL against specific database families and versions by using QueryLens.Dialect. This enables validation of database-specific SQL functions, reserved words, and syntax rules instead of relying only on generic SQL structure checks.
Supported Database Types
| Database family | Supported profiles | What QueryLens can validate |
|---|---|---|
| SQL Server | SqlServer2012, SqlServer2014, SqlServer2016, SqlServer2017, SqlServer2019, SqlServer2022 |
SQL Server syntax, version-gated built-in functions, reserved words, and SQL Server-backed schema loading |
| PostgreSQL | PostgreSql12, PostgreSql13, PostgreSql14 |
PostgreSQL syntax rules, functions, and reserved words |
| MySQL | MySql8 |
MySQL syntax rules, functions, and reserved words |
| SQLite | Sqlite3 |
SQLite syntax rules, functions, and limitations such as unsupported statements |
| Oracle | Oracle12c, Oracle19c |
Oracle syntax rules, functions, and reserved words |
| Generic SQL | GenericSql |
Permissive cross-dialect structural validation only |
SQL Server Example
QueryLens.Dialect = DialectProfile.SqlServer2019;
var query = new SqlQuery("SELECT STRING_AGG(name, ',') FROM dbo.departments");
Assert.True(query.IsValid);
PostgreSQL Example
QueryLens.Reset();
QueryLens.Dialect = DialectProfile.PostgreSql14;
var query = new SqlQuery("SELECT now()");
Assert.True(query.IsValid);
MySQL Example
QueryLens.Reset();
QueryLens.Dialect = DialectProfile.MySql8;
var query = new SqlQuery("SELECT CONCAT(first_name, ' ', last_name) FROM customers");
Assert.True(query.IsValid);
SQLite Example
QueryLens.Reset();
QueryLens.Dialect = DialectProfile.Sqlite3;
var query = new SqlQuery("SELECT name FROM customers LIMIT 10");
Assert.True(query.IsValid);
Oracle Example
QueryLens.Reset();
QueryLens.Dialect = DialectProfile.Oracle19c;
var query = new SqlQuery("SELECT employee_id FROM employees");
Assert.True(query.IsValid);
When To Use This
- Use a specific dialect profile when your tests target one real database engine.
- Use generic mode only when you want permissive structure checks or are adopting QueryLens gradually.
- Use SQL Server profiles when you also want schema-backed validation with
LoadDbSchemaFrom(...).