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 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
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/function/func.h"
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
24 |
#include "drizzled/function/set_user_var.h"
|
25 |
#include "drizzled/item/string.h"
|
|
26 |
#include "drizzled/item/field.h"
|
|
1878.3.2
by Monty Taylor
Split out show_type into its own header and made sys_var work through |
27 |
*/
|
28 |
#include "drizzled/memory/sql_alloc.h" |
|
29 |
#include "drizzled/sql_list.h" |
|
30 |
#include "drizzled/lex_string.h" |
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
31 |
|
32 |
namespace drizzled |
|
33 |
{
|
|
34 |
||
1878.3.2
by Monty Taylor
Split out show_type into its own header and made sys_var work through |
35 |
namespace plugin |
36 |
{
|
|
37 |
class StorageEngine; |
|
38 |
}
|
|
39 |
||
40 |
class sys_var; |
|
41 |
class Item; |
|
42 |
class Item_func_set_user_var; |
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
43 |
class Time_zone; |
44 |
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 |
45 |
typedef struct charset_info_st CHARSET_INFO; |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
46 |
|
47 |
/* Classes to support the SET command */
|
|
48 |
||
49 |
||
50 |
/****************************************************************************
|
|
51 |
Variables that are changable runtime are declared using the
|
|
52 |
following classes
|
|
53 |
****************************************************************************/
|
|
54 |
||
55 |
/****************************************************************************
|
|
56 |
Classes for parsing of the SET command
|
|
57 |
****************************************************************************/
|
|
58 |
||
1878.3.2
by Monty Taylor
Split out show_type into its own header and made sys_var work through |
59 |
class set_var_base : |
60 |
public memory::SqlAlloc |
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
61 |
{
|
62 |
public: |
|
63 |
set_var_base() {} |
|
64 |
virtual ~set_var_base() {} |
|
65 |
virtual int check(Session *session)=0; /* To check privileges etc. */ |
|
66 |
virtual int update(Session *session)=0; /* To set the value */ |
|
67 |
/* light check for PS */
|
|
68 |
};
|
|
69 |
||
70 |
/* MySQL internal variables */
|
|
1878.3.2
by Monty Taylor
Split out show_type into its own header and made sys_var work through |
71 |
class set_var : |
72 |
public set_var_base |
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
73 |
{
|
74 |
public: |
|
75 |
sys_var *var; |
|
76 |
Item *value; |
|
77 |
sql_var_t type; |
|
78 |
union
|
|
79 |
{
|
|
80 |
const CHARSET_INFO *charset; |
|
81 |
uint32_t uint32_t_value; |
|
82 |
uint64_t uint64_t_value; |
|
83 |
size_t size_t_value; |
|
84 |
plugin::StorageEngine *storage_engine; |
|
85 |
Time_zone *time_zone; |
|
86 |
MY_LOCALE *locale_value; |
|
87 |
} save_result; |
|
88 |
LEX_STRING base; /* for structs */ |
|
89 |
||
90 |
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 |
91 |
const LEX_STRING *base_name_arg, Item *value_arg); |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
92 |
int check(Session *session); |
93 |
int update(Session *session); |
|
94 |
};
|
|
95 |
||
96 |
/* User variables like @my_own_variable */
|
|
97 |
||
98 |
class set_var_user: public set_var_base |
|
99 |
{
|
|
100 |
Item_func_set_user_var *user_var_item; |
|
101 |
public: |
|
1878.3.2
by Monty Taylor
Split out show_type into its own header and made sys_var work through |
102 |
set_var_user(Item_func_set_user_var *item) : |
103 |
user_var_item(item) |
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
104 |
{}
|
105 |
int check(Session *session); |
|
106 |
int update(Session *session); |
|
107 |
};
|
|
108 |
||
109 |
int sql_set_variables(Session *session, List<set_var_base> *var_list); |
|
110 |
||
111 |
} /* namespace drizzled */ |
|
112 |
||
113 |
#endif /* DRIZZLED_SET_VAR_H */ |