Drizzled Public API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ref_null_helper.h
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
#pragma once
21
22
/*
23
An object of this class:
24
- Converts val_XXX() calls to ref->val_XXX_result() calls, like Item_ref.
25
- Sets owner->was_null=true if it has returned a NULL value from any
26
val_XXX() function. This allows to inject an Item_ref_null_helper
27
object into subquery and then check if the subquery has produced a row
28
with NULL value.
29
*/
30
31
namespace
drizzled {
32
33
class
Item_ref_null_helper
:
public
Item_ref
34
{
35
protected
:
36
Item_in_subselect
* owner;
37
public
:
38
Item_ref_null_helper
(
Name_resolution_context
*context_arg,
39
Item_in_subselect
* master,
Item
**item,
40
const
char
*table_name_arg,
const
char
*field_name_arg)
41
:
Item_ref
(context_arg, item, table_name_arg, field_name_arg),
42
owner(master) {}
43
double
val_real
();
44
int64_t
val_int
();
45
String
*
val_str
(
String
* s);
46
type::Decimal
*
val_decimal
(
type::Decimal
*);
47
bool
val_bool
();
48
bool
get_date
(
type::Time
<ime, uint32_t fuzzydate);
49
virtual
void
print
(
String
*str);
50
/*
51
we add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE
52
*/
53
table_map
used_tables
()
const
54
{
55
return
(depended_from ?
56
OUTER_REF_TABLE_BIT :
57
(*ref)->used_tables() | RAND_TABLE_BIT);
58
}
59
};
60
61
}
/* namespace drizzled */
62
drizzled
item
ref_null_helper.h
Generated on Thu Aug 29 2013 10:00:22 for drizzle by
1.8.4