Commit 4bfa979d authored by Marc Gravell's avatar Marc Gravell

Merge branch 'ronindev-master'

parents f8ce0e45 bbbe18d5
...@@ -2674,7 +2674,7 @@ private static IEnumerable<PropertyInfo> FilterParameters(IEnumerable<PropertyIn ...@@ -2674,7 +2674,7 @@ private static IEnumerable<PropertyInfo> FilterParameters(IEnumerable<PropertyIn
// look for ? / @ / : *by itself* // look for ? / @ / : *by itself*
static readonly Regex smellsLikeOleDb = new Regex(@"(?<![a-zA-Z0-9_])[?@:](?![a-zA-Z0-9_])", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled), static readonly Regex smellsLikeOleDb = new Regex(@"(?<![a-zA-Z0-9@_])[?@:](?![a-zA-Z0-9@_])", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled),
literalTokens = new Regex(@"\{=([a-zA-Z0-9_]+)\}", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled); literalTokens = new Regex(@"\{=([a-zA-Z0-9_]+)\}", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled);
/// <summary> /// <summary>
......
...@@ -25,7 +25,7 @@ public void TestBasicStringUsageAsyncNonBuffered() ...@@ -25,7 +25,7 @@ public void TestBasicStringUsageAsyncNonBuffered()
{ {
using (var connection = Program.GetOpenConnection()) using (var connection = Program.GetOpenConnection())
{ {
var query = connection.QueryAsync<string>(new CommandDefinition("select 'abc' as [Value] union all select @txt", new { txt = "def" }, flags: CommandFlags.None)); var query = connection.QueryAsync<string>(new CommandDefinition("select 'abc' as [Value] union all select @txt", new { txt = "def" }, flags: CommandFlags.None));
var arr = query.Result.ToArray(); var arr = query.Result.ToArray();
arr.IsSequenceEqualTo(new[] { "abc", "def" }); arr.IsSequenceEqualTo(new[] { "abc", "def" });
} }
...@@ -33,7 +33,7 @@ public void TestBasicStringUsageAsyncNonBuffered() ...@@ -33,7 +33,7 @@ public void TestBasicStringUsageAsyncNonBuffered()
public void TestLongOperationWithCancellation() public void TestLongOperationWithCancellation()
{ {
using(var connection = Program.GetClosedConnection()) using (var connection = Program.GetClosedConnection())
{ {
CancellationTokenSource cancel = new CancellationTokenSource(TimeSpan.FromSeconds(5)); CancellationTokenSource cancel = new CancellationTokenSource(TimeSpan.FromSeconds(5));
var task = connection.QueryAsync<int>(new CommandDefinition("waitfor delay '00:00:10';select 1", cancellationToken: cancel.Token)); var task = connection.QueryAsync<int>(new CommandDefinition("waitfor delay '00:00:10';select 1", cancellationToken: cancel.Token));
...@@ -373,7 +373,7 @@ public void Issue22_ExecuteScalar() ...@@ -373,7 +373,7 @@ public void Issue22_ExecuteScalar()
k.IsNull(); k.IsNull();
} }
} }
public void TestSupportForDynamicParametersOutputExpressions() public void TestSupportForDynamicParametersOutputExpressions()
{ {
using (var connection = Program.GetOpenConnection()) using (var connection = Program.GetOpenConnection())
...@@ -531,7 +531,7 @@ public void TestSupportForDynamicParametersOutputExpressions_QueryMultiple() ...@@ -531,7 +531,7 @@ public void TestSupportForDynamicParametersOutputExpressions_QueryMultiple()
p.Output(bob, b => b.Address.PersonId); p.Output(bob, b => b.Address.PersonId);
int x, y; int x, y;
using(var multi = connection.QueryMultipleAsync(@" using (var multi = connection.QueryMultipleAsync(@"
SET @Occupation = 'grillmaster' SET @Occupation = 'grillmaster'
SET @PersonId = @PersonId + 1 SET @PersonId = @PersonId + 1
SET @NumberOfLegs = @NumberOfLegs - 1 SET @NumberOfLegs = @NumberOfLegs - 1
...@@ -561,7 +561,7 @@ public void TestSubsequentQueriesSuccess() ...@@ -561,7 +561,7 @@ public void TestSubsequentQueriesSuccess()
var data0 = connection.QueryAsync<Foo0>("select 1 as [Id] where 1 = 0").Result.ToList(); var data0 = connection.QueryAsync<Foo0>("select 1 as [Id] where 1 = 0").Result.ToList();
data0.Count().IsEqualTo(0); data0.Count().IsEqualTo(0);
var data1 = connection.QueryAsync<Foo1>(new CommandDefinition("select 1 as [Id] where 1 = 0", flags:CommandFlags.Buffered)).Result.ToList(); var data1 = connection.QueryAsync<Foo1>(new CommandDefinition("select 1 as [Id] where 1 = 0", flags: CommandFlags.Buffered)).Result.ToList();
data1.Count().IsEqualTo(0); data1.Count().IsEqualTo(0);
var data2 = connection.QueryAsync<Foo2>(new CommandDefinition("select 1 as [Id] where 1 = 0", flags: CommandFlags.None)).Result.ToList(); var data2 = connection.QueryAsync<Foo2>(new CommandDefinition("select 1 as [Id] where 1 = 0", flags: CommandFlags.None)).Result.ToList();
...@@ -578,7 +578,7 @@ public void TestSubsequentQueriesSuccess() ...@@ -578,7 +578,7 @@ public void TestSubsequentQueriesSuccess()
} }
} }
class Foo0 { public int Id { get;set; } } class Foo0 { public int Id { get; set; } }
class Foo1 { public int Id { get; set; } } class Foo1 { public int Id { get; set; } }
class Foo2 { public int Id { get; set; } } class Foo2 { public int Id { get; set; } }
class Person class Person
...@@ -700,8 +700,23 @@ public void TestMultiMapArbitraryMaps() ...@@ -700,8 +700,23 @@ public void TestMultiMapArbitraryMaps()
finally finally
{ {
connection.Execute("drop table #Users drop table #ReviewBoards"); connection.Execute("drop table #Users drop table #ReviewBoards");
} }
} }
} }
public void TestAtEscaping()
{
using (var connection = Program.GetOpenConnection())
{
var id = connection.QueryAsync<int>(@"
declare @@Name int
select @@Name = @Id+1
select @@Name
", new Product { Id = 1 }).Result.Single();
id.IsEqualTo(2);
}
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment