Skip to content

Commit da13b9f

Browse files
maca88fredericDelaporte
authored andcommitted
Fix Oracle binary floating point setting
1 parent 50fa0d8 commit da13b9f

File tree

3 files changed

+2
-48
lines changed

3 files changed

+2
-48
lines changed

src/NHibernate.Test/Async/Linq/ByMethod/AverageTests.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,6 @@ public class AverageTestsAsync : LinqTestCase
2222
[Test]
2323
public async Task CanGetAverageOfIntegersAsDoubleAsync()
2424
{
25-
// TODO 6.0: Enable test for Oracle once nhibernate.oracle.use_binary_floating_point_types is set to true
26-
if (Dialect is Oracle8iDialect)
27-
{
28-
// The point of this test is to verify that LINQ's Average over an
29-
// integer columns yields a non-integer result, even on databases
30-
// where the corresponding avg() will yield a return type equal to
31-
// the input type. This means the LINQ provider must generate HQL
32-
// that cast the input to double inside the call to avg(). This works
33-
// fine on most databases, but Oracle causes trouble.
34-
//
35-
// The dialect maps double to "DOUBLE PRECISION" on Oracle, which
36-
// on Oracle has larger precision than C#'s double. When such
37-
// values are returned, ODP.NET will convert it to .Net decimal, which
38-
// has lower precision and thus causes an overflow exception.
39-
//
40-
// Some argue that this is a flaw in ODP.NET, others have created
41-
// local dialects that use e.g. BINARY_DOUBLE instead, which more
42-
// closely matches C#'s IEEE 745 double, see e.g. HHH-1961 and
43-
// serveral blogs.
44-
45-
Assert.Ignore("Not supported on Oracle due to casting/overflow issues.");
46-
}
47-
4825
//NH-2429
4926
var average = await (db.Products.AverageAsync(x => x.UnitsOnOrder));
5027

src/NHibernate.Test/Linq/ByMethod/AverageTests.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,6 @@ public class AverageTests : LinqTestCase
1010
[Test]
1111
public void CanGetAverageOfIntegersAsDouble()
1212
{
13-
// TODO 6.0: Enable test for Oracle once nhibernate.oracle.use_binary_floating_point_types is set to true
14-
if (Dialect is Oracle8iDialect)
15-
{
16-
// The point of this test is to verify that LINQ's Average over an
17-
// integer columns yields a non-integer result, even on databases
18-
// where the corresponding avg() will yield a return type equal to
19-
// the input type. This means the LINQ provider must generate HQL
20-
// that cast the input to double inside the call to avg(). This works
21-
// fine on most databases, but Oracle causes trouble.
22-
//
23-
// The dialect maps double to "DOUBLE PRECISION" on Oracle, which
24-
// on Oracle has larger precision than C#'s double. When such
25-
// values are returned, ODP.NET will convert it to .Net decimal, which
26-
// has lower precision and thus causes an overflow exception.
27-
//
28-
// Some argue that this is a flaw in ODP.NET, others have created
29-
// local dialects that use e.g. BINARY_DOUBLE instead, which more
30-
// closely matches C#'s IEEE 745 double, see e.g. HHH-1961 and
31-
// serveral blogs.
32-
33-
Assert.Ignore("Not supported on Oracle due to casting/overflow issues.");
34-
}
35-
3613
//NH-2429
3714
var average = db.Products.Average(x => x.UnitsOnOrder);
3815

src/NHibernate/Dialect/Oracle10gDialect.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ public override JoinFragment CreateOuterJoinFragment()
2626

2727
public override void Configure(IDictionary<string, string> settings)
2828
{
29-
base.Configure(settings);
30-
3129
_useBinaryFloatingPointTypes = PropertiesHelper.GetBoolean(
3230
Environment.OracleUseBinaryFloatingPointTypes,
3331
settings,
3432
false);
33+
34+
base.Configure(settings);
3535
}
3636

3737
// Avoid registering weighted double type when using binary floating point types

0 commit comments

Comments
 (0)