~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/null.h

  • Committer: Mats Kindahl
  • Date: 2008-08-26 07:32:59 UTC
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: mats@mysql.com-20080826073259-9k4evtajgldgolli
Replaced use of thd_proc_info() macro with calls to
set_proc_info() and get_proc_info() internally.  Introduced
functions set_thd_proc_info() and get_thd_proc_info() for
external users, i.e., plug-ins.

The set_thd_proc_info() accepted callers info that can be used to
print debug output, but the information was not used. The return
value was changed to void and the old value is not fetched any
more. To be able to get the value of proc_info for external
users, the function get_thd_proc_info() was introduced.

The thd_proc_info() macro called set_thd_proc_info() but almost
never used the return value of set_thd_proc_info() so the macro
was replaced with a call of THD::set_proc_info().

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
4
 *  Copyright (C) 2008 MySQL
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifndef DRIZZLED_FIELD_NULL_H
22
 
#define DRIZZLED_FIELD_NULL_H
23
 
 
24
 
#include <drizzled/field/str.h>
25
 
 
26
 
namespace drizzled
27
 
{
28
 
 
29
 
/*
30
 
 * Everything saved in this will disappear. It will always return NULL
 
21
#ifndef DRIZZLE_SERVER_FIELD_NULL
 
22
#define DRIZZLE_SERVER_FIELD_NULL
 
23
 
 
24
/* 
 
25
  Everything saved in this will disappear. It will always return NULL 
31
26
 */
32
27
 
33
 
class Field_null :public Field_str
34
 
{
35
 
  static unsigned char null[1];
 
28
class Field_null :public Field_str {
 
29
  static uchar null[1];
36
30
public:
37
 
 
38
 
  using Field::store;
39
 
  using Field::val_str;
40
 
  using Field::cmp;
41
 
  using Field::val_int;
42
 
 
43
 
  Field_null(unsigned char *ptr_arg,
44
 
             uint32_t len_arg,
45
 
             const char *field_name_arg,
46
 
             const CHARSET_INFO * const cs)
47
 
    :Field_str(ptr_arg,
48
 
               len_arg,
49
 
               null,
50
 
               1,
51
 
                     field_name_arg,
52
 
               cs)
53
 
  {}
54
 
  enum_field_types type() const
55
 
  {
56
 
    return DRIZZLE_TYPE_NULL;
57
 
  }
58
 
  int  store(const char *, uint32_t, const CHARSET_INFO * const)
59
 
  {
60
 
    null[0]= 1;
61
 
    return 0;
62
 
  }
63
 
  int store(double)
64
 
  {
65
 
    null[0]= 1;
66
 
    return 0;
67
 
  }
68
 
  int store(int64_t, bool)
69
 
  {
70
 
    null[0]= 1;
71
 
    return 0;
72
 
  }
73
 
  int store_decimal(const my_decimal *)
74
 
  {
75
 
    null[0]= 1;
76
 
    return 0;
77
 
  }
 
31
  Field_null(uchar *ptr_arg, uint32_t len_arg,
 
32
             enum utype unireg_check_arg, const char *field_name_arg,
 
33
             const CHARSET_INFO * const cs)
 
34
    :Field_str(ptr_arg, len_arg, null, 1,
 
35
               unireg_check_arg, field_name_arg, cs)
 
36
    {}
 
37
  enum_field_types type() const { return DRIZZLE_TYPE_NULL;}
 
38
  int  store(const char *to __attribute__((unused)),
 
39
             uint length __attribute__((unused)),
 
40
             const CHARSET_INFO * const cs __attribute__((unused)))
 
41
  { null[0]=1; return 0; }
 
42
  int store(double nr __attribute__((unused)))
 
43
  { null[0]=1; return 0; }
 
44
  int store(int64_t nr __attribute__((unused)),
 
45
            bool unsigned_val __attribute__((unused)))
 
46
  { null[0]=1; return 0; }
 
47
  int store_decimal(const my_decimal *d __attribute__((unused)))
 
48
  { null[0]=1; return 0; }
78
49
  int reset(void)
79
 
  {
80
 
    return 0;
81
 
  }
 
50
  { return 0; }
82
51
  double val_real(void)
83
 
  {
84
 
    return 0.0;
85
 
  }
 
52
  { return 0.0;}
86
53
  int64_t val_int(void)
87
 
  {
88
 
    return 0;
89
 
  }
90
 
  my_decimal *val_decimal(my_decimal *)
91
 
  {
92
 
    return 0;
93
 
  }
94
 
  String *val_str(String *, String *value2)
95
 
  {
96
 
    value2->length(0);
97
 
    return value2;
98
 
  }
99
 
  int cmp(const unsigned char *, const unsigned char *)
100
 
  {
101
 
    return 0;
102
 
  }
103
 
  void sort_string(unsigned char *, uint32_t)
104
 
  {}
105
 
  uint32_t pack_length() const
106
 
  {
107
 
    return 0;
108
 
  }
 
54
  { return 0;}
 
55
  my_decimal *val_decimal(my_decimal *) { return 0; }
 
56
  String *val_str(String *value __attribute__((unused)),
 
57
                  String *value2)
 
58
  { value2->length(0); return value2;}
 
59
  int cmp(const uchar *a __attribute__((unused)),
 
60
          const uchar *b __attribute__((unused))) { return 0;}
 
61
  void sort_string(uchar *buff __attribute__((unused)),
 
62
                   uint length __attribute__((unused)))  {}
 
63
  uint32_t pack_length() const { return 0; }
109
64
  void sql_type(String &str) const;
110
 
  uint32_t size_of() const
111
 
  {
112
 
    return sizeof(*this);
113
 
  }
114
 
  uint32_t max_display_length()
115
 
  {
116
 
    return 4;
117
 
  }
 
65
  uint size_of() const { return sizeof(*this); }
 
66
  uint32_t max_display_length() { return 4; }
118
67
};
119
68
 
120
 
} /* namespace drizzled */
 
69
#endif
121
70
 
122
 
#endif /* DRIZZLED_FIELD_NULL_H */