Drizzled Public API Documentation

create_field.h
1 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
5  *
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; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #pragma once
21 
22 #include <drizzled/field.h>
23 
24 namespace drizzled {
25 
33 {
34 public:
35  const char *field_name;
36  const char *change;
37  const char *after;
39  Item *def;
40  enum_field_types sql_type;
42  enum_field_types type() const
43  {
44  return sql_type;
45  }
46 
51  uint32_t length;
56  uint32_t char_length;
57  uint32_t decimals;
58  uint32_t flags;
59  uint32_t pack_length;
60  uint32_t key_length;
61  Field::utype unireg_check;
63  List<String> interval_list;
65  Field *field; // For alter table
66 
67  uint8_t interval_id; // For rea_create_table
68  uint32_t offset;
69 
70  CreateField() :after(0) {}
71  CreateField(Field *field, Field *orig_field);
73 
74  inline enum column_format_type column_format() const
75  {
76  return (enum column_format_type)
77  ((flags >> COLUMN_FORMAT_FLAGS) & COLUMN_FORMAT_MASK);
78  }
79 
85  void init_for_tmp_table(enum_field_types sql_type_arg,
86  uint32_t max_length,
87  uint32_t decimals,
88  bool maybe_null);
89 
111  bool init(Session*,
112  const char *field_name,
113  enum_field_types type,
114  const char *length,
115  const char *decimals,
116  uint32_t type_modifier,
118  const char *change,
119  List<String> *interval_list,
120  const charset_info_st*,
121  uint32_t uint_geom_type,
122  column_format_type column_format);
123 
124  bool setDefaultValue(Item *default_value, Item *on_update_item);
125 };
126 
127 std::ostream& operator<<(std::ostream&, const CreateField&);
128 
129 } /* namespace drizzled */
130