~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.h

  • 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:
20
20
#ifndef DRIZZLED_SET_VAR_H
21
21
#define DRIZZLED_SET_VAR_H
22
22
 
23
 
#include "drizzled/function/func.h"
 
23
/*#include "drizzled/function/func.h"
24
24
#include "drizzled/function/set_user_var.h"
25
25
#include "drizzled/item/string.h"
26
26
#include "drizzled/item/field.h"
 
27
*/
 
28
#include "drizzled/memory/sql_alloc.h"
 
29
#include "drizzled/sql_list.h"
 
30
#include "drizzled/lex_string.h"
27
31
 
28
32
namespace drizzled
29
33
{
30
34
 
 
35
namespace plugin
 
36
{
 
37
class StorageEngine;
 
38
}
 
39
 
 
40
class sys_var;
 
41
class Item;
 
42
class Item_func_set_user_var;
31
43
class Time_zone;
32
44
typedef struct my_locale_st MY_LOCALE;
 
45
typedef struct charset_info_st CHARSET_INFO;
33
46
 
34
47
/* Classes to support the SET command */
35
48
 
43
56
  Classes for parsing of the SET command
44
57
****************************************************************************/
45
58
 
46
 
class set_var_base :public memory::SqlAlloc
 
59
class set_var_base :
 
60
  public memory::SqlAlloc
47
61
{
48
62
public:
49
63
  set_var_base() {}
54
68
};
55
69
 
56
70
/* MySQL internal variables */
57
 
class set_var :public set_var_base
 
71
class set_var :
 
72
  public set_var_base
58
73
{
59
74
public:
60
75
  sys_var *var;
73
88
  LEX_STRING base;                      /* for structs */
74
89
 
75
90
  set_var(sql_var_t type_arg, sys_var *var_arg,
76
 
          const LEX_STRING *base_name_arg, Item *value_arg)
77
 
    :var(var_arg), type(type_arg), base(*base_name_arg)
78
 
  {
79
 
    /*
80
 
      If the set value is a field, change it to a string to allow things like
81
 
      SET table_type=MYISAM;
82
 
    */
83
 
    if (value_arg && value_arg->type() == Item::FIELD_ITEM)
84
 
    {
85
 
      Item_field *item= (Item_field*) value_arg;
86
 
      if (!(value=new Item_string(item->field_name,
87
 
                  (uint32_t) strlen(item->field_name),
88
 
                                  item->collation.collation)))
89
 
        value=value_arg;                        /* Give error message later */
90
 
    }
91
 
    else
92
 
      value=value_arg;
93
 
  }
 
91
          const LEX_STRING *base_name_arg, Item *value_arg);
94
92
  int check(Session *session);
95
93
  int update(Session *session);
96
94
};
101
99
{
102
100
  Item_func_set_user_var *user_var_item;
103
101
public:
104
 
  set_var_user(Item_func_set_user_var *item)
105
 
    :user_var_item(item)
 
102
  set_var_user(Item_func_set_user_var *item) :
 
103
    user_var_item(item)
106
104
  {}
107
105
  int check(Session *session);
108
106
  int update(Session *session);