1
/* - mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 MySQL
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef DRIZZLED_FIELD_ENUM_H
22
#define DRIZZLED_FIELD_ENUM_H
24
#include "drizzled/field/str.h"
29
class Field_enum :public Field_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,
45
unsigned char null_bit_arg,
46
const char *field_name_arg,
48
const CHARSET_INFO * const charset_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);
63
int store(int64_t nr, bool unsigned_val);
64
double val_real(void);
65
int64_t val_int(void);
66
String *val_str(String*, String *);
67
int cmp(const unsigned char *, const unsigned char *);
68
void sort_string(unsigned char *buff, uint32_t length);
69
void store_type(uint64_t value);
70
void sql_type(String &str) const;
71
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
105
/* enum and set are sorted as integers */
106
const CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
109
} /* namespace drizzled */
111
#endif /* DRIZZLED_FIELD_ENUM_H */