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 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
20 |
#pragma once
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
21 |
|
2040.6.4
by Monty Taylor
Replaced List<set_var_base> with |
22 |
#include <boost/shared_ptr.hpp> |
23 |
||
2252.1.16
by Olaf van der Spek
Common fwd |
24 |
#include <drizzled/common_fwd.h> |
2207.8.2
by Olaf van der Spek
x |
25 |
#include <drizzled/enum.h> |
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
26 |
#include <drizzled/lex_string.h> |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
27 |
|
2207.8.2
by Olaf van der Spek
x |
28 |
namespace drizzled { |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
29 |
|
30 |
/* Classes to support the SET command */
|
|
31 |
||
32 |
||
33 |
/****************************************************************************
|
|
34 |
Variables that are changable runtime are declared using the
|
|
35 |
following classes
|
|
36 |
****************************************************************************/
|
|
37 |
||
38 |
/****************************************************************************
|
|
39 |
Classes for parsing of the SET command
|
|
40 |
****************************************************************************/
|
|
41 |
||
2040.6.4
by Monty Taylor
Replaced List<set_var_base> with |
42 |
class set_var_base |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
43 |
{
|
44 |
public: |
|
45 |
set_var_base() {} |
|
46 |
virtual ~set_var_base() {} |
|
47 |
virtual int check(Session *session)=0; /* To check privileges etc. */ |
|
48 |
virtual int update(Session *session)=0; /* To set the value */ |
|
49 |
/* light check for PS */
|
|
50 |
};
|
|
51 |
||
52 |
/* MySQL internal variables */
|
|
1878.3.2
by Monty Taylor
Split out show_type into its own header and made sys_var work through |
53 |
class set_var : |
54 |
public set_var_base |
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
55 |
{
|
2070.2.2
by Monty Taylor
Removed some guts from set_var. |
56 |
uint64_t uint64_t_value; |
2070.2.1
by Monty Taylor
First step in getting that anonymous union out of set_var. |
57 |
std::string str_value; |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
58 |
public: |
59 |
sys_var *var; |
|
60 |
Item *value; |
|
61 |
sql_var_t type; |
|
2371.1.2
by Brian Aker
Remove the typedef on lexkey |
62 |
lex_string_t base; /* for structs */ |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
63 |
|
64 |
set_var(sql_var_t type_arg, sys_var *var_arg, |
|
2371.1.2
by Brian Aker
Remove the typedef on lexkey |
65 |
const lex_string_t *base_name_arg, Item *value_arg); |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
66 |
int check(Session *session); |
67 |
int update(Session *session); |
|
2070.2.1
by Monty Taylor
First step in getting that anonymous union out of set_var. |
68 |
void setValue(const std::string &new_value); |
69 |
void setValue(uint64_t new_value); |
|
70 |
void updateValue(); |
|
71 |
||
72 |
uint64_t getInteger() |
|
73 |
{
|
|
2070.2.2
by Monty Taylor
Removed some guts from set_var. |
74 |
return uint64_t_value; |
2070.2.1
by Monty Taylor
First step in getting that anonymous union out of set_var. |
75 |
}
|
76 |
||
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
77 |
};
|
78 |
||
79 |
/* User variables like @my_own_variable */
|
|
80 |
||
81 |
class set_var_user: public set_var_base |
|
82 |
{
|
|
83 |
Item_func_set_user_var *user_var_item; |
|
84 |
public: |
|
2040.6.5
by Monty Taylor
Reset the vector in LEX. Stupid class reuse. |
85 |
explicit set_var_user(Item_func_set_user_var *item) : |
1878.3.2
by Monty Taylor
Split out show_type into its own header and made sys_var work through |
86 |
user_var_item(item) |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
87 |
{}
|
88 |
int check(Session *session); |
|
89 |
int update(Session *session); |
|
90 |
};
|
|
91 |
||
2040.6.4
by Monty Taylor
Replaced List<set_var_base> with |
92 |
typedef boost::shared_ptr<set_var_base> SetVarPtr; |
93 |
typedef std::vector<SetVarPtr> SetVarVector; |
|
94 |
int sql_set_variables(Session *session, const SetVarVector &var_list); |
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
95 |
|
96 |
} /* namespace drizzled */ |
|
97 |