~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
20
#ifndef DRIZZLED_ITEM_REF_NULL_HELPER_H
21
#define DRIZZLED_ITEM_REF_NULL_HELPER_H
22
23
/*
24
  An object of this class:
25
   - Converts val_XXX() calls to ref->val_XXX_result() calls, like Item_ref.
26
   - Sets owner->was_null=true if it has returned a NULL value from any
27
     val_XXX() function. This allows to inject an Item_ref_null_helper
28
     object into subquery and then check if the subquery has produced a row
29
     with NULL value.
30
*/
31
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
32
namespace drizzled
33
{
34
642.1.10 by Lee
move functions from item.cc/item.h to item directory
35
class Item_ref_null_helper: public Item_ref
36
{
37
protected:
38
  Item_in_subselect* owner;
39
public:
40
  Item_ref_null_helper(Name_resolution_context *context_arg,
41
                       Item_in_subselect* master, Item **item,
42
                       const char *table_name_arg, const char *field_name_arg)
43
    :Item_ref(context_arg, item, table_name_arg, field_name_arg),
44
     owner(master) {}
45
  double val_real();
46
  int64_t val_int();
47
  String* val_str(String* s);
2030.1.4 by Brian Aker
Change my_decimal to Decimal
48
  type::Decimal *val_decimal(type::Decimal *);
642.1.10 by Lee
move functions from item.cc/item.h to item directory
49
  bool val_bool();
2030.1.5 by Brian Aker
Update for moving DRIZZLE_TIME to type::Time
50
  bool get_date(type::Time *ltime, uint32_t fuzzydate);
642.1.10 by Lee
move functions from item.cc/item.h to item directory
51
  virtual void print(String *str, enum_query_type query_type);
52
  /*
53
    we add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE
54
  */
55
  table_map used_tables() const
56
  {
57
    return (depended_from ?
58
            OUTER_REF_TABLE_BIT :
59
            (*ref)->used_tables() | RAND_TABLE_BIT);
60
  }
61
};
62
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
63
} /* namespace drizzled */
64
642.1.10 by Lee
move functions from item.cc/item.h to item directory
65
#endif /* DRIZZLED_ITEM_REF_NULL_HELPER_H */