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 class COND_EQUAL;
00027 
00028 extern Item **not_found_item;
00029 
00030 class Item_field :public Item_ident
00031 {
00032 protected:
00033   void set_field(Field *field);
00034 public:
00035   Field *field,*result_field;
00036   Item_equal *item_equal;
00037   bool no_const_subst;
00038   /*
00039     if any_privileges set to true then here real effective privileges will
00040     be stored
00041   */
00042   uint32_t have_privileges;
00043   /* field need any privileges (for VIEW creation) */
00044   bool any_privileges;
00045   Item_field(Name_resolution_context *context_arg,
00046              const char *db_arg,const char *table_name_arg,
00047        const char *field_name_arg);
00048   /*
00049     Constructor needed to process subselect with temporary tables (see Item)
00050   */
00051   Item_field(Session *session, Item_field *item);
00052   /*
00053     Constructor used inside setup_wild(), ensures that field, table,
00054     and database names will live as long as Item_field (this is important
00055     in prepared statements).
00056   */
00057   Item_field(Session *session, Name_resolution_context *context_arg, Field *field);
00058   /*
00059     If this constructor is used, fix_fields() won't work, because
00060     db_name, table_name and column_name are unknown. It's necessary to call
00061     reset_field() before fix_fields() for all fields created this way.
00062   */
00063   Item_field(Field *field);
00064   enum Type type() const { return FIELD_ITEM; }
00065   bool eq(const Item *item, bool binary_cmp) const;
00066   double val_real();
00067   int64_t val_int();
00068   type::Decimal *val_decimal(type::Decimal *);
00069   String *val_str(String*);
00070   double val_result();
00071   int64_t val_int_result();
00072   String *str_result(String* tmp);
00073   type::Decimal *val_decimal_result(type::Decimal *);
00074   bool val_bool_result();
00075   void send(plugin::Client *client, String *str_arg);
00076   void reset_field(Field *f);
00077   bool fix_fields(Session *, Item **);
00078   void fix_after_pullout(Select_Lex *new_parent, Item **ref);
00079   void make_field(SendField *tmp_field);
00080   int save_in_field(Field *field,bool no_conversions);
00081   void save_org_in_field(Field *field);
00082   table_map used_tables() const;
00083   enum Item_result result_type () const;
00084   Item_result cast_to_int_type() const;
00085   enum_field_types field_type() const;
00086   int64_t val_int_endpoint(bool left_endp, bool *incl_endp);
00087   Field *get_tmp_table_field() { return result_field; }
00088   Field *tmp_table_field(Table *) { return result_field; }
00089   bool get_date(type::Time &ltime,uint32_t fuzzydate);
00090   bool get_date_result(type::Time &ltime, uint32_t fuzzydate);
00091   bool get_time(type::Time &ltime);
00092   bool is_null();
00093   void update_null_value();
00094   Item *get_tmp_table_item(Session *session);
00095   bool collect_item_field_processor(unsigned char * arg);
00096   bool find_item_in_field_list_processor(unsigned char *arg);
00097   bool register_field_in_read_map(unsigned char *arg);
00098   void cleanup();
00099   bool result_as_int64_t();
00100   Item_equal *find_item_equal(COND_EQUAL *cond_equal);
00101   bool subst_argument_checker(unsigned char **arg);
00102   Item *equal_fields_propagator(unsigned char *arg);
00103   bool set_no_const_sub(unsigned char *arg);
00104   Item *replace_equal_field(unsigned char *arg);
00105   uint32_t max_disp_length();
00106   Item *safe_charset_converter(const charset_info_st * const tocs);
00107   int fix_outer_field(Session *session, Field **field, Item **reference);
00108   virtual Item *update_value_transformer(unsigned char *select_arg);
00109   virtual void print(String *str);
00110 
00111   friend class Item_default_value;
00112   friend class Item_insert_value;
00113   friend class Select_Lex_Unit;
00114 };
00115 
00116 } /* namespace drizzled */
00117