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/get_variable.h> |
25 |
#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 |
26 |
|
27 |
bool Item_user_var_as_out_param::fix_fields(Session *session, Item **ref) |
|
28 |
{
|
|
29 |
assert(fixed == 0); |
|
30 |
if (Item::fix_fields(session, ref) || |
|
31 |
!(entry= get_variable(&session->user_vars, name, 1))) |
|
32 |
return true; |
|
33 |
entry->type= STRING_RESULT; |
|
34 |
/*
|
|
35 |
Let us set the same collation which is used for loading
|
|
36 |
of fields in LOAD DATA INFILE.
|
|
37 |
(Since Item_user_var_as_out_param is used only there).
|
|
38 |
*/
|
|
39 |
entry->collation.set(session->variables.collation_database); |
|
40 |
entry->update_query_id= session->query_id; |
|
41 |
return false; |
|
42 |
}
|
|
43 |
||
44 |
void Item_user_var_as_out_param::set_null_value(const CHARSET_INFO * const cs) |
|
45 |
{
|
|
46 |
::update_hash(entry, true, 0, 0, STRING_RESULT, cs, |
|
47 |
DERIVATION_IMPLICIT, 0 /* unsigned_arg */); |
|
48 |
}
|
|
49 |
||
50 |
||
51 |
void Item_user_var_as_out_param::set_value(const char *str, uint32_t length, |
|
52 |
const CHARSET_INFO * const cs) |
|
53 |
{
|
|
54 |
::update_hash(entry, false, (void*)str, length, STRING_RESULT, cs, |
|
55 |
DERIVATION_IMPLICIT, 0 /* unsigned_arg */); |
|
56 |
}
|
|
57 |
||
58 |
double Item_user_var_as_out_param::val_real() |
|
59 |
{
|
|
60 |
assert(0); |
|
61 |
return 0.0; |
|
62 |
}
|
|
63 |
||
64 |
||
65 |
int64_t Item_user_var_as_out_param::val_int() |
|
66 |
{
|
|
67 |
assert(0); |
|
68 |
return 0; |
|
69 |
}
|
|
70 |
||
71 |
||
779.1.27
by Monty Taylor
Got rid of __attribute__((unused)) and the like from the .cc files. |
72 |
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 |
73 |
{
|
74 |
assert(0); |
|
75 |
return 0; |
|
76 |
}
|
|
77 |
||
779.1.27
by Monty Taylor
Got rid of __attribute__((unused)) and the like from the .cc files. |
78 |
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 |
79 |
{
|
80 |
assert(0); |
|
81 |
return 0; |
|
82 |
}
|
|
83 |
||
84 |
||
85 |
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. |
86 |
enum_query_type ) |
492.3.35
by Lee
more changes to move functions from item_func.cc/h to the functions directory |
87 |
{
|
88 |
str->append('@'); |
|
89 |
str->append(name.str,name.length); |
|
90 |
}
|
|
91 |