~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.h

  • Committer: Stewart Smith
  • Date: 2010-12-02 06:58:45 UTC
  • mto: (2021.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1971.
  • Revision ID: stewart@flamingspork.com-20101202065845-th85agu1pl15seh6
update select and subselect_mat test results EXPLAIN output due to improvements in innodb stats

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
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 {
 
20
#ifndef DRIZZLED_SET_VAR_H
 
21
#define DRIZZLED_SET_VAR_H
 
22
 
 
23
/*#include "drizzled/function/func.h"
 
24
#include "drizzled/function/set_user_var.h"
 
25
#include "drizzled/item/string.h"
 
26
#include "drizzled/item/field.h"
 
27
*/
 
28
#include "drizzled/memory/sql_alloc.h"
 
29
#include "drizzled/sql_list.h"
 
30
#include "drizzled/lex_string.h"
 
31
 
 
32
namespace drizzled
 
33
{
 
34
 
 
35
namespace plugin
 
36
{
 
37
class StorageEngine;
 
38
}
 
39
 
 
40
class sys_var;
 
41
class Item;
 
42
class Item_func_set_user_var;
 
43
class Time_zone;
 
44
typedef struct my_locale_st MY_LOCALE;
 
45
typedef struct charset_info_st CHARSET_INFO;
29
46
 
30
47
/* Classes to support the SET command */
31
48
 
39
56
  Classes for parsing of the SET command
40
57
****************************************************************************/
41
58
 
42
 
class set_var_base
 
59
class set_var_base :
 
60
  public memory::SqlAlloc
43
61
{
44
62
public:
45
63
  set_var_base() {}
53
71
class set_var :
54
72
  public set_var_base
55
73
{
56
 
  uint64_t uint64_t_value;
57
 
  std::string str_value;
58
74
public:
59
75
  sys_var *var;
60
76
  Item *value;
61
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;
62
88
  LEX_STRING base;                      /* for structs */
63
89
 
64
90
  set_var(sql_var_t type_arg, sys_var *var_arg,
65
91
          const LEX_STRING *base_name_arg, Item *value_arg);
66
92
  int check(Session *session);
67
93
  int update(Session *session);
68
 
  void setValue(const std::string &new_value);
69
 
  void setValue(uint64_t new_value);
70
 
  void updateValue();
71
 
 
72
 
  uint64_t getInteger()
73
 
  {
74
 
    return uint64_t_value;
75
 
  }
76
 
 
77
94
};
78
95
 
79
96
/* User variables like @my_own_variable */
82
99
{
83
100
  Item_func_set_user_var *user_var_item;
84
101
public:
85
 
  explicit set_var_user(Item_func_set_user_var *item) :
 
102
  set_var_user(Item_func_set_user_var *item) :
86
103
    user_var_item(item)
87
104
  {}
88
105
  int check(Session *session);
89
106
  int update(Session *session);
90
107
};
91
108
 
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);
 
109
int sql_set_variables(Session *session, List<set_var_base> *var_list);
95
110
 
96
111
} /* namespace drizzled */
97
112
 
 
113
#endif /* DRIZZLED_SET_VAR_H */