Skip to content

SQLite: Enable Decimal #19635

@bricelam

Description

@bricelam

Similar to PR #19617, we can enable more decimal operations by leveraging UDFs. Unlike TimeSpan, however, there isn't an acceptable type we can convert to to perform the operations, so it will require roughly one UDF per operation. For example:

Done .NET SQL
m1 + m2 ef_add($m1, $m2)
m1 / m2 ef_divide($m1, $m2)
m1 > m2 ef_compare($m1, $m2) > 0
m1 >= m2 ef_compare($m1, $m2) >= 0
m1 < m2 ef_compare($m1, $m2) < 0
m1 <= m2 ef_compare($m1, $m2) <= 0
m1 % m2 ef_mod($m1, $m2)
m1 * m2 ef_multiply($m1, $m2)
m1 - m2 ef_add($m1, ef_negate($m2))
-m ef_negate($m)
Average(t => t.Decimal) ef_avg(t.Decimal)
Max(t => t.Decimal) ef_max(t.Decimal)
Min(t => t.Decimal) ef_min(t.Decimal)
Sum(t => t.Decimal) ef_sum(t.Decimal)
OrderBy(t => t.Decimal) ORDER BY t.Decimal COLLATE EF_DECIMAL
OrderByDescending(t => t.Decimal) ORDER BY t.Decimal COLLATE EF_DECIMAL DESC

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions