~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cached_item.cc

  • Committer: Stewart Smith
  • Date: 2011-03-29 01:30:47 UTC
  • mto: (2257.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: stewart@flamingspork.com-20110329013047-5ujzfx6pahmwuko2
have CachedDirectory print out a warning if we can't stat() something in a directory. We should always have access to at least stat() things in directories Drizzle is running in (otherwise there is likely a problem)

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 <config.h>
28
28
#include <drizzled/cached_item.h>
 
29
#include <drizzled/field.h>
29
30
#include <drizzled/sql_string.h>
30
31
#include <drizzled/session.h>
 
32
#include <drizzled/item/field.h>
 
33
#include <drizzled/system_variables.h>
31
34
#include <algorithm>
32
35
 
33
36
using namespace std;
34
37
 
35
 
namespace drizzled
36
 
{
 
38
namespace drizzled {
37
39
 
38
40
/**
39
41
  Create right type of Cached_item for an item.
164
166
Cached_item_decimal::Cached_item_decimal(Item *it)
165
167
  :item(it)
166
168
{
167
 
  my_decimal_set_zero(&value);
 
169
  value.set_zero();
168
170
}
169
171
 
170
172
 
171
173
bool Cached_item_decimal::cmp()
172
174
{
173
 
  my_decimal tmp;
174
 
  my_decimal *ptmp= item->val_decimal(&tmp);
 
175
  type::Decimal tmp;
 
176
  type::Decimal *ptmp= item->val_decimal(&tmp);
175
177
  if (null_value != item->null_value ||
176
 
      (!item->null_value && my_decimal_cmp(&value, ptmp)))
 
178
      (!item->null_value && class_decimal_cmp(&value, ptmp)))
177
179
  {
178
180
    null_value= item->null_value;
179
181
    /* Save only not null values */
180
182
    if (!null_value)
181
183
    {
182
 
      my_decimal2decimal(ptmp, &value);
 
184
      class_decimal2decimal(ptmp, &value);
183
185
      return true;
184
186
    }
185
187
    return false;