119#define portable_sizeof_char_ptr 8
256#define IS_EQUAL_YES 1
257#define IS_EQUAL_PACK_LENGTH 2
259#define my_charset_numeric my_charset_latin1
260#define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII
288 return elements < 256 ? 1 : 2;
292 const uint len = (elements + 7) / 8;
293 return len > 4 ? 8 : len;
335#define ASSERT_COLUMN_MARKED_FOR_READ \
337 (!table->read_set || bitmap_is_set(table->read_set, field_index())))
338#define ASSERT_COLUMN_MARKED_FOR_WRITE \
339 assert(!table || (!table->write_set || \
340 bitmap_is_set(table->write_set, field_index())))
420 switch (pack_length) {
453template <
bool Is_big_endian>
456 if (to_length == 0)
return;
458 std::copy(from, from + std::min(to_length, from_length), to);
460 to[0] =
static_cast<char>(to[0] ^ 128);
462 const uchar *from_end = from + from_length;
463 const uchar *from_start = from_end - std::min(from_length, to_length);
464 std::reverse_copy(from_start, from_end, to);
466 to[0] =
static_cast<char>(to[0] ^ 128);
885 uchar null_bit_arg,
uchar auto_flags_arg,
const char *field_name_arg);
940 return store(nr,
false);
1077 return field_metadata;
1193 uint max_len [[maybe_unused]])
const {
1198 uint32 max_length [[maybe_unused]] = ~0
L)
const {
1282 void set_null(ptrdiff_t row_offset = 0);
1361 size_t trunc_pos [[maybe_unused]])
const {
1383 uchar *new_null_ptr, uint new_null_bit)
const {
1385 field->
move_field(new_ptr, new_null_ptr, new_null_bit);
1390 uchar *new_null_ptr, uint new_null_bit)
const;
1475 return return_value;
1551 uint max_length)
const {
1552 return pack(to, from, max_length);
1578 ulonglong value_options [[maybe_unused]])
const {
1592 void copy_data(ptrdiff_t src_record_offset);
1643 int cut_increment) {
1644 return set_warning(level, code, cut_increment,
nullptr,
nullptr);
1648 int cut_increment,
const char *view_db,
1649 const char *view_name);
1677 bool *has_overflow);
1729 virtual void hash(ulong *nr, ulong *nr2)
const;
1793 KEY *cur_index_info)
const;
1854 [[maybe_unused]])
const {
1970 const char *field_name_arg,
uint8 dec_arg,
bool zero_arg,
1991 size_t length,
const char *int_end,
2055 const char *well_formed_error_pos,
const char *cannot_convert_error_pos,
2056 const char *from_end_pos,
const char *
end,
bool count_spaces,
2062 const char *field_name_arg,
const CHARSET_INFO *charset_arg)
2063 :
Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2064 field_name_arg, charset_arg) {}
2077 TR_POSITIVE_OVERFLOW = 1,
2078 TR_NEGATIVE_OVERFLOW = 2
2083 const char *field_name_arg,
uint8 dec_arg,
bool zero_arg,
2085 :
Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2086 field_name_arg, dec_arg, zero_arg, unsigned_arg),
2104 const char *field_name_arg,
uint8 dec_arg,
bool zero_arg,
2106 :
Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2107 field_name_arg, dec_arg, zero_arg, unsigned_arg) {}
2122 void overflow(
bool negative);
2151 bool m_keep_precision{
false};
2166 const char *field_name_arg,
uint8 dec_arg,
bool zero_arg,
2169 const char *field_name_arg,
uint8 dec_arg,
2176 void set_value_on_overflow(
my_decimal *decimal_value,
bool sign) const;
2198 int *order_var)
const final;
2205 static Field *create_from_item(
const Item *item);
2214 const char *field_name_arg,
bool zero_arg,
bool unsigned_arg)
2215 :
Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2216 field_name_arg, 0, zero_arg, unsigned_arg) {}
2221 field_name_arg, 0, false, unsigned_arg) {}
2246 if (max_length > 0) *to = *from;
2251 uint param_data [[maybe_unused]])
final {
2265 const char *field_name_arg,
bool zero_arg,
bool unsigned_arg)
2266 :
Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2267 field_name_arg, 0, zero_arg, unsigned_arg) {}
2272 field_name_arg, 0, false, unsigned_arg) {}
2274 :
Field_short(len_arg, false, field_name_arg, unsigned_arg) {}
2303 uint param_data [[maybe_unused]])
final {
2316 const char *field_name_arg,
bool zero_arg,
bool unsigned_arg)
2317 :
Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2318 field_name_arg, 0, zero_arg, unsigned_arg) {}
2323 field_name_arg, 0, false, unsigned_arg) {}
2354 static const int PACK_LENGTH = 4;
2358 const char *field_name_arg,
bool zero_arg,
bool unsigned_arg)
2359 :
Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2360 field_name_arg, 0, zero_arg, unsigned_arg) {}
2365 field_name_arg, 0, false, unsigned_arg) {}
2395 uint param_data [[maybe_unused]])
final {
2400 return is_unsigned() ? 0xFFFFFFFFULL : 0x7FFFFFFFULL;
2406 static const int PACK_LENGTH = 8;
2410 const char *field_name_arg,
bool zero_arg,
bool unsigned_arg)
2411 :
Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2412 field_name_arg, 0, zero_arg, unsigned_arg) {}
2414 const char *field_name_arg,
bool unsigned_arg)
2417 field_name_arg, 0, false, unsigned_arg) {}
2446 uint param_data [[maybe_unused]])
final {
2451 return is_unsigned() ? 0xFFFFFFFFFFFFFFFFULL : 0x7FFFFFFFFFFFFFFFULL;
2459 const char *field_name_arg,
uint8 dec_arg,
bool zero_arg,
2461 :
Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2462 field_name_arg, dec_arg, zero_arg, unsigned_arg) {}
2464 uint8 dec_arg,
bool unsigned_arg)
2467 field_name_arg, dec_arg, false, unsigned_arg) {}
2492 return 0x1000000ULL;
2503 const char *field_name_arg,
uint8 dec_arg,
bool zero_arg,
2505 :
Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2506 field_name_arg, dec_arg, zero_arg, unsigned_arg) {}
2511 field_name_arg, dec_arg, false, false) {}
2513 uint8 dec_arg,
bool unsigned_arg)
2516 field_name_arg, dec_arg, false, unsigned_arg) {}
2518 uint8 dec_arg,
bool unsigned_arg,
bool not_fixed_arg)
2521 field_name_arg, dec_arg, false, unsigned_arg) {
2522 not_fixed = not_fixed_arg;
2548 return 0x20000000000000ULL;
2563 field_name_arg,
cs) {}
2753 [[nodiscard]]
bool set_datetime_warning(
2756 int truncate_increment);
2770 uchar auto_flags_arg,
const char *field_name_arg,
2774 ((normalize_dec(dec_arg)) ? normalize_dec(dec_arg) + 1 : 0),
2775 null_ptr_arg, null_bit_arg, auto_flags_arg, field_name_arg) {
2777 dec = normalize_dec(dec_arg);
2806 return date_flags(thd);
2826 return get_date_internal(ltime);
2834 bool get_internal_check_zero(
MYSQL_TIME *ltime,
2845 int *warnings)
final;
2861 const char *field_name_arg,
uint8 int_length_arg,
2863 :
Field_temporal(ptr_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
2864 field_name_arg, int_length_arg, dec_arg) {}
2901 void init_timestamp_flags();
2923 const char *field_name_arg,
uint8 dec_arg)
2925 auto_flags_arg, field_name_arg,
2954 const char *field_name_arg,
uint8 dec_arg)
2956 auto_flags_arg, field_name_arg,
2984 bool get_date_internal(
MYSQL_TIME *ltime)
const final;
2985 bool get_date_internal_at_utc(
MYSQL_TIME *ltime)
const final;
2986 void store_timestamp_internal(
const my_timeval *tm)
final;
2989 static const int PACK_LENGTH = 4;
2992 const char *field_name_arg);
3015 uint param_data [[maybe_unused]])
final {
3040 bool get_date_internal(
MYSQL_TIME *ltime)
const final;
3041 bool get_date_internal_at_utc(
MYSQL_TIME *ltime)
const final;
3045 void store_timestamp_internal(
const my_timeval *tm)
override;
3058 uchar auto_flags_arg,
const char *field_name_arg,
3109 enum Limits { MIN_YEAR = 1901, MAX_YEAR = 2155 };
3111 uchar auto_flags_arg,
const char *field_name_arg)
3112 :
Field_tiny(ptr_arg, 4, null_ptr_arg, null_bit_arg, auto_flags_arg,
3113 field_name_arg, true, true) {}
3116 0,
NONE, field_name_arg, true, true) {}
3137 static const int PACK_LENGTH = 3;
3139 bool get_date_internal(
MYSQL_TIME *ltime)
const final;
3145 uchar auto_flags_arg,
const char *field_name_arg)
3197 int *
error)
override = 0;
3203 int *warnings)
final;
3219 uchar auto_flags_arg,
const char *field_name_arg,
3221 :
Field_temporal(ptr_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
3241 uchar auto_flags_arg,
const char *field_name_arg)
3243 field_name_arg, 0) {}
3289 uchar auto_flags_arg,
const char *field_name_arg,
uint8 dec_arg)
3291 field_name_arg, dec_arg) {}
3301 NONE, field_name_arg, dec_arg) {}
3345 bool get_date_internal(
MYSQL_TIME *ltime)
const final;
3347 void store_timestamp_internal(
const my_timeval *tm)
final;
3350 static const int PACK_LENGTH = 8;
3365 uchar auto_flags_arg,
const char *field_name_arg)
3367 auto_flags_arg, field_name_arg, 0) {}
3370 field_name_arg, 0) {}
3393 uint param_data [[maybe_unused]])
final {
3403 bool get_date_internal(
MYSQL_TIME *ltime)
const final;
3407 void store_timestamp_internal(
const my_timeval *tm)
final;
3420 uchar auto_flags_arg,
const char *field_name_arg,
3423 auto_flags_arg, field_name_arg,
3435 field_name_arg, dec_arg) {}
3464 :
Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
3465 auto_flags_arg, field_name_arg,
cs) {}
3470 field_name_arg,
cs) {}
3496 const char *
string = pointer_cast<const char *>(
ptr);
3508 DBUG_PRINT(
"debug", (
"field_metadata: 0x%04x", field_metadata));
3510 return (((field_metadata >> 4) & 0x300) ^ 0x300) +
3511 (field_metadata & 0x00ff);
3514 uint16 mflags,
int *order_var)
const final;
3572 uint32 max_length = ~0
L)
const final;
3583 uchar *new_null_ptr, uint new_null_bit)
const final;
3590 void hash(ulong *nr, ulong *nr2)
const final;
3681 bool m_uses_backup{
false};
3690 memmove(
ptr + packlength, &from,
sizeof(
char *));
3695 uchar auto_flags_arg,
const char *field_name_arg,
3702 field_name_arg,
cs),
3704 m_keep_old_value(false) {
3706 if (set_packlength) {
3707 packlength = len_arg <= 255
3709 : len_arg <= 65535 ? 2 : len_arg <= 16777215 ? 3 : 4;
3716 packlength(field.packlength),
3719 m_keep_old_value(field.m_keep_old_value),
3750 uint32 max_length = ~0
L)
const override;
3774 void store_length(
uchar *i_ptr, uint i_packlength,
uint32 i_number);
3776 store_length(
ptr, packlength, number);
3779 return get_length(row_offset);
3781 uint32 get_length(ptrdiff_t row_offset = 0)
const;
3789 return get_blob_data(
ptr + packlength + row_offset);
3801 memcpy(&data, position,
sizeof(data));
3808 memcpy(
ptr + packlength, &data,
sizeof(
char *));
3812 store_length(ptr_ofs, packlength,
length);
3813 memcpy(ptr_ofs + packlength, &data,
sizeof(
char *));
3816 set_ptr_offset(0,
length, data);
3829 uint max_length)
const final;
3869 m_keep_old_value = old_value_flag;
3912 if (m_keep_old_value) {
3914 m_keep_old_value =
false;
3922 store_ptr_and_length(from,
length);
3933 bool backup_blob_field();
3939 void restore_blob_backup();
3948 static const uint32 precision =
sizeof(float);
3950 return precision * dimensions;
3960 :
Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
3961 field_name_arg, share, blob_pack_length,
cs) {
3963 assert(packlength == 4);
3968 :
Field_blob(len_arg, is_nullable_arg, field_name_arg,
cs, false) {
3970 assert(packlength == 4);
3974 assert(packlength == 4);
3981 "vector", get_max_dimensions());
4014 uchar auto_flags_arg,
const char *field_name_arg,
4016 enum geometry_type geom_type_arg, std::optional<gis::srid_t> srid)
4017 :
Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
4020 geom_type(geom_type_arg) {}
4022 enum geometry_type geom_type_arg, std::optional<gis::srid_t> srid)
4026 geom_type(geom_type_arg) {}
4044 if (res !=
TYPE_OK)
return res;
4057 std::optional<gis::srid_t>
get_srid()
const {
return m_srid; }
4067 uchar auto_flags_arg,
const char *field_name_arg,
4069 :
Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, auto_flags_arg,
4126 longlong get_diff_vector_and_length(
4133 bool is_before_image_equal_to_after_image()
const;
4144 bool unpack_diff(
const uchar **from);