fix(pgsql): make CommandVisitor parameter index instance-scoped
Resolves SonarQube S2696 in CommandVisitor.cs. The static _parameterIndex field was mutated from an instance method, causing every new CommandVisitor to inherit the previous instance's counter and never reset. Parameter indices now restart at $1 per visitor, which is the intended PostgreSQL behavior. Adds CommandVisitorTests.TwoVisitors_HaveIndependentParameterIndices to lock in the contract via reflection (FormatParameterName is protected). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
e2bfe3906a
commit
acfe29ee98
@@ -9,7 +9,7 @@ namespace Strata.SqlTools.Visitors.PostgreSql;
|
||||
/// </summary>
|
||||
public class CommandVisitor : SqlServerCommandVisitor
|
||||
{
|
||||
private static int _parameterIndex = 1;
|
||||
private int _parameterIndex = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Formats an identifier for PostgreSQL using double-quote quoting.
|
||||
|
||||
Reference in New Issue
Block a user