refactor(sql): promote the single-row limit onto ISqlDialect

Claude-Session: https://claude.ai/code/session_01GASWkNEi68FSCtvr6rLoEW
This commit is contained in:
Joseph Doherty
2026-07-24 13:57:25 -04:00
parent 984cc875e8
commit 3d7e1226d2
4 changed files with 72 additions and 17 deletions
@@ -48,6 +48,19 @@ public class SqlServerDialectTests
d.ListColumnsSql.ShouldContain("@table");
}
[Fact]
public void SingleRowLimit_isTSqlsTop1_inThePrefixPosition_withItsOwnTrailingSpace()
{
var d = new SqlServerDialect();
// The planner concatenates "SELECT " + prefix + columns with no separator of its own, so the
// trailing space belongs to the fragment. T-SQL has no end-of-statement limit clause.
d.SingleRowLimitPrefix.ShouldBe("TOP 1 ");
d.SingleRowLimitSuffix.ShouldBe("");
string.Concat("SELECT ", d.SingleRowLimitPrefix, "[a]", d.SingleRowLimitSuffix)
.ShouldBe("SELECT TOP 1 [a]");
}
// ---- extra guards on the injection boundary (beyond the plan's golden set) ----
[Fact]