Skip to content

Commit 6fdafc3

Browse files
authored
add commmit and rollback to "text" exclusion list (#1995)
1 parent bd649f0 commit 6fdafc3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Dapper/CompiledRegex.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal static partial class CompiledRegex
99
[StringSyntax("Regex")]
1010
#endif
1111
private const string
12-
WhitespaceOrReservedPattern = @"[\s;/\-+*]|^vacuum$",
12+
WhitespaceOrReservedPattern = @"[\s;/\-+*]|^vacuum$|^commit$|^rollback$",
1313
LegacyParameterPattern = @"(?<![\p{L}\p{N}@_])[?@:](?![\p{L}\p{N}@_])", // look for ? / @ / : *by itself* - see SupportLegacyParameterTokens
1414
LiteralTokensPattern = @"(?<![\p{L}\p{N}_])\{=([\p{L}\p{N}_]+)\}", // look for {=abc} to inject member abc as a literal
1515
PseudoPositionalPattern = @"\?([\p{L}_][\p{L}\p{N}_]*)\?"; // look for ?abc? for the purpose of subst back to ? using member abc

tests/Dapper.Tests/ProcedureTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public void TestDateTime2PrecisionPreservedInDynamicParameters()
218218
{
219219
const string tempSPName = "#" + nameof(TestDateTime2PrecisionPreservedInDynamicParameters);
220220

221-
DateTime datetimeDefault = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
221+
DateTime datetimeDefault = new(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
222222
DateTime datetime2 = datetimeDefault.AddTicks(1); // Add 100 ns
223223

224224
Assert.True(datetimeDefault < datetime2);
@@ -252,7 +252,7 @@ public void TestDateTime2LosePrecisionInDynamicParameters(DbType? dbType)
252252
{
253253
const string tempSPName = "#" + nameof(TestDateTime2LosePrecisionInDynamicParameters);
254254

255-
DateTime datetimeDefault = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
255+
DateTime datetimeDefault = new(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
256256
DateTime datetime2 = datetimeDefault.AddTicks(1); // Add 100 ns
257257

258258
Assert.True(datetimeDefault < datetime2);
@@ -331,6 +331,8 @@ public async Task Issue1986_AutoProc_Whitespace(string space)
331331
[InlineData("FOO BAR;", CommandType.Text)]
332332
[InlineData("VACUUM", CommandType.Text)]
333333
[InlineData("VACUUM;", CommandType.Text)]
334+
[InlineData("cOmmiT", CommandType.Text)]
335+
[InlineData("rOllbAck", CommandType.Text)]
334336

335337
// comments imply text
336338
[InlineData("foo--bar", CommandType.Text)]

0 commit comments

Comments
 (0)