~drizzle-trunk/drizzle/development

1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
#ifndef DRIZZLED_SET_VAR_H
21
#define DRIZZLED_SET_VAR_H
22
1878.3.2 by Monty Taylor
Split out show_type into its own header and made sys_var work through
23
#include "drizzled/memory/sql_alloc.h"
24
#include "drizzled/sql_list.h"
25
#include "drizzled/lex_string.h"
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
26
27
namespace drizzled
28
{
29
1878.3.2 by Monty Taylor
Split out show_type into its own header and made sys_var work through
30
namespace plugin
31
{
32
class StorageEngine;
33
}
34
35
class sys_var;
36
class Item;
37
class Item_func_set_user_var;
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
38
class Time_zone;
39
typedef struct my_locale_st MY_LOCALE;
1878.3.2 by Monty Taylor
Split out show_type into its own header and made sys_var work through
40
typedef struct charset_info_st CHARSET_INFO;
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
41
42
/* Classes to support the SET command */
43
44
45
/****************************************************************************
46
  Variables that are changable runtime are declared using the
47
  following classes
48
****************************************************************************/
49
50
/****************************************************************************
51
  Classes for parsing of the SET command
52
****************************************************************************/
53
1878.3.2 by Monty Taylor
Split out show_type into its own header and made sys_var work through
54
class set_var_base :
55
  public memory::SqlAlloc
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
56
{
57
public:
58
  set_var_base() {}
59
  virtual ~set_var_base() {}
60
  virtual int check(Session *session)=0;	/* To check privileges etc. */
61
  virtual int update(Session *session)=0;	/* To set the value */
62
  /* light check for PS */
63
};
64
65
/* MySQL internal variables */
1878.3.2 by Monty Taylor
Split out show_type into its own header and made sys_var work through
66
class set_var :
67
  public set_var_base
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
68
{
69
public:
70
  sys_var *var;
71
  Item *value;
72
  sql_var_t type;
73
  union
74
  {
75
    const CHARSET_INFO *charset;
76
    uint32_t uint32_t_value;
77
    uint64_t uint64_t_value;
78
    size_t size_t_value;
79
    plugin::StorageEngine *storage_engine;
80
    Time_zone *time_zone;
81
    MY_LOCALE *locale_value;
82
  } save_result;
83
  LEX_STRING base;			/* for structs */
84
85
  set_var(sql_var_t type_arg, sys_var *var_arg,
1878.3.2 by Monty Taylor
Split out show_type into its own header and made sys_var work through
86
          const LEX_STRING *base_name_arg, Item *value_arg);
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
87
  int check(Session *session);
88
  int update(Session *session);
89
};
90
91
/* User variables like @my_own_variable */
92
93
class set_var_user: public set_var_base
94
{
95
  Item_func_set_user_var *user_var_item;
96
public:
1878.3.2 by Monty Taylor
Split out show_type into its own header and made sys_var work through
97
  set_var_user(Item_func_set_user_var *item) :
98
    user_var_item(item)
1878.3.1 by Monty Taylor
Split set_var.* into sys_var.* and set_var.*
99
  {}
100
  int check(Session *session);
101
  int update(Session *session);
102
};
103
104
int sql_set_variables(Session *session, List<set_var_base> *var_list);
105
106
} /* namespace drizzled */
107
108
#endif /* DRIZZLED_SET_VAR_H */