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 |
virtual ~set_var_base() {} |
|
2445.1.7
by Olaf van der Spek
Refactor |
46 |
virtual int check(Session*)= 0; /* To check privileges etc. */ |
47 |
virtual int update(Session*)= 0; /* To set the value */ |
|
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
48 |
/* light check for PS */
|
49 |
};
|
|
50 |
||
51 |
/* MySQL internal variables */
|
|
2445.1.7
by Olaf van der Spek
Refactor |
52 |
class set_var : public set_var_base |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
53 |
{
|
2070.2.2
by Monty Taylor
Removed some guts from set_var. |
54 |
uint64_t uint64_t_value; |
2070.2.1
by Monty Taylor
First step in getting that anonymous union out of set_var. |
55 |
std::string str_value; |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
56 |
public: |
57 |
sys_var *var; |
|
58 |
Item *value; |
|
59 |
sql_var_t type; |
|
2445.1.7
by Olaf van der Spek
Refactor |
60 |
str_ref base; // for structs |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
61 |
|
2445.1.11
by Olaf van der Spek
Use str_ref |
62 |
set_var(sql_var_t type_arg, sys_var *var_arg, str_ref base_name_arg, Item *value_arg); |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
63 |
int check(Session *session); |
64 |
int update(Session *session); |
|
2070.2.1
by Monty Taylor
First step in getting that anonymous union out of set_var. |
65 |
void setValue(const std::string &new_value); |
66 |
void setValue(uint64_t new_value); |
|
67 |
void updateValue(); |
|
68 |
||
69 |
uint64_t getInteger() |
|
70 |
{
|
|
2070.2.2
by Monty Taylor
Removed some guts from set_var. |
71 |
return uint64_t_value; |
2070.2.1
by Monty Taylor
First step in getting that anonymous union out of set_var. |
72 |
}
|
73 |
||
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
74 |
};
|
75 |
||
76 |
/* User variables like @my_own_variable */
|
|
77 |
||
78 |
class set_var_user: public set_var_base |
|
79 |
{
|
|
80 |
Item_func_set_user_var *user_var_item; |
|
81 |
public: |
|
2040.6.5
by Monty Taylor
Reset the vector in LEX. Stupid class reuse. |
82 |
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 |
83 |
user_var_item(item) |
1878.3.1
by Monty Taylor
Split set_var.* into sys_var.* and set_var.* |
84 |
{}
|
85 |
int check(Session *session); |
|
86 |
int update(Session *session); |
|
87 |
};
|
|
88 |
||
2040.6.4
by Monty Taylor
Replaced List<set_var_base> with |
89 |
typedef boost::shared_ptr<set_var_base> SetVarPtr; |
90 |
typedef std::vector<SetVarPtr> SetVarVector; |
|
91 |
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.* |
92 |
|
93 |
} /* namespace drizzled */ |
|
94 |