summaryrefslogtreecommitdiff
path: root/sql/sql_type.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 14:49:17 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-03 14:49:17 +0200
commit533a13af069d8c9e6c5f4e1a72851497185ade03 (patch)
tree4623752e0c114e582fbbc0afcc02b67dede26b50 /sql/sql_type.h
parent4b3690b50433a169d9feed5dc45044a8934b5582 (diff)
parente6290a8270daf884f551230307225b358939bfab (diff)
downloadmariadb-git-533a13af069d8c9e6c5f4e1a72851497185ade03.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/sql_type.h')
-rw-r--r--sql/sql_type.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/sql_type.h b/sql/sql_type.h
index c1b13dfa811..939c651233c 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -230,7 +230,7 @@ class Dec_ptr_and_buffer: public Dec_ptr
protected:
my_decimal m_buffer;
public:
- int round_to(my_decimal *to, uint scale, decimal_round_mode mode)
+ int round_to(my_decimal *to, int scale, decimal_round_mode mode)
{
DBUG_ASSERT(m_ptr);
return m_ptr->round_to(to, scale, mode);
@@ -239,6 +239,14 @@ public:
{
return round_to(&m_buffer, scale, mode);
}
+ int round_self_if_needed(int scale, decimal_round_mode mode)
+ {
+ if (scale >= m_ptr->frac)
+ return E_DEC_OK;
+ int res= m_ptr->round_to(&m_buffer, scale, mode);
+ m_ptr= &m_buffer;
+ return res;
+ }
String *to_string_round(String *to, uint dec)
{
/*
@@ -3647,6 +3655,8 @@ public:
const Type_std_attributes *item,
SORT_FIELD_ATTR *attr) const= 0;
+ virtual bool is_packable() const { return false; }
+
virtual uint32 max_display_length(const Item *item) const= 0;
virtual uint32 Item_decimal_notation_int_digits(const Item *item) const { return 0; }
virtual uint32 calc_pack_length(uint32 length) const= 0;
@@ -4788,7 +4798,11 @@ public:
void sortlength(THD *thd,
const Type_std_attributes *item,
SORT_FIELD_ATTR *attr) const;
+
+ bool is_packable()const { return true; }
+
bool union_element_finalize(const Item * item) const;
+
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,