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