~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.h

Merged in Eric's whitespace cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
 
78
78
public:
79
79
 
80
 
  enum Type {FIELD_ITEM= 0, 
 
80
  enum Type {FIELD_ITEM= 0,
81
81
    FUNC_ITEM,
82
82
    SUM_FUNC_ITEM,
83
83
    STRING_ITEM,
593
593
#include <drizzled/item/field.h>
594
594
#include <drizzled/item/num.h>
595
595
 
596
 
void mark_as_dependent(Session *session, 
597
 
                       st_select_lex *last, 
 
596
void mark_as_dependent(Session *session,
 
597
                       st_select_lex *last,
598
598
                       st_select_lex *current,
599
599
                       Item_ident *resolved_item,
600
600
                       Item_ident *mark_item);
601
601
 
602
 
Item** resolve_ref_in_select_and_group(Session *session, 
603
 
                                       Item_ident *ref, 
 
602
Item** resolve_ref_in_select_and_group(Session *session,
 
603
                                       Item_ident *ref,
604
604
                                       st_select_lex *select);
605
605
 
606
606
class Item_null :public Item_basic_constant
651
651
  }
652
652
  bool check_vcol_func_processor(unsigned char *)
653
653
  { return true; }
654
 
};  
 
654
};
655
655
 
656
656
/* Item represents one placeholder ('?') of prepared statement */
657
657
 
1015
1015
  enum_field_types field_type() const { return DRIZZLE_TYPE_VARCHAR; }
1016
1016
  bool basic_const_item() const { return 1; }
1017
1017
  bool eq(const Item *item, bool binary_cmp) const;
1018
 
  Item *clone_item() 
 
1018
  Item *clone_item()
1019
1019
  {
1020
 
    return new Item_string(name, str_value.ptr(), 
 
1020
    return new Item_string(name, str_value.ptr(),
1021
1021
                           str_value.length(), collation.collation);
1022
1022
  }
1023
1023
  Item *safe_charset_converter(const CHARSET_INFO * const tocs);
1155
1155
  Item_hex_string(const char *str,uint32_t str_length);
1156
1156
  enum Type type() const { return VARBIN_ITEM; }
1157
1157
  double val_real()
1158
 
  { 
1159
 
    assert(fixed == 1); 
 
1158
  {
 
1159
    assert(fixed == 1);
1160
1160
    return (double) (uint64_t) Item_hex_string::val_int();
1161
1161
  }
1162
1162
  int64_t val_int();
1225
1225
    This constructor is used in two scenarios:
1226
1226
    A) *item = NULL
1227
1227
      No initialization is performed, fix_fields() call will be necessary.
1228
 
      
1229
 
    B) *item points to an Item this Item_ref will refer to. This is 
 
1228
 
 
1229
    B) *item points to an Item this Item_ref will refer to. This is
1230
1230
      used for GROUP BY. fix_fields() will not be called in this case,
1231
1231
      so we call set_properties to make this item "fixed". set_properties
1232
1232
      performs a subset of action Item_ref::fix_fields does, and this subset
1233
1233
      is enough for Item_ref's used in GROUP BY.
1234
 
    
1235
 
    TODO we probably fix a superset of problems like in BUG#6658. Check this 
 
1234
 
 
1235
    TODO we probably fix a superset of problems like in BUG#6658. Check this
1236
1236
         with Bar, and if we have a more broader set of problems like this.
1237
1237
  */
1238
1238
  Item_ref(Name_resolution_context *context_arg, Item **item,
1244
1244
    :Item_ident(session, item), result_field(item->result_field), ref(item->ref) {}
1245
1245
  enum Type type() const                { return REF_ITEM; }
1246
1246
  bool eq(const Item *item, bool binary_cmp) const
1247
 
  { 
 
1247
  {
1248
1248
    Item *it= ((Item *) item)->real_item();
1249
1249
    return ref && (*ref)->eq(it, binary_cmp);
1250
1250
  }
1271
1271
  Field *get_tmp_table_field()
1272
1272
  { return result_field ? result_field : (*ref)->get_tmp_table_field(); }
1273
1273
  Item *get_tmp_table_item(Session *session);
1274
 
  table_map used_tables() const         
 
1274
  table_map used_tables() const
1275
1275
  {
1276
 
    return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables(); 
 
1276
    return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables();
1277
1277
  }
1278
 
  void update_used_tables() 
1279
 
  { 
1280
 
    if (!depended_from) 
1281
 
      (*ref)->update_used_tables(); 
 
1278
  void update_used_tables()
 
1279
  {
 
1280
    if (!depended_from)
 
1281
      (*ref)->update_used_tables();
1282
1282
  }
1283
1283
  table_map not_null_tables() const { return (*ref)->not_null_tables(); }
1284
1284
  void set_result_field(Field *field)   { result_field= field; }
1318
1318
  }
1319
1319
  bool check_cols(uint32_t c)
1320
1320
  {
1321
 
    return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c) 
 
1321
    return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c)
1322
1322
                                              : Item::check_cols(c);
1323
1323
  }
1324
1324
  bool null_inside()
1326
1326
    return ref && result_type() == ROW_RESULT ? (*ref)->null_inside() : 0;
1327
1327
  }
1328
1328
  void bring_value()
1329
 
  { 
 
1329
  {
1330
1330
    if (ref && result_type() == ROW_RESULT)
1331
1331
      (*ref)->bring_value();
1332
1332
  }
1456
1456
  The following class is used to optimize comparing of date and bigint columns
1457
1457
  We need to save the original item ('ref') to be able to call
1458
1458
  ref->save_in_field(). This is used to create index search keys.
1459
 
  
 
1459
 
1460
1460
  An instance of Item_int_with_ref may have signed or unsigned integer value.
1461
 
  
 
1461
 
1462
1462
*/
1463
1463
 
1464
1464
class Item_int_with_ref :public Item_int
1575
1575
  {
1576
1576
    return Item_field::save_in_field(field_arg, no_conversions);
1577
1577
  }
1578
 
  /* 
 
1578
  /*
1579
1579
   We use RAND_TABLE_BIT to prevent Item_insert_value from
1580
1580
   being treated as a constant and precalculated before execution
1581
1581
  */
1597
1597
  Item *example;
1598
1598
  table_map used_table_map;
1599
1599
  /*
1600
 
    Field that this object will get value from. This is set/used by 
1601
 
    index-based subquery engines to detect and remove the equality injected 
 
1600
    Field that this object will get value from. This is set/used by
 
1601
    index-based subquery engines to detect and remove the equality injected
1602
1602
    by IN->EXISTS transformation.
1603
1603
    For all other uses of Item_cache, cached_field doesn't matter.
1604
 
  */  
 
1604
  */
1605
1605
  Field *cached_field;
1606
1606
  enum enum_field_types cached_field_type;
1607
1607
public:
1608
 
  Item_cache(): 
1609
 
    example(0), used_table_map(0), cached_field(0), cached_field_type(DRIZZLE_TYPE_VARCHAR) 
 
1608
  Item_cache():
 
1609
    example(0), used_table_map(0), cached_field(0), cached_field_type(DRIZZLE_TYPE_VARCHAR)
1610
1610
  {
1611
 
    fixed= 1; 
 
1611
    fixed= 1;
1612
1612
    null_value= 1;
1613
1613
  }
1614
1614
  Item_cache(enum_field_types field_type_arg):