~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/ident.h

  • Committer: Stewart Smith
  • Author(s): Marko Mäkelä
  • Date: 2010-12-20 03:21:44 UTC
  • mto: (2021.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2022.
  • Revision ID: stewart@flamingspork.com-20101220032144-7aqh2z403u7d7bdp
Merge Revision revid:marko.makela@oracle.com-20101104131215-pfxnpidlrzd4krg0 from MySQL InnoDB

Original revid:marko.makela@oracle.com-20101104131215-pfxnpidlrzd4krg0

Original Authors: Marko Mäkelä <marko.makela@oracle.com>
Original commit message:
row_ins_index_entry(): Note that only CREATE INDEX sets foreign=FALSE.

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