~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.h

Use List::begin()

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
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
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 "drizzled/memory/sql_alloc.h"
24
 
#include "drizzled/sql_list.h"
25
 
#include "drizzled/lex_string.h"
 
23
#include <boost/shared_ptr.hpp>
 
24
 
 
25
#include <drizzled/memory/sql_alloc.h>
 
26
#include <drizzled/sql_list.h>
 
27
#include <drizzled/lex_string.h>
26
28
 
27
29
namespace drizzled
28
30
{
51
53
  Classes for parsing of the SET command
52
54
****************************************************************************/
53
55
 
54
 
class set_var_base :
55
 
  public memory::SqlAlloc
 
56
class set_var_base
56
57
{
57
58
public:
58
59
  set_var_base() {}
66
67
class set_var :
67
68
  public set_var_base
68
69
{
 
70
  uint64_t uint64_t_value;
 
71
  std::string str_value;
69
72
public:
70
73
  sys_var *var;
71
74
  Item *value;
72
75
  sql_var_t type;
73
 
  union
74
 
  {
75
 
    const CHARSET_INFO *charset;
76
 
    uint32_t uint32_t_value;
77
 
    uint64_t uint64_t_value;
78
 
    size_t size_t_value;
79
 
    plugin::StorageEngine *storage_engine;
80
 
    Time_zone *time_zone;
81
 
    MY_LOCALE *locale_value;
82
 
  } save_result;
83
76
  LEX_STRING base;                      /* for structs */
84
77
 
85
78
  set_var(sql_var_t type_arg, sys_var *var_arg,
86
79
          const LEX_STRING *base_name_arg, Item *value_arg);
87
80
  int check(Session *session);
88
81
  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
 
89
91
};
90
92
 
91
93
/* User variables like @my_own_variable */
94
96
{
95
97
  Item_func_set_user_var *user_var_item;
96
98
public:
97
 
  set_var_user(Item_func_set_user_var *item) :
 
99
  explicit set_var_user(Item_func_set_user_var *item) :
98
100
    user_var_item(item)
99
101
  {}
100
102
  int check(Session *session);
101
103
  int update(Session *session);
102
104
};
103
105
 
104
 
int sql_set_variables(Session *session, List<set_var_base> *var_list);
 
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);
105
109
 
106
110
} /* namespace drizzled */
107
111