~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/get_user_var.h

Fix merge issues with 1.0 CC fix.

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
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_FUNCTION_GET_USER_VAR_H
21
 
#define DRIZZLED_FUNCTION_GET_USER_VAR_H
 
20
#pragma once
22
21
 
23
 
class user_var_entry;
24
22
#include <drizzled/function/func.h>
 
23
#include <drizzled/lex_string.h>
 
24
 
 
25
namespace drizzled {
25
26
 
26
27
class Item_func_get_user_var :public Item_func
27
28
{
28
29
  user_var_entry *var_entry;
29
30
  Item_result m_cached_result_type;
 
31
  Session &session;
30
32
 
31
33
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) {}
 
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
  {}
35
41
  enum Functype functype() const { return GUSERVAR_FUNC; }
36
 
  LEX_STRING get_name() { return name; }
 
42
  str_ref get_name() { return name; }
37
43
  double val_real();
38
44
  int64_t val_int();
39
 
  my_decimal *val_decimal(my_decimal*);
 
45
  type::Decimal *val_decimal(type::Decimal*);
40
46
  String *val_str(String* str);
41
47
  void fix_length_and_dec();
42
 
  virtual void print(String *str, enum_query_type query_type);
 
48
  virtual void print(String *str);
43
49
  enum Item_result result_type() const;
44
50
  /*
45
51
    We must always return variables as strings to guard against selects of type
52
58
  bool eq(const Item *item, bool binary_cmp) const;
53
59
};
54
60
 
55
 
#endif /* DRIZZLED_FUNCTION_GET_USER_VAR_H */
 
61
} /* namespace drizzled */
 
62