~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/enum.h

Merge in Joe's transaction id code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
namespace drizzled
27
27
{
28
28
 
29
 
class Field_enum :public Field_str 
 
29
class Field_enum :public Field_str
30
30
{
31
 
protected:
32
 
  uint32_t packlength;
33
31
public:
34
32
 
35
33
  using Field::store;
37
35
  using Field::val_str;
38
36
  using Field::cmp;
39
37
 
 
38
  static const int max_supported_elements = 0x10000;
 
39
 
40
40
  /** Internal storage for the string values of the ENUM */
41
41
  TYPELIB *typelib;
42
42
  Field_enum(unsigned char *ptr_arg,
44
44
             unsigned char *null_ptr_arg,
45
45
             unsigned char null_bit_arg,
46
46
             const char *field_name_arg,
47
 
             uint32_t packlength_arg,
48
47
             TYPELIB *typelib_arg,
49
48
             const CHARSET_INFO * const charset_arg)
50
49
    :Field_str(ptr_arg,
53
52
               null_bit_arg,
54
53
                     field_name_arg,
55
54
               charset_arg),
56
 
    packlength(packlength_arg),
57
55
    typelib(typelib_arg)
58
56
  {
59
57
    flags|= ENUM_FLAG;
60
58
  }
61
59
  Field *new_field(memory::Root *root, Table *new_table, bool keep_type);
62
 
  enum ha_base_keytype key_type() const;
 
60
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
63
61
  int  store(const char *to, uint32_t length, const CHARSET_INFO * const);
64
62
  int  store(double nr);
65
63
  int  store(int64_t nr, bool unsigned_val);
83
81
  {
84
82
    return INT_RESULT;
85
83
  }
86
 
  uint32_t pack_length() const
87
 
  {
88
 
    return (uint32_t) packlength;
89
 
  }
 
84
  uint32_t pack_length() const { return 4; }
90
85
  uint32_t size_of() const
91
86
  {
92
87
    return sizeof(*this);
95
90
  {
96
91
    return DRIZZLE_TYPE_ENUM;
97
92
  }
98
 
  uint32_t pack_length_from_metadata(uint32_t field_metadata)
99
 
  {
100
 
    return (field_metadata & 0x00ff);
101
 
  }
102
93
  virtual bool zero_pack() const
103
94
  {
104
95
    return false;
105
96
  }
106
 
  bool optimize_range(uint32_t, uint32_t) 
 
97
  bool optimize_range(uint32_t, uint32_t)
107
98
  {
108
99
    return false;
109
100
  }