Skip to content

Commit 5c022a5

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

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed
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 SybaseSQLAnywhereDriver : 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/SybaseSQLAnywhereDriver.cs

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
namespace NHibernate.Driver
1+
using System.Data.Common;
2+
using NHibernate.AdoNet;
3+
4+
namespace NHibernate.Driver
25
{
36
/// <summary>
47
/// The SybaseSQLAnywhereDriver Driver provides a database driver for Sybase SQL Anywhere 10 and above
58
/// </summary>
6-
public class SybaseSQLAnywhereDriver : ReflectionBasedDriver
9+
public partial class SybaseSQLAnywhereDriver : ReflectionBasedDriver
710
{
811
/// <summary>
912
/// Initializes a new instance of the <see cref="SybaseSQLAnywhereDriver"/> class.
@@ -32,5 +35,12 @@ public override string NamedPrefix
3235
}
3336

3437
public override bool RequiresTimeSpanForTime => true;
38+
39+
public override DbDataReader ExecuteReader(DbCommand command)
40+
{
41+
var reader = command.ExecuteReader();
42+
43+
return new SqlAnywhereDbDataReader(reader);
44+
}
3545
}
36-
}
46+
}

0 commit comments

Comments
 (0)