1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
27
void Item_func_elt::fix_length_and_dec()
32
if (agg_arg_charsets(collation, args+1, arg_count-1, MY_COLL_ALLOW_CONV, 1))
35
for (uint32_t i= 1 ; i < arg_count ; i++)
37
set_if_bigger(max_length,args[i]->max_length);
38
set_if_bigger(decimals,args[i]->decimals);
40
maybe_null=1; // NULL if wrong first arg
44
double Item_func_elt::val_real()
49
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
51
double result= args[tmp]->val_real();
52
null_value= args[tmp]->null_value;
56
int64_t Item_func_elt::val_int()
61
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
64
int64_t result= args[tmp]->val_int();
65
null_value= args[tmp]->null_value;
70
String *Item_func_elt::val_str(String *str)
75
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
78
String *result= args[tmp]->val_str(str);
80
result->set_charset(collation.collation);
81
null_value= args[tmp]->null_value;
85
} /* namespace drizzled */