~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/enum.h

  • Committer: Brian Aker
  • Date: 2010-04-12 19:28:43 UTC
  • mfrom: (1455.5.1 bug561739)
  • Revision ID: brian@gaz-20100412192843-mu6gouk7pq74drts
Merge Jay

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;
31
33
public:
32
34
 
33
35
  using Field::store;
35
37
  using Field::val_str;
36
38
  using Field::cmp;
37
39
 
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,
47
48
             TYPELIB *typelib_arg,
48
49
             const CHARSET_INFO * const charset_arg)
49
50
    :Field_str(ptr_arg,
52
53
               null_bit_arg,
53
54
                     field_name_arg,
54
55
               charset_arg),
 
56
    packlength(packlength_arg),
55
57
    typelib(typelib_arg)
56
58
  {
57
59
    flags|= ENUM_FLAG;
58
60
  }
59
61
  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; }
 
62
  enum ha_base_keytype key_type() const;
61
63
  int  store(const char *to, uint32_t length, const CHARSET_INFO * const);
62
64
  int  store(double nr);
63
65
  int  store(int64_t nr, bool unsigned_val);
81
83
  {
82
84
    return INT_RESULT;
83
85
  }
84
 
  uint32_t pack_length() const { return 4; }
 
86
  uint32_t pack_length() const
 
87
  {
 
88
    return (uint32_t) packlength;
 
89
  }
85
90
  uint32_t size_of() const
86
91
  {
87
92
    return sizeof(*this);
90
95
  {
91
96
    return DRIZZLE_TYPE_ENUM;
92
97
  }
 
98
  uint32_t pack_length_from_metadata(uint32_t field_metadata)
 
99
  {
 
100
    return (field_metadata & 0x00ff);
 
101
  }
93
102
  virtual bool zero_pack() const
94
103
  {
95
104
    return false;
96
105
  }
97
 
  bool optimize_range(uint32_t, uint32_t)
 
106
  bool optimize_range(uint32_t, uint32_t) 
98
107
  {
99
108
    return false;
100
109
  }