drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
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
29
double
Item_ref_null_helper::val_real
()
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
38
int64_t
Item_ref_null_helper::val_int
()
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
47
type::Decimal
*
Item_ref_null_helper::val_decimal
(
type::Decimal
*decimal_value)
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
55
bool
Item_ref_null_helper::val_bool
()
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
64
String
*
Item_ref_null_helper::val_str
(
String
* s)
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
<ime, uint32_t fuzzydate)
73
{
74
return
(owner->was_null|=
null_value
= (*ref)->get_date(ltime, fuzzydate));
75
}
76
77
void
Item_ref_null_helper::print
(
String
*str)
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 */
drizzled::Item_ref_null_helper::print
virtual void print(String *str)
Definition
ref_null_helper.cc:77
drizzled::Item_ref_null_helper::val_str
String * val_str(String *s)
Definition
ref_null_helper.cc:64
drizzled::Item_ref_null_helper::val_int
int64_t val_int()
Definition
ref_null_helper.cc:38
drizzled::Item_ref_null_helper::get_date
bool get_date(type::Time <ime, uint32_t fuzzydate)
Definition
ref_null_helper.cc:72
drizzled::Item_ref_null_helper::val_real
double val_real()
Definition
ref_null_helper.cc:29
drizzled::Item_ref_null_helper::val_bool
bool val_bool()
Definition
ref_null_helper.cc:55
drizzled::Item_ref_null_helper::val_decimal
type::Decimal * val_decimal(type::Decimal *)
Definition
ref_null_helper.cc:47
drizzled::Item::fixed
bool fixed
Definition
item.h:122
drizzled::Item::null_value
bool null_value
Definition
item.h:124
drizzled::String
Definition
sql_string.h:58
drizzled::type::Decimal
Definition
type/decimal.h:184
drizzled::type::Time
Definition
type/time.h:99
drizzled
TODO: Rename this file - func.h is stupid.
Definition
abort_exception.h:27
← Back to Drizzle docs
drizzled
item
ref_null_helper.cc
Generated by
1.15.0