Commit ac1c2c52 authored by Marc Gravell's avatar Marc Gravell

(thanks @wickedsheep) Don't use GetValues() due to broken implementation in...

(thanks @wickedsheep) Don't use GetValues() due to broken implementation in some providers (Mono: I'm looking at you); also add AsList()
parent 40282d19
......@@ -1026,6 +1026,15 @@ public bool Equals(Identity other)
}
}
/// <summary>
/// Obtains the data as a list; if it is *already* a list, the original object is returned without
/// any duplication; otherwise, ToList() is invoked.
/// </summary>
public static List<T> AsList<T>(this IEnumerable<T> source)
{
return (source == null || source is List<T>) ? (List<T>)source : source.ToList();
}
#if CSHARP30
/// <summary>
/// Execute parameterized SQL
......@@ -2584,9 +2593,11 @@ private static Exception MultiMapException(IDataRecord reader)
if (startBound == 0)
{
r.GetValues(values);
for (int i = 0; i < values.Length; i++)
if (values[i] is DBNull) values[i] = null;
{
object val = r.GetValue(i);
values[i] = val is DBNull ? null : val;
}
}
else
{
......
......@@ -19,6 +19,7 @@
using Microsoft.SqlServer.Types;
using System.Data.SqlTypes;
using FirebirdSql.Data.FirebirdClient;
using System.Diagnostics;
#if POSTGRESQL
using Npgsql;
#endif
......@@ -4191,6 +4192,16 @@ public void BasicDecimals()
c.IsEqualTo(11.884M);
}
public void Issue263_Timeout()
{
var watch = Stopwatch.StartNew();
var i = connection.Query<int>("waitfor delay '00:01:00'; select 42;", commandTimeout: 300, buffered: false).Single();
watch.Stop();
i.IsEqualTo(42);
var minutes = watch.ElapsedMilliseconds / 1000 / 60;
Assert.IsTrue(minutes >= 0.95 && minutes <= 1.05);
}
#if POSTGRESQL
class Cat
......
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