~jaypipes/drizzle/new-test-runner

« back to all changes in this revision

Viewing changes to drizzled/item/null.h

  • Committer: Jay Pipes
  • Date: 2008-12-11 17:52:34 UTC
  • mfrom: (482.16.152 testable)
  • Revision ID: jpipes@serialcoder-20081211175234-uqsfvmgxejvmellq
merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
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_NULL_H
 
21
#define DRIZZLED_ITEM_NULL_H
 
22
 
 
23
class Item_null :public Item_basic_constant
 
24
{
 
25
public:
 
26
 
 
27
  Item_null(char *name_par=0)
 
28
  {
 
29
    maybe_null= null_value= true;
 
30
    max_length= 0;
 
31
    name= name_par ? name_par : (char*) "NULL";
 
32
    fixed= 1;
 
33
    collation.set(&my_charset_bin, DERIVATION_IGNORABLE);
 
34
  }
 
35
  enum Type type() const { return NULL_ITEM; }
 
36
  bool eq(const Item *item, bool binary_cmp) const;
 
37
  double val_real();
 
38
  int64_t val_int();
 
39
  String *val_str(String *str);
 
40
  my_decimal *val_decimal(my_decimal *);
 
41
  int save_in_field(Field *field, bool no_conversions);
 
42
  int save_safe_in_field(Field *field);
 
43
  bool send(Protocol *protocol, String *str);
 
44
  enum Item_result result_type () const { return STRING_RESULT; }
 
45
  enum_field_types field_type() const   { return DRIZZLE_TYPE_NULL; }
 
46
  bool basic_const_item() const { return 1; }
 
47
  Item *clone_item() { return new Item_null(name); }
 
48
  bool is_null() { return true; }
 
49
 
 
50
  virtual void print(String *str, enum_query_type);
 
51
 
 
52
  Item *safe_charset_converter(const CHARSET_INFO * const tocs);
 
53
  bool check_vcol_func_processor(unsigned char *)
 
54
  { return false; }
 
55
};
 
56
 
 
57
class Item_null_result :public Item_null
 
58
{
 
59
public:
 
60
  Field *result_field;
 
61
  Item_null_result() : Item_null(), result_field(0) {}
 
62
  bool is_result_field() { return result_field != 0; }
 
63
  void save_in_result_field(bool no_conversions)
 
64
  {
 
65
    save_in_field(result_field, no_conversions);
 
66
  }
 
67
  bool check_vcol_func_processor(unsigned char *)
 
68
  { return true; }
 
69
};
 
70
 
 
71
#endif /* DRIZZLED_ITEM_NULL_H */