~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.h

  • Committer: Lee Bieber
  • Date: 2010-11-14 23:15:42 UTC
  • mfrom: (1929.1.42 warning-stack-frame)
  • Revision ID: kalebral@gmail.com-20101114231542-fnnu6ydd2p17n582
Merge Monty - fix bug 672372: some functions use > 32k stack

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
20
20
#ifndef DRIZZLED_SET_VAR_H
21
21
#define DRIZZLED_SET_VAR_H
22
22
 
23
 
#include <boost/shared_ptr.hpp>
24
 
 
 
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
*/
25
28
#include "drizzled/memory/sql_alloc.h"
26
29
#include "drizzled/sql_list.h"
27
30
#include "drizzled/lex_string.h"
53
56
  Classes for parsing of the SET command
54
57
****************************************************************************/
55
58
 
56
 
class set_var_base
 
59
class set_var_base :
 
60
  public memory::SqlAlloc
57
61
{
58
62
public:
59
63
  set_var_base() {}
67
71
class set_var :
68
72
  public set_var_base
69
73
{
70
 
  uint64_t uint64_t_value;
71
 
  std::string str_value;
72
74
public:
73
75
  sys_var *var;
74
76
  Item *value;
75
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;
76
88
  LEX_STRING base;                      /* for structs */
77
89
 
78
90
  set_var(sql_var_t type_arg, sys_var *var_arg,
79
91
          const LEX_STRING *base_name_arg, Item *value_arg);
80
92
  int check(Session *session);
81
93
  int update(Session *session);
82
 
  void setValue(const std::string &new_value);
83
 
  void setValue(uint64_t new_value);
84
 
  void updateValue();
85
 
 
86
 
  uint64_t getInteger()
87
 
  {
88
 
    return uint64_t_value;
89
 
  }
90
 
 
91
94
};
92
95
 
93
96
/* User variables like @my_own_variable */
96
99
{
97
100
  Item_func_set_user_var *user_var_item;
98
101
public:
99
 
  explicit set_var_user(Item_func_set_user_var *item) :
 
102
  set_var_user(Item_func_set_user_var *item) :
100
103
    user_var_item(item)
101
104
  {}
102
105
  int check(Session *session);
103
106
  int update(Session *session);
104
107
};
105
108
 
106
 
typedef boost::shared_ptr<set_var_base> SetVarPtr;
107
 
typedef std::vector<SetVarPtr> SetVarVector;
108
 
int sql_set_variables(Session *session, const SetVarVector &var_list);
 
109
int sql_set_variables(Session *session, List<set_var_base> *var_list);
109
110
 
110
111
} /* namespace drizzled */
111
112