File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,23 @@ protected override void RegisterFunctions()
23
23
24
24
// DBMS_RANDOM package was available in previous versions, but it was requiring initialization and
25
25
// was not having the value function.
26
- RegisterFunction ( "random" , new NoArgSQLFunction ( "DBMS_RANDOM.VALUE" , NHibernateUtil . Double ) ) ;
26
+ // It yields a decimal between 0 included and 1 excluded, with 38 significant digits. It sometimes
27
+ // causes an overflow when read by the Oracle provider as a .Net Decimal, so better explicitly cast
28
+ // it to double.
29
+ RegisterFunction ( "random" , new SQLFunctionTemplate ( NHibernateUtil . Double , "cast(DBMS_RANDOM.VALUE() as binary_double)" ) ) ;
27
30
}
31
+
32
+ /* 6.0 TODO: consider redefining float and double registrations
33
+ protected override void RegisterNumericTypeMappings()
34
+ {
35
+ base.RegisterNumericTypeMappings();
36
+
37
+ // Use binary_float (available since 10g) instead of float. With Oracle, float is a decimal but
38
+ // with a precision expressed in number of bytes instead of digits.
39
+ RegisterColumnType(DbType.Single, "binary_float");
40
+ // Using binary_double (available since 10g) instead of double precision. With Oracle, double
41
+ // precision is a float(126), which is a decimal with a 126 bytes precision.
42
+ RegisterColumnType(DbType.Double, "binary_double");
43
+ }*/
28
44
}
29
45
}
You can’t perform that action at this time.
0 commit comments