summaryrefslogtreecommitdiff
path: root/sql/my_decimal.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/my_decimal.h')
-rw-r--r--sql/my_decimal.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index b409a87bdd4..c6c6f4b55e3 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -304,6 +304,17 @@ bool my_decimal_is_zero(const my_decimal *decimal_value)
inline
+int my_decimal_round_if_needed(uint mask, my_decimal *dec, int scale,
+ bool truncate)
+{
+ if (scale >= dec->frac)
+ return E_DEC_OK;
+ return check_result(mask, decimal_round(dec, dec, scale,
+ (truncate ? TRUNCATE : HALF_UP)));
+}
+
+
+inline
int my_decimal_round(uint mask, const my_decimal *from, int scale,
bool truncate, my_decimal *to)
{