Drizzled Public API Documentation

field.h

00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #pragma once
00021 
00022 #include <drizzled/item/ident.h>
00023 
00024 namespace drizzled
00025 {
00026 
00027 class COND_EQUAL;
00028 class Item;
00029 
00030 extern Item **not_found_item;
00031 
00032 class Item_field :public Item_ident
00033 {
00034 protected:
00035   void set_field(Field *field);
00036 public:
00037   Field *field,*result_field;
00038   Item_equal *item_equal;
00039   bool no_const_subst;
00040   /*
00041     if any_privileges set to true then here real effective privileges will
00042     be stored
00043   */
00044   uint32_t have_privileges;
00045   /* field need any privileges (for VIEW creation) */
00046   bool any_privileges;
00047   Item_field(Name_resolution_context *context_arg,
00048              const char *db_arg,const char *table_name_arg,
00049        const char *field_name_arg);
00050   /*
00051     Constructor needed to process subselect with temporary tables (see Item)
00052   */
00053   Item_field(Session *session, Item_field *item);
00054   /*
00055     Constructor used inside setup_wild(), ensures that field, table,
00056     and database names will live as long as Item_field (this is important
00057     in prepared statements).
00058   */
00059   Item_field(Session *session, Name_resolution_context *context_arg, Field *field);
00060   /*
00061     If this constructor is used, fix_fields() won't work, because
00062     db_name, table_name and column_name are unknown. It's necessary to call
00063     reset_field() before fix_fields() for all fields created this way.
00064   */
00065   Item_field(Field *field);
00066   enum Type type() const { return FIELD_ITEM; }
00067   bool eq(const Item *item, bool binary_cmp) const;
00068   double val_real();
00069   int64_t val_int();
00070   type::Decimal *val_decimal(type::Decimal *);
00071   String *val_str(String*);
00072   double val_result();
00073   int64_t val_int_result();
00074   String *str_result(String* tmp);
00075   type::Decimal *val_decimal_result(type::Decimal *);
00076   bool val_bool_result();
00077   bool send(plugin::Client *client, String *str_arg);
00078   void reset_field(Field *f);
00079   bool fix_fields(Session *, Item **);
00080   void fix_after_pullout(Select_Lex *new_parent, Item **ref);
00081   void make_field(SendField *tmp_field);
00082   int save_in_field(Field *field,bool no_conversions);
00083   void save_org_in_field(Field *field);
00084   table_map used_tables() const;
00085   enum Item_result result_type () const;
00086   Item_result cast_to_int_type() const;
00087   enum_field_types field_type() const;
00088   int64_t val_int_endpoint(bool left_endp, bool *incl_endp);
00089   Field *get_tmp_table_field() { return result_field; }
00090   Field *tmp_table_field(Table *) { return result_field; }
00091   bool get_date(type::Time &ltime,uint32_t fuzzydate);
00092   bool get_date_result(type::Time &ltime, uint32_t fuzzydate);
00093   bool get_time(type::Time &ltime);
00094   bool is_null();
00095   void update_null_value();
00096   Item *get_tmp_table_item(Session *session);
00097   bool collect_item_field_processor(unsigned char * arg);
00098   bool find_item_in_field_list_processor(unsigned char *arg);
00099   bool register_field_in_read_map(unsigned char *arg);
00100   void cleanup();
00101   bool result_as_int64_t();
00102   Item_equal *find_item_equal(COND_EQUAL *cond_equal);
00103   bool subst_argument_checker(unsigned char **arg);
00104   Item *equal_fields_propagator(unsigned char *arg);
00105   bool set_no_const_sub(unsigned char *arg);
00106   Item *replace_equal_field(unsigned char *arg);
00107   uint32_t max_disp_length();
00108   Item *safe_charset_converter(const CHARSET_INFO * const tocs);
00109   int fix_outer_field(Session *session, Field **field, Item **reference);
00110   virtual Item *update_value_transformer(unsigned char *select_arg);
00111   virtual void print(String *str);
00112 
00113   friend class Item_default_value;
00114   friend class Item_insert_value;
00115   friend class Select_Lex_Unit;
00116 };
00117 
00118 } /* namespace drizzled */
00119