fix(sql): chunk the key-value IN list at the dialect's bind ceiling (Driver.Sql-002, Driver.Sql.Dialect-002)
ISqlDialect gains MaxBindParameters — the per-command ceiling the seam was missing while modelling everything else that differs per backend: 2098 usable of SQL Server's 2100 (sp_executesql spends two), 1000 for Oracle's IN-list limit (ORA-01795, tighter than its 64k bind count), 65535 for the Postgres Bind message. SqlGroupPlanner.AddKeyValuePlans now emits several plans for one group when its distinct keys exceed that ceiling, instead of one statement the provider refuses after the connection opened — which left every tag in an EAV group publishing BadCommunicationError on every poll, permanently, and reported the database endpoint as down. Chunks share the group key; members follow their own key so a shared keyValue never splits. SqlPollReader is unchanged: it runs one command per plan and slices each plan's own Members back, proven by a fixture read at a ceiling of 1.
This commit is contained in:
@@ -84,6 +84,18 @@ public class SqlServerDialectTests
|
||||
.ShouldBe("SELECT TOP 1 [a]");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 2098, not 2100: <c>Microsoft.Data.SqlClient</c> routes a parameterized command through
|
||||
/// <c>sp_executesql</c>, whose statement text and parameter-declaration arguments consume two of the
|
||||
/// server's 2100. A ceiling of 2100 would be rejected by a caller that filled it exactly.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void MaxBindParameters_leavesRoomForSpExecutesqlsOwnTwoParameters()
|
||||
{
|
||||
new SqlServerDialect().MaxBindParameters.ShouldBe(2098);
|
||||
new SqlServerDialect().MaxBindParameters.ShouldBeLessThan(2100);
|
||||
}
|
||||
|
||||
// ---- extra guards on the injection boundary (beyond the plan's golden set) ----
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user