~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/ref_null_helper.cc

move functions from item.cc/item.h to item directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
22
#include <drizzled/item/ref_null_helper.h>
 
23
#include <drizzled/item/subselect.h>
 
24
 
 
25
double Item_ref_null_helper::val_real()
 
26
{
 
27
  assert(fixed == 1);
 
28
  double tmp= (*ref)->val_result();
 
29
  owner->was_null|= null_value= (*ref)->null_value;
 
30
  return tmp;
 
31
}
 
32
 
 
33
 
 
34
int64_t Item_ref_null_helper::val_int()
 
35
{
 
36
  assert(fixed == 1);
 
37
  int64_t tmp= (*ref)->val_int_result();
 
38
  owner->was_null|= null_value= (*ref)->null_value;
 
39
  return tmp;
 
40
}
 
41
 
 
42
 
 
43
my_decimal *Item_ref_null_helper::val_decimal(my_decimal *decimal_value)
 
44
{
 
45
  assert(fixed == 1);
 
46
  my_decimal *val= (*ref)->val_decimal_result(decimal_value);
 
47
  owner->was_null|= null_value= (*ref)->null_value;
 
48
  return val;
 
49
}
 
50
 
 
51
bool Item_ref_null_helper::val_bool()
 
52
{
 
53
  assert(fixed == 1);
 
54
  bool val= (*ref)->val_bool_result();
 
55
  owner->was_null|= null_value= (*ref)->null_value;
 
56
  return val;
 
57
}
 
58
 
 
59
 
 
60
String* Item_ref_null_helper::val_str(String* s)
 
61
{
 
62
  assert(fixed == 1);
 
63
  String* tmp= (*ref)->str_result(s);
 
64
  owner->was_null|= null_value= (*ref)->null_value;
 
65
  return tmp;
 
66
}
 
67
 
 
68
bool Item_ref_null_helper::get_date(DRIZZLE_TIME *ltime, uint32_t fuzzydate)
 
69
{
 
70
  return (owner->was_null|= null_value= (*ref)->get_date(ltime, fuzzydate));
 
71
}
 
72
 
 
73
void Item_ref_null_helper::print(String *str, enum_query_type query_type)
 
74
{
 
75
  str->append(STRING_WITH_LEN("<ref_null_helper>("));
 
76
  if (ref)
 
77
    (*ref)->print(str, query_type);
 
78
  else
 
79
    str->append('?');
 
80
  str->append(')');
 
81
}
 
82
 
 
83