~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/create.cc

rand() merge from Stewart.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
#include <drizzled/function/numhybrid.h>
90
90
#include <drizzled/function/math/ord.h>
91
91
#include <drizzled/function/math/pow.h>
92
 
#include <drizzled/function/math/rand.h>
93
92
#include <drizzled/function/math/real.h>
94
93
#include <drizzled/function/row_count.h>
95
94
#include <drizzled/function/set_user_var.h>
1114
1113
};
1115
1114
 
1116
1115
 
1117
 
class Create_func_rand : public Create_native_func
1118
 
{
1119
 
public:
1120
 
  virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list);
1121
 
 
1122
 
  static Create_func_rand s_singleton;
1123
 
 
1124
 
protected:
1125
 
  Create_func_rand() {}
1126
 
  virtual ~Create_func_rand() {}
1127
 
};
1128
 
 
1129
 
 
1130
1116
class Create_func_round : public Create_native_func
1131
1117
{
1132
1118
public:
2334
2320
                                             M_PI/180, 0.0);
2335
2321
}
2336
2322
 
2337
 
 
2338
 
Create_func_rand Create_func_rand::s_singleton;
2339
 
 
2340
 
Item*
2341
 
Create_func_rand::create_native(Session *session, LEX_STRING name,
2342
 
                                List<Item> *item_list)
2343
 
{
2344
 
  Item *func= NULL;
2345
 
  int arg_count= 0;
2346
 
 
2347
 
  if (item_list != NULL)
2348
 
    arg_count= item_list->elements;
2349
 
 
2350
 
  switch (arg_count) {
2351
 
  case 0:
2352
 
  {
2353
 
    func= new (session->mem_root) Item_func_rand();
2354
 
    break;
2355
 
  }
2356
 
  case 1:
2357
 
  {
2358
 
    Item *param_1= item_list->pop();
2359
 
    func= new (session->mem_root) Item_func_rand(param_1);
2360
 
    break;
2361
 
  }
2362
 
  default:
2363
 
  {
2364
 
    my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str);
2365
 
    break;
2366
 
  }
2367
 
  }
2368
 
 
2369
 
  return func;
2370
 
}
2371
 
 
2372
 
 
2373
2323
Create_func_round Create_func_round::s_singleton;
2374
2324
 
2375
2325
Item*
2654
2604
  { { C_STRING_WITH_LEN("POWER") }, BUILDER(Create_func_pow)},
2655
2605
  { { C_STRING_WITH_LEN("QUOTE") }, BUILDER(Create_func_quote)},
2656
2606
  { { C_STRING_WITH_LEN("RADIANS") }, BUILDER(Create_func_radians)},
2657
 
  { { C_STRING_WITH_LEN("RAND") }, BUILDER(Create_func_rand)},
2658
2607
  { { C_STRING_WITH_LEN("ROUND") }, BUILDER(Create_func_round)},
2659
2608
  { { C_STRING_WITH_LEN("ROW_COUNT") }, BUILDER(Create_func_row_count)},
2660
2609
  { { C_STRING_WITH_LEN("RPAD") }, BUILDER(Create_func_rpad)},