35
33
using Field::val_str;
38
static const int max_supported_elements = 0x10000;
40
/** Internal storage for the string values of the ENUM */
42
Field_enum(unsigned char *ptr_arg,
44
unsigned char *null_ptr_arg,
37
Field_enum(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
45
38
unsigned char null_bit_arg,
46
const char *field_name_arg,
39
enum utype unireg_check_arg, const char *field_name_arg,
40
uint32_t packlength_arg,
47
41
TYPELIB *typelib_arg,
48
42
const CHARSET_INFO * const charset_arg)
43
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
44
unireg_check_arg, field_name_arg, charset_arg),
45
packlength(packlength_arg),typelib(typelib_arg)
59
Field *new_field(memory::Root *root, Table *new_table, bool keep_type);
60
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
61
int store(const char *to, uint32_t length, const CHARSET_INFO * const);
49
Field *new_field(MEM_ROOT *root, Table *new_table, bool keep_type);
50
enum_field_types type() const { return DRIZZLE_TYPE_ENUM; }
51
enum Item_result cmp_type () const { return INT_RESULT; }
52
enum Item_result cast_to_int_type () const { return INT_RESULT; }
53
enum ha_base_keytype key_type() const;
54
int store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
62
55
int store(double nr);
63
56
int store(int64_t nr, bool unsigned_val);
64
double val_real(void) const;
65
int64_t val_int(void) const;
66
String *val_str(String*, String *) const;
67
int cmp(const unsigned char *, const unsigned char *);
68
void sort_string(unsigned char *buff, uint32_t length);
57
double val_real(void);
58
int64_t val_int(void);
59
String *val_str(String*,String *);
60
int cmp(const unsigned char *,const unsigned char *);
61
void sort_string(unsigned char *buff,uint32_t length);
62
uint32_t pack_length() const { return (uint32_t) packlength; }
69
63
void store_type(uint64_t value);
70
64
void sql_type(String &str) const;
65
uint32_t size_of() const { return sizeof(*this); }
66
enum_field_types real_type() const { return DRIZZLE_TYPE_ENUM; }
67
uint32_t pack_length_from_metadata(uint32_t field_metadata)
68
{ return (field_metadata & 0x00ff); }
69
uint32_t row_pack_length() { return pack_length(); }
70
virtual bool zero_pack() const { return 0; }
71
bool optimize_range(uint32_t, uint32_t)
71
73
bool eq_def(Field *field);
72
enum_field_types type() const
74
return DRIZZLE_TYPE_ENUM;
76
enum Item_result cmp_type () const
80
enum Item_result cast_to_int_type () const
84
uint32_t pack_length() const { return 4; }
85
uint32_t size_of() const
89
enum_field_types real_type() const
91
return DRIZZLE_TYPE_ENUM;
93
virtual bool zero_pack() const
97
bool optimize_range(uint32_t, uint32_t)
101
bool has_charset(void) const
74
bool has_charset(void) const { return true; }
105
75
/* enum and set are sorted as integers */
106
76
const CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
78
int do_save_field_metadata(unsigned char *first_byte);
109
} /* namespace drizzled */
111
#endif /* DRIZZLED_FIELD_ENUM_H */