Skip to content

Commit

Permalink
nhibernateGH-3530: The Sybase SqlAnywhere DotNet4 driver does not imp…
Browse files Browse the repository at this point in the history
…lement DbDataReader.GetChar and incorrectly uses Convert without specifying an IFormatProvider. Wrap the Sybase SqlAnywhere DotNet4 DbDataReader in a SqlAnywhereDbDataReader to correct these issues.
  • Loading branch information
David Ellingsworth authored and David Ellingsworth committed Jun 14, 2024
1 parent 2b8c35e commit dff6329
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
29 changes: 29 additions & 0 deletions src/NHibernate/Async/Driver/SybaseSQLAnywhereDotNet4Driver.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 SybaseSQLAnywhereDotNet4Driver : ReflectionBasedDriver
{

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

return new SqlAnywhereDbDataReader(reader);
}
}
}
16 changes: 13 additions & 3 deletions src/NHibernate/Driver/SybaseSQLAnywhereDotNet4Driver.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace NHibernate.Driver
using System.Data.Common;
using NHibernate.AdoNet;

namespace NHibernate.Driver
{
/// <summary>
/// SQL Dialect for SQL Anywhere 12 - for the NHibernate 3.2.0 distribution
Expand Down Expand Up @@ -28,7 +31,7 @@
/// Sybase SQL Anywhere 12 using the versioned ADO.NET driver
/// iAnywhere.Data.SQLAnywhere.v4.0.
/// </remarks>
public class SybaseSQLAnywhereDotNet4Driver : ReflectionBasedDriver
public partial class SybaseSQLAnywhereDotNet4Driver : ReflectionBasedDriver
{
/// <summary>
/// Initializes a new instance of the <see cref="SybaseSQLAnywhereDotNet4Driver"/> class.
Expand Down Expand Up @@ -57,5 +60,12 @@ public override string NamedPrefix
}

public override bool RequiresTimeSpanForTime => true;

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

return new SqlAnywhereDbDataReader(reader);
}
}
}
}

0 comments on commit dff6329

Please sign in to comment.