Skip to content

Commit dff6329

Browse files
David EllingsworthDavid Ellingsworth
authored andcommitted
GH-3530: The Sybase SqlAnywhere DotNet4 driver does not implement DbDataReader.GetChar and incorrectly uses Convert without specifying an IFormatProvider. Wrap the Sybase SqlAnywhere DotNet4 DbDataReader in a SqlAnywhereDbDataReader to correct these issues.
1 parent 2b8c35e commit dff6329

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by AsyncGenerator.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost if
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
10+
11+
using System.Data.Common;
12+
using NHibernate.AdoNet;
13+
14+
namespace NHibernate.Driver
15+
{
16+
using System.Threading.Tasks;
17+
using System.Threading;
18+
public partial class SybaseSQLAnywhereDotNet4Driver : ReflectionBasedDriver
19+
{
20+
21+
public override async Task<DbDataReader> ExecuteReaderAsync(DbCommand command, CancellationToken cancellationToken)
22+
{
23+
cancellationToken.ThrowIfCancellationRequested();
24+
var reader = await (command.ExecuteReaderAsync(cancellationToken)).ConfigureAwait(false);
25+
26+
return new SqlAnywhereDbDataReader(reader);
27+
}
28+
}
29+
}

src/NHibernate/Driver/SybaseSQLAnywhereDotNet4Driver.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
namespace NHibernate.Driver
1+
using System.Data.Common;
2+
using NHibernate.AdoNet;
3+
4+
namespace NHibernate.Driver
25
{
36
/// <summary>
47
/// SQL Dialect for SQL Anywhere 12 - for the NHibernate 3.2.0 distribution
@@ -28,7 +31,7 @@
2831
/// Sybase SQL Anywhere 12 using the versioned ADO.NET driver
2932
/// iAnywhere.Data.SQLAnywhere.v4.0.
3033
/// </remarks>
31-
public class SybaseSQLAnywhereDotNet4Driver : ReflectionBasedDriver
34+
public partial class SybaseSQLAnywhereDotNet4Driver : ReflectionBasedDriver
3235
{
3336
/// <summary>
3437
/// Initializes a new instance of the <see cref="SybaseSQLAnywhereDotNet4Driver"/> class.
@@ -57,5 +60,12 @@ public override string NamedPrefix
5760
}
5861

5962
public override bool RequiresTimeSpanForTime => true;
63+
64+
public override DbDataReader ExecuteReader(DbCommand command)
65+
{
66+
var reader = command.ExecuteReader();
67+
68+
return new SqlAnywhereDbDataReader(reader);
69+
}
6070
}
61-
}
71+
}

0 commit comments

Comments
 (0)