~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/sum.cc

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
  (assuming a index for column d of table t2 is defined)
52
52
*/
53
53
 
54
 
#include "config.h"
55
 
#include "drizzled/sql_select.h"
56
 
#include "drizzled/item/sum.h"
57
 
#include "drizzled/item/cmpfunc.h"
58
 
#include "drizzled/optimizer/sum.h"
 
54
#include <config.h>
 
55
 
 
56
#include <drizzled/sql_select.h>
 
57
#include <drizzled/item/sum.h>
 
58
#include <drizzled/item/cmpfunc.h>
 
59
#include <drizzled/optimizer/sum.h>
 
60
#include <drizzled/plugin/storage_engine.h>
 
61
#include <drizzled/table_list.h>
 
62
#include <drizzled/key.h>
59
63
 
60
64
namespace drizzled
61
65
{
110
114
 
111
115
int optimizer::sum_query(TableList *tables, List<Item> &all_fields, COND *conds)
112
116
{
113
 
  List_iterator_fast<Item> it(all_fields);
 
117
  List<Item>::iterator it(all_fields.begin());
114
118
  int const_result= 1;
115
119
  bool recalc_const_item= false;
116
120
  uint64_t count= 1;
262
266
                break;
263
267
              }
264
268
              error= table->cursor->startIndexScan(static_cast<uint32_t>(ref.key), 1);
 
269
              if (error)
 
270
              {
 
271
                if (table->key_read)
 
272
                {
 
273
                  table->key_read= 0;
 
274
                  table->cursor->extra(HA_EXTRA_NO_KEYREAD);
 
275
                }
 
276
                table->print_error(error, MYF(0));
 
277
                return error;
 
278
              }
265
279
 
266
280
              if (! ref.key_length)
267
281
              {
675
689
    }
676
690
 
677
691
    /* AND */
678
 
    List_iterator_fast<Item> li(*((Item_cond*) cond)->argument_list());
 
692
    List<Item>::iterator li(((Item_cond*) cond)->argument_list()->begin());
679
693
    Item *item;
680
694
    while ((item= li++))
681
695
    {
1057
1071
  /* If AND/OR condition */
1058
1072
  if (cond->type() == Item::COND_ITEM)
1059
1073
  {
1060
 
    List_iterator_fast<Item> li(*((Item_cond*) cond)->argument_list());
 
1074
    List<Item>::iterator li(((Item_cond*) cond)->argument_list()->begin());
1061
1075
    Item *item;
1062
1076
    while ((item= li++))
1063
1077
    {