• 类Item_field


    class Item_field :public Item_ident
    {
    protected:
      void set_field(Field *field);
    public:
      Field *field,*result_field;
      Item_equal *item_equal;
      bool no_const_subst;
      /*
        if any_privileges set to TRUE then here real effective privileges will
        be stored
      */
      uint have_privileges;
      /* field need any privileges (for VIEW creation) */
      bool any_privileges;
      Item_field(Name_resolution_context *context_arg,
                 const char *db_arg,const char *table_name_arg,
             const char *field_name_arg);
      /*
        Constructor needed to process subselect with temporary tables (see Item)
      */
      Item_field(THD *thd, Item_field *item);
      /*
        Constructor used inside setup_wild(), ensures that field, table,
        and database names will live as long as Item_field (this is important
        in prepared statements).
      */
      Item_field(THD *thd, Name_resolution_context *context_arg, Field *field);
      /*
        If this constructor is used, fix_fields() won't work, because
        db_name, table_name and column_name are unknown. It's necessary to call
        reset_field() before fix_fields() for all fields created this way.
      */
      Item_field(Field *field);
      enum Type type() const { return FIELD_ITEM; }
      bool eq(const Item *item, bool binary_cmp) const;
      double val_real();
      longlong val_int();
      my_decimal *val_decimal(my_decimal *);
      String *val_str(String*);
      double val_result();
      longlong val_int_result();
      String *str_result(String* tmp);
      my_decimal *val_decimal_result(my_decimal *);
      bool val_bool_result();
      bool is_null_result();
      bool send(Protocol *protocol, String *str_arg);
      void reset_field(Field *f);
      bool fix_fields(THD *, Item **);
      void make_field(Send_field *tmp_field);
      int save_in_field(Field *field,bool no_conversions);
      void save_org_in_field(Field *field);
      table_map used_tables() const;
      enum Item_result result_type () const
      {
        return field->result_type();
      }
      Item_result cast_to_int_type() const
      {
        return field->cast_to_int_type();
      }
      enum_field_types field_type() const
      {
        return field->type();
      }
      enum_monotonicity_info get_monotonicity_info() const
      {
        return MONOTONIC_STRICT_INCREASING;
      }
      longlong val_int_endpoint(bool left_endp, bool *incl_endp);
      Field *get_tmp_table_field() { return result_field; }
      Field *tmp_table_field(TABLE *t_arg) { return result_field; }
      bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
      bool get_date_result(MYSQL_TIME *ltime,uint fuzzydate);
      bool get_time(MYSQL_TIME *ltime);
      bool is_null() { return field->is_null(); }
      void update_null_value();
      Item *get_tmp_table_item(THD *thd);
      bool collect_item_field_processor(uchar * arg);
      bool find_item_in_field_list_processor(uchar *arg);
      bool register_field_in_read_map(uchar *arg);
      bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
      void cleanup();
      bool result_as_longlong()
      {
        return field->can_be_compared_as_longlong();
      }
      Item_equal *find_item_equal(COND_EQUAL *cond_equal);
      bool subst_argument_checker(uchar **arg);
      Item *equal_fields_propagator(uchar *arg);
      bool set_no_const_sub(uchar *arg);
      Item *replace_equal_field(uchar *arg);
      inline uint32 max_disp_length() { return field->max_display_length(); }
      Item_field *filed_for_view_update() { return this; }
      Item *safe_charset_converter(CHARSET_INFO *tocs);
      int fix_outer_field(THD *thd, Field **field, Item **reference);
      virtual Item *update_value_transformer(uchar *select_arg);
      virtual void print(String *str, enum_query_type query_type);
      bool is_outer_field() const
      {
        DBUG_ASSERT(fixed);
        return field->table->pos_in_table_list->outer_join;
      }
      Field::geometry_type get_geometry_type() const
      {
        DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY);
        return field->get_geometry_type();
      }
      CHARSET_INFO *charset_for_protocol(void) const
      { return field->charset_for_protocol(); }
      friend class Item_default_value;
      friend class Item_insert_value;
      friend class st_select_lex_unit;
    };
    bool Item_field::eq(const Item *item, bool binary_cmp) const
    {
      Item *real_item= ((Item *) item)->real_item();
      if (real_item->type() != FIELD_ITEM)
        return 0;
      
      Item_field *item_field= (Item_field*) real_item;
      if (item_field->field && field)
        return item_field->field == field;
      /*
        We may come here when we are trying to find a function in a GROUP BY
        clause from the select list.
        In this case the '100 % correct' way to do this would be to first
        run fix_fields() on the GROUP BY item and then retry this function, but
        I think it's better to relax the checking a bit as we will in
        most cases do the correct thing by just checking the field name.
        (In cases where we would choose wrong we would have to generate a
        ER_NON_UNIQ_ERROR).
      */
      return (!my_strcasecmp(system_charset_info, item_field->name,
                 field_name) &&
          (!item_field->table_name || !table_name ||
           (!my_strcasecmp(table_alias_charset, item_field->table_name,
                   table_name) &&
            (!item_field->db_name || !db_name ||
             (item_field->db_name && !strcmp(item_field->db_name,
                             db_name))))));
    }
  • 相关阅读:
    Apache-Shiro
    Linux下的Nginx安装
    Linux安装Redis
    Linux安装ftp组件vsftpd
    Spring笔记(二)
    Spring笔记(一)
    MySQL事务
    rocketMQ基本理解
    2018面试题小结
    v-if和v-show
  • 原文地址:https://www.cnblogs.com/taek/p/5034683.html
Copyright © 2020-2023  润新知