Drizzled Public API Documentation

ref_null_helper.cc
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, Inc.
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 <config.h>
21 
22 #include <drizzled/item/ref.h>
23 #include <drizzled/item/ref_null_helper.h>
24 #include <drizzled/item/subselect.h>
25 #include <drizzled/lex_string.h>
26 
27 namespace drizzled {
28 
30 {
31  assert(fixed == 1);
32  double tmp= (*ref)->val_result();
33  owner->was_null|= null_value= (*ref)->null_value;
34  return tmp;
35 }
36 
37 
39 {
40  assert(fixed == 1);
41  int64_t tmp= (*ref)->val_int_result();
42  owner->was_null|= null_value= (*ref)->null_value;
43  return tmp;
44 }
45 
46 
48 {
49  assert(fixed == 1);
50  type::Decimal *val= (*ref)->val_decimal_result(decimal_value);
51  owner->was_null|= null_value= (*ref)->null_value;
52  return val;
53 }
54 
56 {
57  assert(fixed == 1);
58  bool val= (*ref)->val_bool_result();
59  owner->was_null|= null_value= (*ref)->null_value;
60  return val;
61 }
62 
63 
65 {
66  assert(fixed == 1);
67  String* tmp= (*ref)->str_result(s);
68  owner->was_null|= null_value= (*ref)->null_value;
69  return tmp;
70 }
71 
72 bool Item_ref_null_helper::get_date(type::Time &ltime, uint32_t fuzzydate)
73 {
74  return (owner->was_null|= null_value= (*ref)->get_date(ltime, fuzzydate));
75 }
76 
78 {
79  str->append(STRING_WITH_LEN("<ref_null_helper>("));
80  if (ref)
81  (*ref)->print(str);
82  else
83  str->append('?');
84  str->append(')');
85 }
86 
87 } /* namespace drizzled */