Commit c80e9d17 authored by Marc Gravell's avatar Marc Gravell

remove the lie that "binding code is only interested in names - not types"; it...

remove the lie that "binding code is only interested in names - not types"; it might have been true once, but not for a long time
parent 3d3ce558
...@@ -2945,7 +2945,7 @@ public void Issue295_NullableDateTime_MySql_ConvertAllowZeroDatetime() ...@@ -2945,7 +2945,7 @@ public void Issue295_NullableDateTime_MySql_ConvertAllowZeroDatetime()
[FactMySql] [FactMySql]
public void Issue426_SO34439033_DateTimeGainsTicks() public void Issue426_SO34439033_DateTimeGainsTicks()
{ {
using (var conn = GetMySqlConnection()) using (var conn = GetMySqlConnection(true, true, true))
{ {
try { conn.Execute("drop table Issue426_Test"); } catch { } try { conn.Execute("drop table Issue426_Test"); } catch { }
try { conn.Execute("create table Issue426_Test (Id int not null, Time time not null)"); } catch { } try { conn.Execute("create table Issue426_Test (Id int not null, Time time not null)"); } catch { }
......
...@@ -43,9 +43,9 @@ static int GetColumnHash(IDataReader reader) ...@@ -43,9 +43,9 @@ static int GetColumnHash(IDataReader reader)
{ {
int colCount = reader.FieldCount, hash = colCount; int colCount = reader.FieldCount, hash = colCount;
for (int i = 0; i < colCount; i++) for (int i = 0; i < colCount; i++)
{ // binding code is only interested in names - not types {
object tmp = reader.GetName(i); object tmp = reader.GetName(i);
hash = (hash * 31) + (tmp?.GetHashCode() ?? 0); hash = -79 * ((hash * 31) + (tmp?.GetHashCode() ?? 0)) + (reader.GetFieldType(i)?.GetHashCode() ?? 0);
} }
return hash; return hash;
} }
...@@ -1616,7 +1616,7 @@ private static void PassByPosition(IDbCommand cmd) ...@@ -1616,7 +1616,7 @@ private static void PassByPosition(IDbCommand cmd)
} }
return GetStructDeserializer(type, underlyingType ?? type, startBound); return GetStructDeserializer(type, underlyingType ?? type, startBound);
} }
static Func<IDataReader, object> GetHandlerDeserializer(ITypeHandler handler, Type type, int startBound) private static Func<IDataReader, object> GetHandlerDeserializer(ITypeHandler handler, Type type, int startBound)
{ {
return reader => handler.Parse(type, reader.GetValue(startBound)); return reader => handler.Parse(type, reader.GetValue(startBound));
} }
......
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