~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.cc

  • Committer: Mark Atwood
  • Date: 2011-07-13 22:28:29 UTC
  • mfrom: (2318.7.25 refactor1)
  • Revision ID: me@mark.atwood.name-20110713222829-sswp061b5ts7tc1k
mergeĀ lp:~olafvdspek/drizzle/refactor1

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
 
64
64
using namespace std;
65
65
 
66
 
namespace drizzled
67
 
{
 
66
namespace drizzled {
68
67
 
69
68
const String my_null_string("NULL", 4, default_charset_info);
70
69
 
405
404
  if (!length)
406
405
  {
407
406
    /* Empty string, used by AS or internal function like last_insert_id() */
408
 
    name= (char*) str;
 
407
    name= str;
409
408
    name_length= 0;
410
409
    return;
411
410
  }
421
420
    if (orig_len != length && ! is_autogenerated_name)
422
421
    {
423
422
      if (length == 0)
424
 
        push_warning_printf(&getSession(), 
425
 
                            DRIZZLE_ERROR::WARN_LEVEL_WARN,
426
 
                            ER_NAME_BECOMES_EMPTY, 
427
 
                            ER(ER_NAME_BECOMES_EMPTY),
428
 
                            str + length - orig_len);
 
423
        push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_NAME_BECOMES_EMPTY, ER(ER_NAME_BECOMES_EMPTY), str + length - orig_len);
429
424
      else
430
 
        push_warning_printf(&getSession(),
431
 
                            DRIZZLE_ERROR::WARN_LEVEL_WARN,
432
 
                            ER_REMOVED_SPACES, 
433
 
                            ER(ER_REMOVED_SPACES),
434
 
                            str + length - orig_len);
 
425
        push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_REMOVED_SPACES, ER(ER_REMOVED_SPACES), str + length - orig_len);
435
426
    }
436
427
  }
437
428
  name= memory::sql_strmake(str, length);
701
692
bool Item::is_expensive()
702
693
{
703
694
  if (is_expensive_cache < 0)
704
 
    is_expensive_cache= walk(&Item::is_expensive_processor, 0,
705
 
                             (unsigned char*)0);
 
695
    is_expensive_cache= walk(&Item::is_expensive_processor, 0, NULL);
706
696
  return test(is_expensive_cache);
707
697
}
708
698
 
1450
1440
    }
1451
1441
  case INT_RESULT:
1452
1442
    {
1453
 
      int64_t result=item->val_int();
1454
 
      uint32_t length=item->max_length;
1455
 
      bool null_value=item->null_value;
1456
 
      new_item= (null_value ? (Item*) new Item_null(name) :
1457
 
                 (Item*) new Item_int(name, result, length));
 
1443
      new_item= item->null_value ? (Item*)new Item_null(name) : (Item*)new Item_int(name, item->val_int(), item->max_length);
1458
1444
      break;
1459
1445
    }
1460
1446
  case ROW_RESULT:
1470
1456
      */
1471
1457
      Item_row *item_row= (Item_row*) item;
1472
1458
      Item_row *comp_item_row= (Item_row*) comp_item;
1473
 
      uint32_t col;
1474
1459
      new_item= 0;
1475
1460
      /*
1476
1461
        If item and comp_item are both Item_rows and have same number of cols
1480
1465
      */
1481
1466
      assert(item->result_type() == comp_item->result_type());
1482
1467
      assert(item_row->cols() == comp_item_row->cols());
1483
 
      col= item_row->cols();
1484
 
      while (col-- > 0)
1485
 
        resolve_const_item(session, item_row->addr(col),
1486
 
                           comp_item_row->element_index(col));
 
1468
      for (uint32_t col= item_row->cols(); col--; )
 
1469
        resolve_const_item(session, item_row->addr(col), comp_item_row->element_index(col));
1487
1470
      break;
1488
1471
    }
1489
1472
    /* Fallthrough */
1552
1535
  return result == field->val_real();
1553
1536
}
1554
1537
 
1555
 
void dummy_error_processor(Session *, void *)
1556
 
{}
1557
 
 
1558
1538
/**
1559
1539
  Create field for temporary table using type of given item.
1560
1540