~drizzle-trunk/drizzle/development

642.1.1 by Lee
move functions from item.cc/item.h to item directory
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();
971.6.1 by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way.
71
  bool send(drizzled::plugin::Client *client, String *str_arg);
642.1.1 by Lee
move functions from item.cc/item.h to item directory
72
  void reset_field(Field *f);
73
  bool fix_fields(Session *, Item **);
846 by Brian Aker
Removing on typedeffed class.
74
  void fix_after_pullout(Select_Lex *new_parent, Item **ref);
1052.2.4 by Nathan Williams
No actual code changes. Changed Send_field to SendField to be consistent with coding standards.
75
  void make_field(SendField *tmp_field);
642.1.1 by Lee
move functions from item.cc/item.h to item directory
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;
848 by Brian Aker
typdef class removal (just... use the name of the class).
110
  friend class Select_Lex_Unit;
642.1.1 by Lee
move functions from item.cc/item.h to item directory
111
};
112
113
#endif /* DRIZZLED_ITEM_FIELD_H */