559
Detect Item_result by given field type of UNION merge result.
561
@param field_type given field type
564
Item_result (type of internal MySQL expression result)
567
559
Item_result Field::result_merge_type(enum_field_types field_type)
569
561
assert(field_type <= DRIZZLE_TYPE_MAX);
570
562
return field_types_result_type[field_type];
566
bool Field::eq(Field *field)
568
return (ptr == field->ptr && null_ptr == field->null_ptr &&
569
null_bit == field->null_bit);
573
uint32_t Field::pack_length() const
579
uint32_t Field::pack_length_in_rec() const
581
return pack_length();
585
uint32_t Field::pack_length_from_metadata(uint32_t field_metadata)
587
return field_metadata;
591
uint32_t Field::row_pack_length()
597
int Field::save_field_metadata(unsigned char *first_byte)
599
return do_save_field_metadata(first_byte);
603
uint32_t Field::data_length()
605
return pack_length();
609
uint32_t Field::used_length()
611
return pack_length();
615
uint32_t Field::sort_length() const
617
return pack_length();
621
uint32_t Field::max_data_length() const
623
return pack_length();
627
int Field::reset(void)
629
memset(ptr, 0, pack_length());
634
void Field::reset_fields()
638
void Field::set_default()
640
my_ptrdiff_t l_offset= (my_ptrdiff_t) (table->getDefaultValues() - table->record[0]);
641
memcpy(ptr, ptr + l_offset, pack_length());
643
*null_ptr= ((*null_ptr & (unsigned char) ~null_bit) | (null_ptr[l_offset] & null_bit));
647
bool Field::binary() const
653
bool Field::zero_pack() const
659
enum ha_base_keytype Field::key_type() const
661
return HA_KEYTYPE_BINARY;
665
uint32_t Field::key_length() const
667
return pack_length();
671
enum_field_types Field::real_type() const
677
int Field::cmp_max(const unsigned char *a, const unsigned char *b, uint32_t)
683
int Field::cmp_binary(const unsigned char *a,const unsigned char *b, uint32_t)
685
return memcmp(a,b,pack_length());
689
int Field::cmp_offset(uint32_t row_offset)
691
return cmp(ptr,ptr+row_offset);
695
int Field::cmp_binary_offset(uint32_t row_offset)
697
return cmp_binary(ptr, ptr+row_offset);
701
int Field::key_cmp(const unsigned char *a,const unsigned char *b)
707
int Field::key_cmp(const unsigned char *str, uint32_t)
713
uint32_t Field::decimals() const
719
bool Field::is_null(my_ptrdiff_t row_offset)
722
(null_ptr[row_offset] & null_bit ? true : false) :
727
bool Field::is_real_null(my_ptrdiff_t row_offset)
729
return null_ptr ? (null_ptr[row_offset] & null_bit ? true : false) : false;
733
bool Field::is_null_in_record(const unsigned char *record)
737
return test(record[(uint32_t) (null_ptr -table->record[0])] &
742
bool Field::is_null_in_record_with_offset(my_ptrdiff_t offset)
746
return test(null_ptr[offset] & null_bit);
750
void Field::set_null(my_ptrdiff_t row_offset)
753
null_ptr[row_offset]|= null_bit;
757
void Field::set_notnull(my_ptrdiff_t row_offset)
760
null_ptr[row_offset]&= (unsigned char) ~null_bit;
764
bool Field::maybe_null(void)
766
return null_ptr != 0 || table->maybe_null;
770
bool Field::real_maybe_null(void)
772
return null_ptr != 0;
776
size_t Field::last_null_byte() const
778
size_t bytes= do_last_null_byte();
779
assert(bytes <= table->getNullBytes());
573
784
/*****************************************************************************
574
785
Static help functions
575
786
*****************************************************************************/
579
Check whether a field type can be partially indexed by a key.
581
This is a static method, rather than a virtual function, because we need
582
to check the type of a non-Field in mysql_alter_table().
584
@param type field type
587
true Type can have a prefixed key
589
false Type can not have a prefixed key
592
788
bool Field::type_can_have_key_part(enum enum_field_types type)
710
913
/// This is used as a table name when the table structure is not set up
711
914
Field::Field(unsigned char *ptr_arg,uint32_t length_arg,unsigned char *null_ptr_arg,
712
unsigned char null_bit_arg,
713
utype unireg_check_arg, const char *field_name_arg)
915
unsigned char null_bit_arg,
916
utype unireg_check_arg, const char *field_name_arg)
714
917
:ptr(ptr_arg), null_ptr(null_ptr_arg),
715
918
table(0), orig_table(0), table_name(0),
716
919
field_name(field_name_arg),
717
920
key_start(0), part_of_key(0), part_of_key_not_clustered(0),
718
921
part_of_sortkey(0), unireg_check(unireg_check_arg),
719
field_length(length_arg), null_bit(null_bit_arg),
922
field_length(length_arg), null_bit(null_bit_arg),
720
923
is_created_from_null_item(false),
721
924
vcol_info(NULL), is_stored(true)
1131
const unsigned char *Field::unpack(unsigned char* to,
1132
const unsigned char *from)
1134
const unsigned char *result= unpack(to, from, 0U,
1135
table->s->db_low_byte_first);
1140
uint32_t Field::packed_col_length(const unsigned char *, uint32_t length)
1146
int Field::pack_cmp(const unsigned char *a, const unsigned char *b,
1153
int Field::pack_cmp(const unsigned char *b, uint32_t, bool)
915
1159
my_decimal *Field::val_decimal(my_decimal *)
917
1161
/* This never have to be called */