~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

  • Committer: Monty Taylor
  • Date: 2010-10-25 20:36:07 UTC
  • mto: (1879.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 1880.
  • Revision ID: mordred@inaugust.com-20101025203607-0xkv1xu0salvc6zd
Split out show_type into its own header and made sys_var work through
plugin.h.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include "config.h"
21
21
#include "drizzled/session.h"
 
22
#include "drizzled/item/string.h"
22
23
#include "drizzled/sql_list.h"
23
24
 
24
25
using namespace std;
73
74
/*****************************************************************************
74
75
  Functions to handle SET mysql_internal_variable=const_expr
75
76
*****************************************************************************/
 
77
set_var::set_var(sql_var_t type_arg, sys_var *var_arg,
 
78
                 const LEX_STRING *base_name_arg, Item *value_arg) :
 
79
  var(var_arg), type(type_arg), base(*base_name_arg)
 
80
{
 
81
  /*
 
82
    If the set value is a field, change it to a string to allow things like
 
83
    SET table_type=MYISAM;
 
84
  */
 
85
  if (value_arg && value_arg->type() == Item::FIELD_ITEM)
 
86
  {
 
87
    Item_field *item= (Item_field*) value_arg;
 
88
    if (!(value=new Item_string(item->field_name,
 
89
                                (uint32_t) strlen(item->field_name),
 
90
                                item->collation.collation)))
 
91
      value=value_arg;                  /* Give error message later */
 
92
  }
 
93
  else
 
94
    value=value_arg;
 
95
}
76
96
 
77
97
int set_var::check(Session *session)
78
98
{