~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/create.cc

move ATAN() and ATAN2() function into math_functions plugin. ATAN2() is just another instance of ATAN()

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
#include <drizzled/function/func.h>
66
66
#include <drizzled/function/additive_op.h>
67
 
#include <drizzled/function/math/atan.h>
68
67
#include <drizzled/function/math/ceiling.h>
69
68
#include <drizzled/function/math/cos.h>
70
69
#include <drizzled/function/math/dec.h>
255
254
*/
256
255
 
257
256
 
258
 
class Create_func_atan : public Create_native_func
259
 
{
260
 
public:
261
 
  virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list);
262
 
 
263
 
  static Create_func_atan s_singleton;
264
 
 
265
 
protected:
266
 
  Create_func_atan() {}
267
 
  virtual ~Create_func_atan() {}
268
 
};
269
 
 
270
257
class Create_func_bin : public Create_func_arg1
271
258
{
272
259
public:
1464
1451
  return create(session, param_1, param_2, param_3);
1465
1452
}
1466
1453
 
1467
 
Create_func_atan Create_func_atan::s_singleton;
1468
 
 
1469
 
Item*
1470
 
Create_func_atan::create_native(Session *session, LEX_STRING name,
1471
 
                                List<Item> *item_list)
1472
 
{
1473
 
  Item* func= NULL;
1474
 
  int arg_count= 0;
1475
 
 
1476
 
  if (item_list != NULL)
1477
 
    arg_count= item_list->elements;
1478
 
 
1479
 
  switch (arg_count) {
1480
 
  case 1:
1481
 
  {
1482
 
    Item *param_1= item_list->pop();
1483
 
    func= new (session->mem_root) Item_func_atan(param_1);
1484
 
    break;
1485
 
  }
1486
 
  case 2:
1487
 
  {
1488
 
    Item *param_1= item_list->pop();
1489
 
    Item *param_2= item_list->pop();
1490
 
    func= new (session->mem_root) Item_func_atan(param_1, param_2);
1491
 
    break;
1492
 
  }
1493
 
  default:
1494
 
  {
1495
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
1496
 
    break;
1497
 
  }
1498
 
  }
1499
 
 
1500
 
  return func;
1501
 
}
1502
 
 
1503
1454
Create_func_bin Create_func_bin::s_singleton;
1504
1455
 
1505
1456
Item*
2443
2394
 
2444
2395
static Native_func_registry func_array[] =
2445
2396
{
2446
 
  { { C_STRING_WITH_LEN("ATAN") }, BUILDER(Create_func_atan)},
2447
 
  { { C_STRING_WITH_LEN("ATAN2") }, BUILDER(Create_func_atan)},
2448
2397
  { { C_STRING_WITH_LEN("BIN") }, BUILDER(Create_func_bin)},
2449
2398
  { { C_STRING_WITH_LEN("CEIL") }, BUILDER(Create_func_ceiling)},
2450
2399
  { { C_STRING_WITH_LEN("CEILING") }, BUILDER(Create_func_ceiling)},