~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_create.cc

Removed dead bits to HA_CREATE_INFO

Show diffs side-by-side

added added

removed removed

Lines of Context:
1461
1461
Item*
1462
1462
Create_udf_func::create(THD *thd, udf_func *udf, List<Item> *item_list)
1463
1463
{
1464
 
  Item *func= NULL;
 
1464
  Item_func *func= NULL;
1465
1465
  int arg_count= 0;
1466
1466
 
1467
1467
  if (item_list != NULL)
1469
1469
 
1470
1470
  thd->lex->set_stmt_unsafe();
1471
1471
 
1472
 
  assert(   (udf->type == UDFTYPE_FUNCTION)
1473
 
              || (udf->type == UDFTYPE_AGGREGATE));
1474
 
 
1475
 
  switch(udf->returns) {
1476
 
  case STRING_RESULT:
1477
 
  {
1478
 
    if (udf->type == UDFTYPE_FUNCTION)
1479
 
    {
1480
 
      if (arg_count)
1481
 
        func= new (thd->mem_root) Item_func_udf_str(udf, *item_list);
1482
 
      else
1483
 
        func= new (thd->mem_root) Item_func_udf_str(udf);
1484
 
    }
1485
 
    else
1486
 
    {
1487
 
      if (arg_count)
1488
 
        func= new (thd->mem_root) Item_sum_udf_str(udf, *item_list);
1489
 
      else
1490
 
        func= new (thd->mem_root) Item_sum_udf_str(udf);
1491
 
    }
1492
 
    break;
1493
 
  }
1494
 
  case REAL_RESULT:
1495
 
  {
1496
 
    if (udf->type == UDFTYPE_FUNCTION)
1497
 
    {
1498
 
      if (arg_count)
1499
 
        func= new (thd->mem_root) Item_func_udf_float(udf, *item_list);
1500
 
      else
1501
 
        func= new (thd->mem_root) Item_func_udf_float(udf);
1502
 
    }
1503
 
    else
1504
 
    {
1505
 
      if (arg_count)
1506
 
        func= new (thd->mem_root) Item_sum_udf_float(udf, *item_list);
1507
 
      else
1508
 
        func= new (thd->mem_root) Item_sum_udf_float(udf);
1509
 
    }
1510
 
    break;
1511
 
  }
1512
 
  case INT_RESULT:
1513
 
  {
1514
 
    if (udf->type == UDFTYPE_FUNCTION)
1515
 
    {
1516
 
      if (arg_count)
1517
 
        func= new (thd->mem_root) Item_func_udf_int(udf, *item_list);
1518
 
      else
1519
 
        func= new (thd->mem_root) Item_func_udf_int(udf);
1520
 
    }
1521
 
    else
1522
 
    {
1523
 
      if (arg_count)
1524
 
        func= new (thd->mem_root) Item_sum_udf_int(udf, *item_list);
1525
 
      else
1526
 
        func= new (thd->mem_root) Item_sum_udf_int(udf);
1527
 
    }
1528
 
    break;
1529
 
  }
1530
 
  case DECIMAL_RESULT:
1531
 
  {
1532
 
    if (udf->type == UDFTYPE_FUNCTION)
1533
 
    {
1534
 
      if (arg_count)
1535
 
        func= new (thd->mem_root) Item_func_udf_decimal(udf, *item_list);
1536
 
      else
1537
 
        func= new (thd->mem_root) Item_func_udf_decimal(udf);
1538
 
    }
1539
 
    else
1540
 
    {
1541
 
      if (arg_count)
1542
 
        func= new (thd->mem_root) Item_sum_udf_decimal(udf, *item_list);
1543
 
      else
1544
 
        func= new (thd->mem_root) Item_sum_udf_decimal(udf);
1545
 
    }
1546
 
    break;
1547
 
  }
1548
 
  default:
1549
 
  {
1550
 
    my_error(ER_NOT_SUPPORTED_YET, MYF(0), "UDF return type");
1551
 
  }
1552
 
  }
 
1472
  func= udf->create_func(thd->mem_root);
 
1473
 
 
1474
  func->set_arguments(*item_list);
 
1475
 
1553
1476
  return func;
1554
1477
}
1555
1478