Class SqlNormalizer
- Namespace
- QueryGuard
- Assembly
- QueryGuard.Core.dll
The default ISqlNormalizer: a single conservative pass over the text.
public sealed class SqlNormalizer : ISqlNormalizer
- Inheritance
-
SqlNormalizer
- Implements
- Inherited Members
Remarks
What it does, and nothing more:
- collapses runs of whitespace, including line breaks, to a single space;
- removes comments, except a recognized
QueryGuard:directive; - replaces provider parameter references with a single placeholder;
- drops the statement terminators and batch prologue some providers prepend.
What it deliberately never does: reorder tokens, sort clauses, canonicalize aliases, rewrite quoted identifiers, or attempt to recognize that two differently written statements are semantically equivalent. Each of those would risk merging genuinely different queries, and a report that points at the wrong SQL is worse than one that stays quiet.
String literals and quoted identifiers are copied through untouched. Redacting literals is the redactor's job, applied after normalization, so there is exactly one place that decides what counts as data.
Fields
- ParameterPlaceholder
Replaces every provider parameter reference, whatever its syntax.
Methods
- Normalize(string?)
Normalizes a command's text.