~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/functions/get_user_var.h

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
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
#ifndef DRIZZLED_FUNCTIONS_GET_USER_VAR_H
 
21
#define DRIZZLED_FUNCTIONS_GET_USER_VAR_H
 
22
 
 
23
class user_var_entry;
 
24
#include <drizzled/functions/func.h> 
 
25
 
 
26
class Item_func_get_user_var :public Item_func
 
27
{
 
28
  user_var_entry *var_entry;
 
29
  Item_result m_cached_result_type;
 
30
 
 
31
public:
 
32
  LEX_STRING name; // keep it public
 
33
  Item_func_get_user_var(LEX_STRING a):
 
34
    Item_func(), m_cached_result_type(STRING_RESULT), name(a) {}
 
35
  enum Functype functype() const { return GUSERVAR_FUNC; }
 
36
  LEX_STRING get_name() { return name; }
 
37
  double val_real();
 
38
  int64_t val_int();
 
39
  my_decimal *val_decimal(my_decimal*);
 
40
  String *val_str(String* str);
 
41
  void fix_length_and_dec();
 
42
  virtual void print(String *str, enum_query_type query_type);
 
43
  enum Item_result result_type() const;
 
44
  /*
 
45
    We must always return variables as strings to guard against selects of type
 
46
    select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b)
 
47
  */
 
48
  const char *func_name() const { return "get_user_var"; }
 
49
  bool const_item() const;
 
50
  table_map used_tables() const
 
51
  { return const_item() ? 0 : RAND_TABLE_BIT; }
 
52
  bool eq(const Item *item, bool binary_cmp) const;
 
53
};
 
54
 
 
55
#endif /* DRIZZLED_FUNCTIONS_GET_USER_VAR_H */