~drizzle-trunk/drizzle/development

492.3.35 by Lee
more changes to move functions from item_func.cc/h to the functions directory
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
#include <drizzled/server_includes.h>
21
#include CSTDINT_H
670.1.20 by Monty Taylor
Renamed functions to function... everything else is singular.
22
#include <drizzled/function/user_var_as_out_param.h>
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
23
#include <drizzled/session.h>
670.1.20 by Monty Taylor
Renamed functions to function... everything else is singular.
24
#include <drizzled/function/update_hash.h>
492.3.35 by Lee
more changes to move functions from item_func.cc/h to the functions directory
25
26
bool Item_user_var_as_out_param::fix_fields(Session *session, Item **ref)
27
{
28
  assert(fixed == 0);
29
  if (Item::fix_fields(session, ref) ||
995 by Brian Aker
Refactor get_variable to session
30
      !(entry= session->getVariable(name, true)))
492.3.35 by Lee
more changes to move functions from item_func.cc/h to the functions directory
31
    return true;
32
  entry->type= STRING_RESULT;
33
  /*
34
    Let us set the same collation which is used for loading
35
    of fields in LOAD DATA INFILE.
36
    (Since Item_user_var_as_out_param is used only there).
37
  */
1014.3.2 by Brian Aker
Factor out need for session in many "schema" calls. Removed variable about
38
  entry->collation.set(default_charset_info);
492.3.35 by Lee
more changes to move functions from item_func.cc/h to the functions directory
39
  entry->update_query_id= session->query_id;
40
  return false;
41
}
42
43
void Item_user_var_as_out_param::set_null_value(const CHARSET_INFO * const cs)
44
{
45
  ::update_hash(entry, true, 0, 0, STRING_RESULT, cs,
46
                DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
47
}
48
49
50
void Item_user_var_as_out_param::set_value(const char *str, uint32_t length,
51
                                           const CHARSET_INFO * const cs)
52
{
53
  ::update_hash(entry, false, (void*)str, length, STRING_RESULT, cs,
54
                DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
55
}
56
57
double Item_user_var_as_out_param::val_real()
58
{
59
  assert(0);
60
  return 0.0;
61
}
62
63
64
int64_t Item_user_var_as_out_param::val_int()
65
{
66
  assert(0);
67
  return 0;
68
}
69
70
779.1.27 by Monty Taylor
Got rid of __attribute__((unused)) and the like from the .cc files.
71
String* Item_user_var_as_out_param::val_str(String *)
492.3.35 by Lee
more changes to move functions from item_func.cc/h to the functions directory
72
{
73
  assert(0);
74
  return 0;
75
}
76
779.1.27 by Monty Taylor
Got rid of __attribute__((unused)) and the like from the .cc files.
77
my_decimal* Item_user_var_as_out_param::val_decimal(my_decimal *)
492.3.35 by Lee
more changes to move functions from item_func.cc/h to the functions directory
78
{
79
  assert(0);
80
  return 0;
81
}
82
83
84
void Item_user_var_as_out_param::print(String *str,
779.1.27 by Monty Taylor
Got rid of __attribute__((unused)) and the like from the .cc files.
85
                                       enum_query_type )
492.3.35 by Lee
more changes to move functions from item_func.cc/h to the functions directory
86
{
87
  str->append('@');
88
  str->append(name.str,name.length);
89
}
90