Skip to content

Commit

Permalink
nhibernateGH-3530: The SAP SQL Anywhere driver does not support the D…
Browse files Browse the repository at this point in the history
…bDataReader.GetChar method, wrap it in the NoCharDbDataReader.
  • Loading branch information
David Ellingsworth authored and David Ellingsworth committed Jun 11, 2024
1 parent 64a1953 commit 06d93bc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
29 changes: 29 additions & 0 deletions src/NHibernate/Async/Driver/SapSQLAnywhere17Driver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AsyncGenerator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------


using System.Data.Common;
using NHibernate.AdoNet;

namespace NHibernate.Driver
{
using System.Threading.Tasks;
using System.Threading;
public partial class SapSQLAnywhere17Driver : ReflectionBasedDriver
{

public override async Task<DbDataReader> ExecuteReaderAsync(DbCommand command, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var reader = await (command.ExecuteReaderAsync(cancellationToken)).ConfigureAwait(false);

return new NoCharDbDataReader(reader);
}
}
}
14 changes: 12 additions & 2 deletions src/NHibernate/Driver/SapSQLAnywhere17Driver.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
namespace NHibernate.Driver
using System.Data.Common;
using NHibernate.AdoNet;

namespace NHibernate.Driver
{
public class SapSQLAnywhere17Driver : ReflectionBasedDriver
public partial class SapSQLAnywhere17Driver : ReflectionBasedDriver
{
public SapSQLAnywhere17Driver()
: base("Sap.Data.SQLAnywhere", "Sap.Data.SQLAnywhere.v4.5", "Sap.Data.SQLAnywhere.SAConnection", "Sap.Data.SQLAnywhere.SACommand")
Expand All @@ -14,5 +17,12 @@ public SapSQLAnywhere17Driver()
public override string NamedPrefix => ":";

public override bool RequiresTimeSpanForTime => true;

public override DbDataReader ExecuteReader(DbCommand command)
{
var reader = command.ExecuteReader();

return new NoCharDbDataReader(reader);
}
}
}

0 comments on commit 06d93bc

Please sign in to comment.