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
20
#include <drizzled/server_includes.h>
22
#include <drizzled/function/str/elt.h>
24
void Item_func_elt::fix_length_and_dec()
29
if (agg_arg_charsets(collation, args+1, arg_count-1, MY_COLL_ALLOW_CONV, 1))
32
for (uint32_t i= 1 ; i < arg_count ; i++)
34
set_if_bigger(max_length,args[i]->max_length);
35
set_if_bigger(decimals,args[i]->decimals);
37
maybe_null=1; // NULL if wrong first arg
41
double Item_func_elt::val_real()
46
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
48
double result= args[tmp]->val_real();
49
null_value= args[tmp]->null_value;
53
int64_t Item_func_elt::val_int()
58
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
61
int64_t result= args[tmp]->val_int();
62
null_value= args[tmp]->null_value;
67
String *Item_func_elt::val_str(String *str)
72
if ((tmp=(uint) args[0]->val_int()) == 0 || tmp >= arg_count)
75
String *result= args[tmp]->val_str(str);
77
result->set_charset(collation.collation);
78
null_value= args[tmp]->null_value;