diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-08-21 15:20:34 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-08-21 15:20:34 +0300 |
commit | 9258097fa3617b720b2b518060c0d09a00455051 (patch) | |
tree | 0d9e98513620fdb440f1d0f78351ca794a0f731d /sql/field.h | |
parent | cdc8debcaad6ee18ff7a146ab3f365367fe8ec93 (diff) | |
parent | dc7c080369472f6f33344299d2e3d01619edf885 (diff) | |
download | mariadb-git-9258097fa3617b720b2b518060c0d09a00455051.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h index 22c276478b6..ae6adec07e8 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1448,6 +1448,17 @@ public: /* Hash value */ virtual void hash(ulong *nr, ulong *nr2); + /** + Get the upper limit of the MySQL integral and floating-point type. + + @return maximum allowed value for the field + */ + virtual ulonglong get_max_int_value() const + { + DBUG_ASSERT(false); + return 0ULL; + } + /** Checks whether a string field is part of write_set. @@ -2006,6 +2017,11 @@ public: *to= *from; return from + 1; } + + virtual ulonglong get_max_int_value() const + { + return unsigned_flag ? 0xFFULL : 0x7FULL; + } }; @@ -2047,6 +2063,10 @@ public: virtual const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, uint param_data) { return unpack_int16(to, from, from_end); } + virtual ulonglong get_max_int_value() const + { + return unsigned_flag ? 0xFFFFULL : 0x7FFFULL; + } }; class Field_medium :public Field_integer { @@ -2080,6 +2100,10 @@ public: { return Field::pack(to, from, max_length); } + virtual ulonglong get_max_int_value() const + { + return unsigned_flag ? 0xFFFFFFULL : 0x7FFFFFULL; + } }; @@ -2125,6 +2149,10 @@ public: { return unpack_int32(to, from, from_end); } + virtual ulonglong get_max_int_value() const + { + return unsigned_flag ? 0xFFFFFFFFULL : 0x7FFFFFFFULL; + } }; @@ -2174,6 +2202,10 @@ public: { return unpack_int64(to, from, from_end); } + virtual ulonglong get_max_int_value() const + { + return unsigned_flag ? 0xFFFFFFFFFFFFFFFFULL : 0x7FFFFFFFFFFFFFFFULL; + } }; @@ -2213,6 +2245,13 @@ public: uint32 pack_length() const { return sizeof(float); } uint row_pack_length() const { return pack_length(); } void sql_type(String &str) const; + virtual ulonglong get_max_int_value() const + { + /* + We use the maximum as per IEEE754-2008 standard, 2^24 + */ + return 0x1000000ULL; + } private: int do_save_field_metadata(uchar *first_byte); }; @@ -2265,6 +2304,13 @@ public: uint32 pack_length() const { return sizeof(double); } uint row_pack_length() const { return pack_length(); } void sql_type(String &str) const; + virtual ulonglong get_max_int_value() const + { + /* + We use the maximum as per IEEE754-2008 standard, 2^53 + */ + return 0x20000000000000ULL; + } private: int do_save_field_metadata(uchar *first_byte); }; |