[#8275] Improve SQLite's CEIL and FLOOR emulation
This commit is contained in:
parent
1805a3cdd5
commit
4793a9c461
@ -67,9 +67,9 @@ final class Ceil<T extends Number> extends AbstractFunction<T> {
|
||||
|
||||
|
||||
|
||||
// evaluate "ceil" if unavailable
|
||||
// [#8275] Improved emulation for SQLite
|
||||
case SQLITE:
|
||||
return DSL.round(argument.add(0.499999999999999));
|
||||
return DSL.field("({cast}({0} {as} {bigint}) + ({0} > {cast}({0} {as} {bigint})))", getDataType(), argument);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -66,8 +66,9 @@ final class Floor<T extends Number> extends AbstractFunction<T> {
|
||||
|
||||
|
||||
|
||||
// [#8275] Improved emulation for SQLite
|
||||
case SQLITE:
|
||||
return DSL.round(argument.sub(0.499999999999999));
|
||||
return DSL.field("({cast}({0} {as} {bigint}) - ({0} < {cast}({0} {as} {bigint})))", getDataType(), argument);
|
||||
|
||||
default:
|
||||
return DSL.field("{floor}({0})", getDataType(), argument);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user