~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.h

  • Committer: Monty Taylor
  • Date: 2008-11-16 05:36:13 UTC
  • mto: (584.1.9 devel)
  • mto: This revision was merged to the branch mainline in revision 589.
  • Revision ID: monty@inaugust.com-20081116053613-bld4rqxhlkb49c02
Split out cache_row and type_holder.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2058
2058
  int save_in_field(Field *field, bool no_conversions);
2059
2059
};
2060
2060
 
2061
 
class Item_cache_row: public Item_cache
2062
 
{
2063
 
  Item_cache  **values;
2064
 
  uint32_t item_count;
2065
 
  bool save_array;
2066
 
public:
2067
 
  Item_cache_row()
2068
 
    :Item_cache(), values(0), item_count(2), save_array(0) {}
2069
 
  
2070
 
  /*
2071
 
    'allocate' used only in row transformer, to preallocate space for row 
2072
 
    cache.
2073
 
  */
2074
 
  bool allocate(uint32_t num);
2075
 
  /*
2076
 
    'setup' is needed only by row => it not called by simple row subselect
2077
 
    (only by IN subselect (in subselect optimizer))
2078
 
  */
2079
 
  bool setup(Item *item);
2080
 
  void store(Item *item);
2081
 
  void illegal_method_call(const char *);
2082
 
  void make_field(Send_field *)
2083
 
  {
2084
 
    illegal_method_call((const char*)"make_field");
2085
 
  };
2086
 
  double val_real()
2087
 
  {
2088
 
    illegal_method_call((const char*)"val");
2089
 
    return 0;
2090
 
  };
2091
 
  int64_t val_int()
2092
 
  {
2093
 
    illegal_method_call((const char*)"val_int");
2094
 
    return 0;
2095
 
  };
2096
 
  String *val_str(String *)
2097
 
  {
2098
 
    illegal_method_call((const char*)"val_str");
2099
 
    return 0;
2100
 
  };
2101
 
  my_decimal *val_decimal(my_decimal *val __attribute__((unused)))
2102
 
  {
2103
 
    illegal_method_call((const char*)"val_decimal");
2104
 
    return 0;
2105
 
  };
2106
 
 
2107
 
  enum Item_result result_type() const { return ROW_RESULT; }
2108
 
  
2109
 
  uint32_t cols() { return item_count; }
2110
 
  Item *element_index(uint32_t i) { return values[i]; }
2111
 
  Item **addr(uint32_t i) { return (Item **) (values + i); }
2112
 
  bool check_cols(uint32_t c);
2113
 
  bool null_inside();
2114
 
  void bring_value();
2115
 
  void keep_array() { save_array= 1; }
2116
 
  void cleanup()
2117
 
  {
2118
 
    Item_cache::cleanup();
2119
 
    if (save_array)
2120
 
      memset(values, 0, item_count*sizeof(Item**));
2121
 
    else
2122
 
      values= 0;
2123
 
    return;
2124
 
  }
2125
 
};
2126
 
 
2127
 
 
2128
 
/*
2129
 
  Item_type_holder used to store type. name, length of Item for UNIONS &
2130
 
  derived tables.
2131
 
 
2132
 
  Item_type_holder do not need cleanup() because its time of live limited by
2133
 
  single SP/PS execution.
2134
 
*/
2135
 
class Item_type_holder: public Item
2136
 
{
2137
 
protected:
2138
 
  TYPELIB *enum_set_typelib;
2139
 
  enum_field_types fld_type;
2140
 
 
2141
 
  void get_full_info(Item *item);
2142
 
 
2143
 
  /* It is used to count decimal precision in join_types */
2144
 
  int prev_decimal_int_part;
2145
 
public:
2146
 
  Item_type_holder(Session*, Item*);
2147
 
 
2148
 
  Item_result result_type() const;
2149
 
  enum_field_types field_type() const { return fld_type; };
2150
 
  enum Type type() const { return TYPE_HOLDER; }
2151
 
  double val_real();
2152
 
  int64_t val_int();
2153
 
  my_decimal *val_decimal(my_decimal *);
2154
 
  String *val_str(String*);
2155
 
  bool join_types(Session *session, Item *);
2156
 
  Field *make_field_by_type(Table *table);
2157
 
  static uint32_t display_length(Item *item);
2158
 
  static enum_field_types get_real_type(Item *);
2159
 
};
2160
 
 
2161
2061
 
2162
2062
class st_select_lex;
2163
2063
void mark_select_range_as_dependent(Session *session,