~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/ident.h

Moved my_alloc.h to mysys.

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_IDENT_H
21
 
#define DRIZZLED_ITEM_IDENT_H
22
 
 
23
 
extern uint32_t lower_case_table_names;
24
 
 
25
 
class Item_ident :public Item
26
 
{
27
 
protected:
28
 
  /*
29
 
    We have to store initial values of db_name, table_name and field_name
30
 
    to be able to restore them during cleanup() because they can be
31
 
    updated during fix_fields() to values from Field object and life-time
32
 
    of those is shorter than life-time of Item_field.
33
 
  */
34
 
  const char *orig_db_name;
35
 
  const char *orig_table_name;
36
 
  const char *orig_field_name;
37
 
 
38
 
public:
39
 
  Name_resolution_context *context;
40
 
  const char *db_name;
41
 
  const char *table_name;
42
 
  const char *field_name;
43
 
  bool alias_name_used; /* true if item was resolved against alias */
44
 
  /*
45
 
    Cached value of index for this field in table->field array, used by prep.
46
 
    stmts for speeding up their re-execution. Holds NO_CACHED_FIELD_INDEX
47
 
    if index value is not known.
48
 
  */
49
 
  uint32_t cached_field_index;
50
 
  /*
51
 
    Cached pointer to table which contains this field, used for the same reason
52
 
    by prep. stmt. too in case then we have not-fully qualified field.
53
 
    0 - means no cached value.
54
 
  */
55
 
  TableList *cached_table;
56
 
  Select_Lex *depended_from;
57
 
  Item_ident(Name_resolution_context *context_arg,
58
 
             const char *db_name_arg, const char *table_name_arg,
59
 
             const char *field_name_arg);
60
 
  Item_ident(Session *session, Item_ident *item);
61
 
  const char *full_name() const;
62
 
  void cleanup();
63
 
  bool remove_dependence_processor(unsigned char * arg);
64
 
  virtual void print(String *str, enum_query_type query_type);
65
 
  virtual bool change_context_processor(unsigned char *cntx)
66
 
    { context= (Name_resolution_context *)cntx; return false; }
67
 
  friend bool insert_fields(Session *session, Name_resolution_context *context,
68
 
                            const char *db_name,
69
 
                            const char *table_name, List_iterator<Item> *it,
70
 
                            bool any_privileges);
71
 
};
72
 
 
73
 
 
74
 
class Item_ident_for_show :public Item
75
 
{
76
 
public:
77
 
  Field *field;
78
 
  const char *db_name;
79
 
  const char *table_name;
80
 
 
81
 
  Item_ident_for_show(Field *par_field, const char *db_arg,
82
 
                      const char *table_name_arg)
83
 
    :field(par_field), db_name(db_arg), table_name(table_name_arg)
84
 
  {}
85
 
 
86
 
  enum Type type() const { return FIELD_ITEM; }
87
 
  double val_real();
88
 
  int64_t val_int();
89
 
  String *val_str(String *str);
90
 
  my_decimal *val_decimal(my_decimal *dec);
91
 
  void make_field(Send_field *tmp_field);
92
 
};
93
 
 
94
 
#endif /* DRIZZLED_ITEM_IDENT_H */