Drizzled Public API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
set_var.h
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, Inc.
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
#pragma once
21
22
#include <boost/shared_ptr.hpp>
23
24
#include <drizzled/common_fwd.h>
25
#include <drizzled/enum.h>
26
#include <drizzled/lex_string.h>
27
28
namespace
drizzled {
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
42
class
set_var_base
43
{
44
public
:
45
virtual
~
set_var_base
() {}
46
virtual
int
check(
Session
*)= 0;
/* To check privileges etc. */
47
virtual
int
update(
Session
*)= 0;
/* To set the value */
48
/* light check for PS */
49
};
50
51
/* MySQL internal variables */
52
class
set_var
:
public
set_var_base
53
{
54
uint64_t uint64_t_value;
55
std::string str_value;
56
public
:
57
sys_var
*
var
;
58
Item
*value;
59
sql_var_t type;
60
str_ref
base;
// for structs
61
62
set_var
(sql_var_t type_arg,
sys_var
*var_arg,
str_ref
base_name_arg,
Item
*value_arg);
63
int
check(
Session
*session);
64
int
update
(
Session
*session);
65
void
setValue(
const
std::string &new_value);
66
void
setValue(uint64_t new_value);
67
void
updateValue();
68
69
uint64_t getInteger()
70
{
71
return
uint64_t_value;
72
}
73
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
:
82
explicit
set_var_user
(
Item_func_set_user_var
*item) :
83
user_var_item(item)
84
{}
85
int
check(
Session
*session);
86
int
update(
Session
*session);
87
};
88
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);
92
93
}
/* namespace drizzled */
94
drizzled
set_var.h
Generated on Wed Aug 21 2013 20:36:46 for drizzle by
1.8.4