~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/set_user_var.cc

  • Committer: Monty Taylor
  • Date: 2011-03-10 18:09:05 UTC
  • mfrom: (2225.2.2 refactor)
  • mto: This revision was merged to the branch mainline in revision 2228.
  • Revision ID: mordred@inaugust.com-20110310180905-ttx05t7q7ff6nl7c
Merge Olad: Refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <config.h>
21
21
 
22
22
#include <drizzled/function/set_user_var.h>
23
23
#include <drizzled/field/num.h>
24
24
#include <drizzled/session.h>
25
25
#include <drizzled/plugin/client.h>
 
26
#include <drizzled/user_var_entry.h>
26
27
 
27
28
namespace drizzled
28
29
{
231
232
                         DERIVATION_IMPLICIT, 0);
232
233
      else
233
234
        res= update_hash((void*) save_result.vdec,
234
 
                         sizeof(my_decimal), DECIMAL_RESULT,
 
235
                         sizeof(type::Decimal), DECIMAL_RESULT,
235
236
                         &my_charset_bin, DERIVATION_IMPLICIT, 0);
236
237
      break;
237
238
    }
270
271
}
271
272
 
272
273
 
273
 
my_decimal *Item_func_set_user_var::val_decimal(my_decimal *val)
 
274
type::Decimal *Item_func_set_user_var::val_decimal(type::Decimal *val)
274
275
{
275
276
  assert(fixed == 1);
276
277
  check(0);
303
304
}
304
305
 
305
306
 
306
 
my_decimal *Item_func_set_user_var::val_decimal_result(my_decimal *val)
 
307
type::Decimal *Item_func_set_user_var::val_decimal_result(type::Decimal *val)
307
308
{
308
309
  assert(fixed == 1);
309
310
  check(true);
311
312
  return entry->val_decimal(&null_value, val);
312
313
}
313
314
 
314
 
void Item_func_set_user_var::print(String *str, enum_query_type query_type)
 
315
void Item_func_set_user_var::print(String *str)
315
316
{
316
317
  str->append(STRING_WITH_LEN("(@"));
317
318
  str->append(name.str, name.length);
318
319
  str->append(STRING_WITH_LEN(":="));
319
 
  args[0]->print(str, query_type);
 
320
  args[0]->print(str);
320
321
  str->append(')');
321
322
}
322
323
 
341
342
      tmp_field->col_name=Item::name;               // Use user supplied name
342
343
  }
343
344
  else
 
345
  {
344
346
    Item::make_field(tmp_field);
 
347
  }
345
348
}
346
349
 
347
350
/*
424
427
  }
425
428
  else if (result_type() == DECIMAL_RESULT)
426
429
  {
427
 
    my_decimal decimal_value;
428
 
    my_decimal *val= entry->val_decimal(&null_value, &decimal_value);
 
430
    type::Decimal decimal_value;
 
431
    type::Decimal *val= entry->val_decimal(&null_value, &decimal_value);
429
432
    if (null_value)
430
433
      return set_field_to_null(field);
431
434
    field->set_notnull();