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
00032 class CreateField : public memory::SqlAlloc
00033 {
00034 public:
00035 const char *field_name;
00036 const char *change;
00037 const char *after;
00038 str_ref comment;
00039 Item *def;
00040 enum_field_types sql_type;
00042 enum_field_types type() const
00043 {
00044 return sql_type;
00045 }
00046
00051 uint32_t length;
00056 uint32_t char_length;
00057 uint32_t decimals;
00058 uint32_t flags;
00059 uint32_t pack_length;
00060 uint32_t key_length;
00061 Field::utype unireg_check;
00062 TYPELIB *interval;
00063 List<String> interval_list;
00064 const charset_info_st *charset;
00065 Field *field;
00066
00067 uint8_t interval_id;
00068 uint32_t offset;
00069
00070 CreateField() :after(0) {}
00071 CreateField(Field *field, Field *orig_field);
00072 void create_length_to_internal_length(void);
00073
00074 inline enum column_format_type column_format() const
00075 {
00076 return (enum column_format_type)
00077 ((flags >> COLUMN_FORMAT_FLAGS) & COLUMN_FORMAT_MASK);
00078 }
00079
00085 void init_for_tmp_table(enum_field_types sql_type_arg,
00086 uint32_t max_length,
00087 uint32_t decimals,
00088 bool maybe_null);
00089
00111 bool init(Session*,
00112 const char *field_name,
00113 enum_field_types type,
00114 const char *length,
00115 const char *decimals,
00116 uint32_t type_modifier,
00117 str_ref comment,
00118 const char *change,
00119 List<String> *interval_list,
00120 const charset_info_st*,
00121 uint32_t uint_geom_type,
00122 column_format_type column_format);
00123
00124 bool setDefaultValue(Item *default_value, Item *on_update_item);
00125 };
00126
00127 std::ostream& operator<<(std::ostream&, const CreateField&);
00128
00129 }
00130