~drizzle-trunk/drizzle/development

642.1.10 by Lee
move functions from item.cc/item.h to item directory
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
642.1.10 by Lee
move functions from item.cc/item.h to item directory
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
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
20
#include <config.h>
2154.2.4 by Brian Aker
This fixes 716459
21
642.1.24 by Lee
more header file cleanup
22
#include <drizzled/item/ref.h>
642.1.10 by Lee
move functions from item.cc/item.h to item directory
23
#include <drizzled/item/ref_null_helper.h>
24
#include <drizzled/item/subselect.h>
2154.2.4 by Brian Aker
This fixes 716459
25
#include <drizzled/lex_string.h>
642.1.10 by Lee
move functions from item.cc/item.h to item directory
26
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
27
namespace drizzled
28
{
29
642.1.10 by Lee
move functions from item.cc/item.h to item directory
30
double Item_ref_null_helper::val_real()
31
{
32
  assert(fixed == 1);
33
  double tmp= (*ref)->val_result();
34
  owner->was_null|= null_value= (*ref)->null_value;
35
  return tmp;
36
}
37
38
39
int64_t Item_ref_null_helper::val_int()
40
{
41
  assert(fixed == 1);
42
  int64_t tmp= (*ref)->val_int_result();
43
  owner->was_null|= null_value= (*ref)->null_value;
44
  return tmp;
45
}
46
47
2030.1.4 by Brian Aker
Change my_decimal to Decimal
48
type::Decimal *Item_ref_null_helper::val_decimal(type::Decimal *decimal_value)
642.1.10 by Lee
move functions from item.cc/item.h to item directory
49
{
50
  assert(fixed == 1);
2030.1.4 by Brian Aker
Change my_decimal to Decimal
51
  type::Decimal *val= (*ref)->val_decimal_result(decimal_value);
642.1.10 by Lee
move functions from item.cc/item.h to item directory
52
  owner->was_null|= null_value= (*ref)->null_value;
53
  return val;
54
}
55
56
bool Item_ref_null_helper::val_bool()
57
{
58
  assert(fixed == 1);
59
  bool val= (*ref)->val_bool_result();
60
  owner->was_null|= null_value= (*ref)->null_value;
61
  return val;
62
}
63
64
65
String* Item_ref_null_helper::val_str(String* s)
66
{
67
  assert(fixed == 1);
68
  String* tmp= (*ref)->str_result(s);
69
  owner->was_null|= null_value= (*ref)->null_value;
70
  return tmp;
71
}
72
2104.2.8 by Brian Aker
Merge in reference from pointer.
73
bool Item_ref_null_helper::get_date(type::Time &ltime, uint32_t fuzzydate)
642.1.10 by Lee
move functions from item.cc/item.h to item directory
74
{
75
  return (owner->was_null|= null_value= (*ref)->get_date(ltime, fuzzydate));
76
}
77
2215.2.1 by Stewart Smith
remove enum_query_type which was effectively unused. It was set to one value once, compared to it once (i.e. always true) and passed around everywhere doing nothing.
78
void Item_ref_null_helper::print(String *str)
642.1.10 by Lee
move functions from item.cc/item.h to item directory
79
{
80
  str->append(STRING_WITH_LEN("<ref_null_helper>("));
81
  if (ref)
2215.2.1 by Stewart Smith
remove enum_query_type which was effectively unused. It was set to one value once, compared to it once (i.e. always true) and passed around everywhere doing nothing.
82
    (*ref)->print(str);
642.1.10 by Lee
move functions from item.cc/item.h to item directory
83
  else
84
    str->append('?');
85
  str->append(')');
86
}
87
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
88
} /* namespace drizzled */