Class QueryAnalyzer
- Namespace
- Dynamicweb.Data.Firehose
- Assembly
- Dynamicweb.Core.dll
Provides analysis and parsing capabilities for a single SQL query, including syntax validation and query type inspection.
public sealed class QueryAnalyzer
- Inheritance
-
QueryAnalyzer
- Inherited Members
Remarks
Use this class to parse a SQL query, check for syntax errors, and determine the type of query (such as SELECT or non-query). The class exposes methods to generate result generators based on the analyzed query. Instances of this class are immutable and thread-safe for concurrent read operations.
Constructors
QueryAnalyzer(string)
Initializes a new instance of the QueryAnalyzer class for the specified SQL query.
public QueryAnalyzer(string sql)
Parameters
sqlstringThe SQL query string to analyze. Cannot be null, empty, or consist only of white-space characters.
Properties
IsValid
Gets a value indicating whether the current state is valid.
public bool IsValid { get; }
Property Value
ParseErrors
Gets a read-only collection of errors encountered during parsing.
public IReadOnlyCollection<ParseError> ParseErrors { get; }
Property Value
Query
Gets the SQL query string associated with this instance.
public string Query { get; }
Property Value
Methods
CreateResultGenerator()
Creates an appropriate result generator based on the current query type.
public ResultGeneratorBase? CreateResultGenerator()
Returns
- ResultGeneratorBase
A ResultGeneratorBase instance suitable for the current query, or null if no result generator is applicable.
Remarks
Returns a specialized result generator for SELECT or non-query operations, depending on the query context. Returns null if the query type is not supported.