~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/field.h

  • Committer: Brian Aker
  • Date: 2009-07-11 19:23:04 UTC
  • mfrom: (1089.1.14 merge)
  • Revision ID: brian@gaz-20090711192304-ootijyl5yf9jq9kd
Merge Brian

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