~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cached_item.cc

  • Committer: Lee Bieber
  • Date: 2010-11-07 19:34:48 UTC
  • mfrom: (1910.1.2 build)
  • Revision ID: kalebral@gmail.com-20101107193448-64kdu912qej354sh
Merge Stewart - including adapting and expanding the "differences from mysql" page from the wiki.
Merge Stewart - fix bug 668143: drizzleslap with --commit runs second iteration data load in a transaction

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
48
48
    Field *cached_field= real_item->field;
49
49
    return new Cached_item_field(cached_field);
50
50
  }
51
 
 
52
51
  switch (item->result_type()) {
53
52
  case STRING_RESULT:
54
53
    return new Cached_item_str(session, (Item_field *) item);
59
58
  case DECIMAL_RESULT:
60
59
    return new Cached_item_decimal(item);
61
60
  case ROW_RESULT:
 
61
  default:
62
62
    assert(0);
63
63
    return 0;
64
64
  }
65
 
 
66
 
  abort();
67
65
}
68
66
 
69
67
Cached_item::~Cached_item() {}
148
146
bool Cached_item_field::cmp(void)
149
147
{
150
148
  // This is not a blob!
151
 
  bool tmp= field->cmp_internal(buff) != 0;
 
149
  bool tmp= field->cmp(buff) != 0;
152
150
 
153
151
  if (tmp)
154
152
    field->get_image(buff,length,field->charset());
164
162
Cached_item_decimal::Cached_item_decimal(Item *it)
165
163
  :item(it)
166
164
{
167
 
  value.set_zero();
 
165
  my_decimal_set_zero(&value);
168
166
}
169
167
 
170
168
 
171
169
bool Cached_item_decimal::cmp()
172
170
{
173
 
  type::Decimal tmp;
174
 
  type::Decimal *ptmp= item->val_decimal(&tmp);
 
171
  my_decimal tmp;
 
172
  my_decimal *ptmp= item->val_decimal(&tmp);
175
173
  if (null_value != item->null_value ||
176
 
      (!item->null_value && class_decimal_cmp(&value, ptmp)))
 
174
      (!item->null_value && my_decimal_cmp(&value, ptmp)))
177
175
  {
178
176
    null_value= item->null_value;
179
177
    /* Save only not null values */
180
178
    if (!null_value)
181
179
    {
182
 
      class_decimal2decimal(ptmp, &value);
 
180
      my_decimal2decimal(ptmp, &value);
183
181
      return true;
184
182
    }
185
183
    return false;