Drizzled Public API Documentation

get_user_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 <drizzled/function/func.h>
23 #include <drizzled/lex_string.h>
24 
25 namespace drizzled {
26 
28 {
29  user_var_entry *var_entry;
30  Item_result m_cached_result_type;
31  Session &session;
32 
33 public:
34  str_ref name; // keep it public
35  Item_func_get_user_var(Session &session_arg, str_ref a) :
36  Item_func(),
37  m_cached_result_type(STRING_RESULT),
38  session(session_arg),
39  name(a)
40  {}
41  enum Functype functype() const { return GUSERVAR_FUNC; }
42  str_ref get_name() { return name; }
43  double val_real();
44  int64_t val_int();
45  type::Decimal *val_decimal(type::Decimal*);
46  String *val_str(String* str);
47  void fix_length_and_dec();
48  virtual void print(String *str);
49  enum Item_result result_type() const;
50  /*
51  We must always return variables as strings to guard against selects of type
52  select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b)
53  */
54  const char *func_name() const { return "get_user_var"; }
55  bool const_item() const;
56  table_map used_tables() const
57  { return const_item() ? 0 : RAND_TABLE_BIT; }
58  bool eq(const Item *item, bool binary_cmp) const;
59 };
60 
61 } /* namespace drizzled */
62