~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/ref.cc

New merge for TableShare

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
22
 
#include "drizzled/session.h"
23
 
#include "drizzled/error.h"
24
 
#include "drizzled/show.h"
25
 
#include "drizzled/item/ref.h"
26
 
#include "drizzled/plugin/client.h"
27
 
#include "drizzled/item/sum.h"
28
 
 
29
 
namespace drizzled
30
 
{
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
 
22
#include <drizzled/session.h>
 
23
#include <drizzled/error.h>
 
24
#include <drizzled/show.h>
 
25
#include <drizzled/item/ref.h>
 
26
#include <drizzled/plugin/client.h>
 
27
 
 
28
using namespace drizzled;
31
29
 
32
30
Item_ref::Item_ref(Name_resolution_context *context_arg,
33
31
                   Item **item, const char *table_name_arg,
184
182
          condition, so that we can give a better error message -
185
183
          ER_WRONG_FIELD_WITH_GROUP, instead of the less informative
186
184
          ER_BAD_FIELD_ERROR which we produce now.
187
 
 
188
 
          @todo determine if this is valid.
189
185
        */
190
186
        if ((place != IN_HAVING ||
191
187
             (!select->with_sum_func &&
246
242
              } while (outer_context && outer_context->select_lex &&
247
243
                       cached_table->select_lex != outer_context->select_lex);
248
244
            }
249
 
            prev_subselect_item->used_tables_cache|= from_field->getTable()->map;
 
245
            prev_subselect_item->used_tables_cache|= from_field->table->map;
250
246
            prev_subselect_item->const_item_cache= 0;
251
247
            break;
252
248
          }
451
447
    switch (result_field->result_type()) {
452
448
    case INT_RESULT:
453
449
      return result_field->val_int() != 0;
454
 
 
455
450
    case DECIMAL_RESULT:
456
 
      {
457
 
        my_decimal decimal_value;
458
 
        my_decimal *val= result_field->val_decimal(&decimal_value);
459
 
        if (val)
460
 
          return !my_decimal_is_zero(val);
461
 
        return 0;
462
 
      }
463
 
 
 
451
    {
 
452
      my_decimal decimal_value;
 
453
      my_decimal *val= result_field->val_decimal(&decimal_value);
 
454
      if (val)
 
455
        return !my_decimal_is_zero(val);
 
456
      return 0;
 
457
    }
464
458
    case REAL_RESULT:
465
459
    case STRING_RESULT:
466
460
      return result_field->val_real() != 0.0;
467
 
 
468
461
    case ROW_RESULT:
 
462
    default:
469
463
      assert(0);
470
464
    }
471
465
  }
472
 
 
473
466
  return val_bool();
474
467
}
475
468
 
581
574
    depended_from= NULL;
582
575
  }
583
576
}
584
 
 
585
 
} /* namespace drizzled */