Skip to content

Commit cd3fc04

Browse files
Switch decimal to REAL storage
To be squashed
1 parent 4b1eaf8 commit cd3fc04

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/NHibernate/Dialect/SQLiteDialect.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ protected virtual void RegisterColumnTypes()
5353
// NUMERIC and REAL are almost the same, they are binary floating point numbers. There is only a slight difference
5454
// for values without a floating part. They will be represented as integers with numeric, but still as floating
5555
// values with real. The side-effect of this is numeric being able of storing exactly bigger integers than real.
56-
RegisterColumnType(DbType.Currency, "NUMERIC");
57-
RegisterColumnType(DbType.Decimal, "NUMERIC");
56+
// But it also creates bugs in division, when dividing two numeric happening to be integers, the result is then
57+
// never fractional. So we use "REAL" for all.
58+
RegisterColumnType(DbType.Currency, "REAL");
59+
RegisterColumnType(DbType.Decimal, "REAL");
5860
RegisterColumnType(DbType.Double, "REAL");
5961
RegisterColumnType(DbType.Single, "REAL");
60-
RegisterColumnType(DbType.VarNumeric, "NUMERIC");
62+
RegisterColumnType(DbType.VarNumeric, "REAL");
6163

6264
RegisterColumnType(DbType.AnsiString, "TEXT");
6365
RegisterColumnType(DbType.String, "TEXT");

0 commit comments

Comments
 (0)