~drizzle-trunk/drizzle/development

584.4.10 by Monty Taylor
Broke out cached_item.
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_CACHED_ITEM_H
21
#define DRIZZLED_CACHED_ITEM_H
22
1253.1.4 by Monty Taylor
Moved sql_alloc into memory.
23
#include "drizzled/memory/sql_alloc.h"
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
24
#include "drizzled/sql_string.h"
25
#include "drizzled/my_decimal.h"
584.4.10 by Monty Taylor
Broke out cached_item.
26
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
27
namespace drizzled
28
{
29
584.4.10 by Monty Taylor
Broke out cached_item.
30
class Item;
31
class Session;
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
32
class Field;
584.4.10 by Monty Taylor
Broke out cached_item.
33
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
34
class Cached_item :public memory::SqlAlloc
584.4.10 by Monty Taylor
Broke out cached_item.
35
{
36
public:
37
  bool null_value;
38
  Cached_item() :null_value(0) {}
39
  virtual bool cmp(void)=0;
40
  virtual ~Cached_item(); /*line -e1509 */
41
};
42
43
class Cached_item_str :public Cached_item
44
{
45
  Item *item;
46
  String value,tmp_value;
47
public:
48
  Cached_item_str(Session *session, Item *arg);
49
  bool cmp(void);
50
  ~Cached_item_str();                           // Deallocate String:s
51
};
52
53
54
class Cached_item_real :public Cached_item
55
{
56
  Item *item;
57
  double value;
58
public:
59
  Cached_item_real(Item *item_par) :item(item_par),value(0.0) {}
60
  bool cmp(void);
61
};
62
63
class Cached_item_int :public Cached_item
64
{
65
  Item *item;
66
  int64_t value;
67
public:
68
  Cached_item_int(Item *item_par) :item(item_par),value(0) {}
69
  bool cmp(void);
70
};
71
72
73
class Cached_item_decimal :public Cached_item
74
{
75
  Item *item;
76
  my_decimal value;
77
public:
78
  Cached_item_decimal(Item *item_par);
79
  bool cmp(void);
80
};
81
82
class Cached_item_field :public Cached_item
83
{
84
  unsigned char *buff;
85
  Field *field;
86
  uint32_t length;
87
88
public:
1237.9.4 by Padraig O'Sullivan
Removed the inclusion of drizzled/field.h in the server_includes header file.
89
  Cached_item_field(Field *arg_field);
584.4.10 by Monty Taylor
Broke out cached_item.
90
  bool cmp(void);
91
};
92
1221.1.1 by Jay Pipes
Fixes some valgrind warnings regarding conditionals depending on unintialized variables. Use initializer lists properly, dang it. :) Also, removed the new_Cached_item() function's use_result_field, as this was only used for views and was producing a valgrind warning unnecessarily.
93
Cached_item *new_Cached_item(Session *session, Item *item);
584.4.10 by Monty Taylor
Broke out cached_item.
94
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
95
} /* namespace drizzled */
96
584.4.10 by Monty Taylor
Broke out cached_item.
97
#endif /* DRIZZLED_CACHED_ITEM_H */