00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #pragma once
00021
00022 #include <boost/shared_ptr.hpp>
00023
00024 #include <drizzled/enum.h>
00025 #include <drizzled/lex_string.h>
00026
00027 namespace drizzled {
00028
00029 namespace plugin
00030 {
00031 class StorageEngine;
00032 }
00033
00034 class Session;
00035 class sys_var;
00036 class Item;
00037 class Item_func_set_user_var;
00038 class Time_zone;
00039 typedef struct my_locale_st MY_LOCALE;
00040 typedef struct charset_info_st CHARSET_INFO;
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 class set_var_base
00055 {
00056 public:
00057 set_var_base() {}
00058 virtual ~set_var_base() {}
00059 virtual int check(Session *session)=0;
00060 virtual int update(Session *session)=0;
00061
00062 };
00063
00064
00065 class set_var :
00066 public set_var_base
00067 {
00068 uint64_t uint64_t_value;
00069 std::string str_value;
00070 public:
00071 sys_var *var;
00072 Item *value;
00073 sql_var_t type;
00074 LEX_STRING base;
00075
00076 set_var(sql_var_t type_arg, sys_var *var_arg,
00077 const LEX_STRING *base_name_arg, Item *value_arg);
00078 int check(Session *session);
00079 int update(Session *session);
00080 void setValue(const std::string &new_value);
00081 void setValue(uint64_t new_value);
00082 void updateValue();
00083
00084 uint64_t getInteger()
00085 {
00086 return uint64_t_value;
00087 }
00088
00089 };
00090
00091
00092
00093 class set_var_user: public set_var_base
00094 {
00095 Item_func_set_user_var *user_var_item;
00096 public:
00097 explicit set_var_user(Item_func_set_user_var *item) :
00098 user_var_item(item)
00099 {}
00100 int check(Session *session);
00101 int update(Session *session);
00102 };
00103
00104 typedef boost::shared_ptr<set_var_base> SetVarPtr;
00105 typedef std::vector<SetVarPtr> SetVarVector;
00106 int sql_set_variables(Session *session, const SetVarVector &var_list);
00107
00108 }
00109