~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cached_item.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-13 01:03:01 UTC
  • mto: (1126.9.2 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090913010301-tcvvezipx1124acy
Added calls to the dtrace delete begin/end probes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
  Buffers to save and compare item values
25
25
*/
26
26
 
27
 
#include "config.h"
 
27
#include <drizzled/server_includes.h>
28
28
#include <drizzled/cached_item.h>
29
29
#include <drizzled/sql_string.h>
30
30
#include <drizzled/session.h>
32
32
 
33
33
using namespace std;
34
34
 
35
 
namespace drizzled
36
 
{
37
 
 
38
35
/**
39
36
  Create right type of Cached_item for an item.
40
37
*/
41
38
 
42
 
Cached_item *new_Cached_item(Session *session, Item *item)
 
39
Cached_item *new_Cached_item(Session *session, Item *item,
 
40
                             bool use_result_field)
43
41
{
44
42
  if (item->real_item()->type() == Item::FIELD_ITEM &&
45
43
      !(((Item_field *) (item->real_item()))->field->flags & BLOB_FLAG))
46
44
  {
47
45
    Item_field *real_item= (Item_field *) item->real_item();
48
 
    Field *cached_field= real_item->field;
 
46
    Field *cached_field= use_result_field ? real_item->result_field :
 
47
                                            real_item->field;
49
48
    return new Cached_item_field(cached_field);
50
49
  }
51
50
  switch (item->result_type()) {
135
134
}
136
135
 
137
136
 
138
 
Cached_item_field::Cached_item_field(Field *arg_field) 
139
 
  : 
140
 
    field(arg_field)
141
 
{
142
 
  /* TODO: take the memory allocation below out of the constructor. */
143
 
  buff= (unsigned char*) memory::sql_calloc(length= field->pack_length());
144
 
}
145
 
 
146
137
bool Cached_item_field::cmp(void)
147
138
{
148
139
  // This is not a blob!
185
176
  return false;
186
177
}
187
178
 
188
 
} /* namespace drizzled */
 
179