Skip to content

Commit

Permalink
add commmit and rollback to "text" exclusion list
Browse files Browse the repository at this point in the history
  • Loading branch information
mgravell committed Nov 10, 2023
1 parent bd649f0 commit 4dee145
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dapper/CompiledRegex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static partial class CompiledRegex
[StringSyntax("Regex")]
#endif
private const string
WhitespaceOrReservedPattern = @"[\s;/\-+*]|^vacuum$",
WhitespaceOrReservedPattern = @"[\s;/\-+*]|^vacuum$|^commit$|^rollback$",
LegacyParameterPattern = @"(?<![\p{L}\p{N}@_])[?@:](?![\p{L}\p{N}@_])", // look for ? / @ / : *by itself* - see SupportLegacyParameterTokens
LiteralTokensPattern = @"(?<![\p{L}\p{N}_])\{=([\p{L}\p{N}_]+)\}", // look for {=abc} to inject member abc as a literal
PseudoPositionalPattern = @"\?([\p{L}_][\p{L}\p{N}_]*)\?"; // look for ?abc? for the purpose of subst back to ? using member abc
Expand Down
6 changes: 4 additions & 2 deletions tests/Dapper.Tests/ProcedureTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void TestDateTime2PrecisionPreservedInDynamicParameters()
{
const string tempSPName = "#" + nameof(TestDateTime2PrecisionPreservedInDynamicParameters);

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

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

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

Assert.True(datetimeDefault < datetime2);
Expand Down Expand Up @@ -331,6 +331,8 @@ public async Task Issue1986_AutoProc_Whitespace(string space)
[InlineData("FOO BAR;", CommandType.Text)]
[InlineData("VACUUM", CommandType.Text)]
[InlineData("VACUUM;", CommandType.Text)]
[InlineData("cOmmiT", CommandType.Text)]
[InlineData("rOllbAck", CommandType.Text)]

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

0 comments on commit 4dee145

Please sign in to comment.