18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef DRIZZLE_SERVER_FIELD_ENUM
22
#define DRIZZLE_SERVER_FIELD_ENUM
24
class Field_enum :public Field_str {
21
#ifndef DRIZZLED_FIELD_ENUM_H
22
#define DRIZZLED_FIELD_ENUM_H
24
#include "drizzled/field/str.h"
26
class Field_enum :public Field_str
26
29
uint32_t packlength;
37
/** Internal storage for the string values of the ENUM */
29
39
Field_enum(unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg,
30
40
unsigned char null_bit_arg,
41
51
Field *new_field(MEM_ROOT *root, Table *new_table, bool keep_type);
42
enum_field_types type() const { return DRIZZLE_TYPE_ENUM; }
43
enum Item_result cmp_type () const { return INT_RESULT; }
44
enum Item_result cast_to_int_type () const { return INT_RESULT; }
45
52
enum ha_base_keytype key_type() const;
46
int store(const char *to,uint32_t length, const CHARSET_INFO * const charset);
53
int store(const char *to, uint32_t length, const CHARSET_INFO * const);
47
54
int store(double nr);
48
55
int store(int64_t nr, bool unsigned_val);
49
56
double val_real(void);
50
57
int64_t val_int(void);
51
String *val_str(String*,String *);
52
int cmp(const unsigned char *,const unsigned char *);
53
void sort_string(unsigned char *buff,uint32_t length);
54
uint32_t pack_length() const { return (uint32_t) packlength; }
58
String *val_str(String*, String *);
59
int cmp(const unsigned char *, const unsigned char *);
60
void sort_string(unsigned char *buff, uint32_t length);
55
61
void store_type(uint64_t value);
56
62
void sql_type(String &str) const;
57
uint32_t size_of() const { return sizeof(*this); }
58
enum_field_types real_type() const { return DRIZZLE_TYPE_ENUM; }
63
bool eq_def(Field *field);
64
enum_field_types type() const
66
return DRIZZLE_TYPE_ENUM;
68
enum Item_result cmp_type () const
72
enum Item_result cast_to_int_type () const
76
uint32_t pack_length() const
78
return (uint32_t) packlength;
80
uint32_t size_of() const
84
enum_field_types real_type() const
86
return DRIZZLE_TYPE_ENUM;
59
88
uint32_t pack_length_from_metadata(uint32_t field_metadata)
60
{ return (field_metadata & 0x00ff); }
61
uint32_t row_pack_length() { return pack_length(); }
62
virtual bool zero_pack() const { return 0; }
63
bool optimize_range(uint32_t idx __attribute__((unused)),
64
uint32_t part __attribute__((unused)))
66
bool eq_def(Field *field);
67
bool has_charset(void) const { return true; }
90
return (field_metadata & 0x00ff);
92
uint32_t row_pack_length()
96
virtual bool zero_pack() const
100
bool optimize_range(uint32_t, uint32_t)
104
bool has_charset(void) const
68
108
/* enum and set are sorted as integers */
69
109
const CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
71
111
int do_save_field_metadata(unsigned char *first_byte);
114
#endif /* DRIZZLED_FIELD_ENUM_H */