00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #pragma once
00021
00022 #include <drizzled/field.h>
00023
00024 namespace drizzled
00025 {
00026 class Item;
00027 typedef struct st_typelib TYPELIB;
00028
00035 class CreateField :public memory::SqlAlloc
00036 {
00037 public:
00038 const char *field_name;
00039 const char *change;
00040 const char *after;
00041 LEX_STRING comment;
00042 Item *def;
00043 enum enum_field_types sql_type;
00045 enum_field_types type() const
00046 {
00047 return sql_type;
00048 }
00049
00054 uint32_t length;
00059 uint32_t char_length;
00060 uint32_t decimals;
00061 uint32_t flags;
00062 uint32_t pack_length;
00063 uint32_t key_length;
00064 Field::utype unireg_check;
00065 TYPELIB *interval;
00066 List<String> interval_list;
00067 const CHARSET_INFO *charset;
00068 Field *field;
00069
00070 uint8_t interval_id;
00071 uint32_t offset;
00072
00073 CreateField() :after(0) {}
00074 CreateField(Field *field, Field *orig_field);
00075
00076 CreateField *clone(memory::Root *mem_root) const
00077 { return new (mem_root) CreateField(*this); }
00078 void create_length_to_internal_length(void);
00079
00080 inline enum column_format_type column_format() const
00081 {
00082 return (enum column_format_type)
00083 ((flags >> COLUMN_FORMAT_FLAGS) & COLUMN_FORMAT_MASK);
00084 }
00085
00091 void init_for_tmp_table(enum_field_types sql_type_arg,
00092 uint32_t max_length,
00093 uint32_t decimals,
00094 bool maybe_null);
00095
00117 bool init(Session *session,
00118 char *field_name,
00119 enum_field_types type,
00120 char *length,
00121 char *decimals,
00122 uint32_t type_modifier,
00123 Item *default_value,
00124 Item *on_update_value,
00125 LEX_STRING *comment,
00126 char *change,
00127 List<String> *interval_list,
00128 const CHARSET_INFO * const cs,
00129 uint32_t uint_geom_type,
00130 enum column_format_type column_format);
00131 };
00132
00133 std::ostream& operator<<(std::ostream& output, const CreateField &field);
00134
00135 }
00136