~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/field.h

Merged vcol stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 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
 
#ifndef DRIZZLED_ITEM_FIELD_H
21
 
#define DRIZZLED_ITEM_FIELD_H
22
 
 
23
 
#include <drizzled/item/ident.h>
24
 
 
25
 
namespace drizzled
26
 
{
27
 
 
28
 
class COND_EQUAL;
29
 
class Item;
30
 
 
31
 
extern Item **not_found_item;
32
 
 
33
 
class Item_field :public Item_ident
34
 
{
35
 
protected:
36
 
  void set_field(Field *field);
37
 
public:
38
 
  Field *field,*result_field;
39
 
  Item_equal *item_equal;
40
 
  bool no_const_subst;
41
 
  /*
42
 
    if any_privileges set to true then here real effective privileges will
43
 
    be stored
44
 
  */
45
 
  uint32_t have_privileges;
46
 
  /* field need any privileges (for VIEW creation) */
47
 
  bool any_privileges;
48
 
  Item_field(Name_resolution_context *context_arg,
49
 
             const char *db_arg,const char *table_name_arg,
50
 
             const char *field_name_arg);
51
 
  /*
52
 
    Constructor needed to process subselect with temporary tables (see Item)
53
 
  */
54
 
  Item_field(Session *session, Item_field *item);
55
 
  /*
56
 
    Constructor used inside setup_wild(), ensures that field, table,
57
 
    and database names will live as long as Item_field (this is important
58
 
    in prepared statements).
59
 
  */
60
 
  Item_field(Session *session, Name_resolution_context *context_arg, Field *field);
61
 
  /*
62
 
    If this constructor is used, fix_fields() won't work, because
63
 
    db_name, table_name and column_name are unknown. It's necessary to call
64
 
    reset_field() before fix_fields() for all fields created this way.
65
 
  */
66
 
  Item_field(Field *field);
67
 
  enum Type type() const { return FIELD_ITEM; }
68
 
  bool eq(const Item *item, bool binary_cmp) const;
69
 
  double val_real();
70
 
  int64_t val_int();
71
 
  type::Decimal *val_decimal(type::Decimal *);
72
 
  String *val_str(String*);
73
 
  double val_result();
74
 
  int64_t val_int_result();
75
 
  String *str_result(String* tmp);
76
 
  type::Decimal *val_decimal_result(type::Decimal *);
77
 
  bool val_bool_result();
78
 
  bool send(plugin::Client *client, String *str_arg);
79
 
  void reset_field(Field *f);
80
 
  bool fix_fields(Session *, Item **);
81
 
  void fix_after_pullout(Select_Lex *new_parent, Item **ref);
82
 
  void make_field(SendField *tmp_field);
83
 
  int save_in_field(Field *field,bool no_conversions);
84
 
  void save_org_in_field(Field *field);
85
 
  table_map used_tables() const;
86
 
  enum Item_result result_type () const;
87
 
  Item_result cast_to_int_type() const;
88
 
  enum_field_types field_type() const;
89
 
  int64_t val_int_endpoint(bool left_endp, bool *incl_endp);
90
 
  Field *get_tmp_table_field() { return result_field; }
91
 
  Field *tmp_table_field(Table *) { return result_field; }
92
 
  bool get_date(type::Time &ltime,uint32_t fuzzydate);
93
 
  bool get_date_result(type::Time &ltime, uint32_t fuzzydate);
94
 
  bool get_time(type::Time &ltime);
95
 
  bool is_null();
96
 
  void update_null_value();
97
 
  Item *get_tmp_table_item(Session *session);
98
 
  bool collect_item_field_processor(unsigned char * arg);
99
 
  bool find_item_in_field_list_processor(unsigned char *arg);
100
 
  bool register_field_in_read_map(unsigned char *arg);
101
 
  void cleanup();
102
 
  bool result_as_int64_t();
103
 
  Item_equal *find_item_equal(COND_EQUAL *cond_equal);
104
 
  bool subst_argument_checker(unsigned char **arg);
105
 
  Item *equal_fields_propagator(unsigned char *arg);
106
 
  bool set_no_const_sub(unsigned char *arg);
107
 
  Item *replace_equal_field(unsigned char *arg);
108
 
  uint32_t max_disp_length();
109
 
  Item *safe_charset_converter(const CHARSET_INFO * const tocs);
110
 
  int fix_outer_field(Session *session, Field **field, Item **reference);
111
 
  virtual Item *update_value_transformer(unsigned char *select_arg);
112
 
  virtual void print(String *str, enum_query_type query_type);
113
 
 
114
 
  friend class Item_default_value;
115
 
  friend class Item_insert_value;
116
 
  friend class Select_Lex_Unit;
117
 
};
118
 
 
119
 
} /* namespace drizzled */
120
 
 
121
 
#endif /* DRIZZLED_ITEM_FIELD_H */