~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/optimizer/quick_group_min_max_select.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
optimizer::QuickGroupMinMaxSelect::
40
40
QuickGroupMinMaxSelect(Table *table,
41
 
                       JOIN *join_arg,
 
41
                       Join *join_arg,
42
42
                       bool have_min_arg,
43
43
                       bool have_max_arg,
44
 
                       KEY_PART_INFO *min_max_arg_part_arg,
 
44
                       KeyPartInfo *min_max_arg_part_arg,
45
45
                       uint32_t group_prefix_len_arg,
46
46
                       uint32_t group_key_parts_arg,
47
47
                       uint32_t used_key_parts_arg,
48
 
                       KEY *index_info_arg,
 
48
                       KeyInfo *index_info_arg,
49
49
                       uint32_t use_index,
50
50
                       double read_cost_arg,
51
51
                       ha_rows records_arg,
70
70
  cursor= head->cursor;
71
71
  index= use_index;
72
72
  record= head->record[0];
73
 
  tmp_record= head->record[1];
 
73
  tmp_record= head->getUpdateRecord();
74
74
  read_time= read_cost_arg;
75
75
  records= records_arg;
76
76
  used_key_parts= used_key_parts_arg;
99
99
  if (group_prefix) /* Already initialized. */
100
100
    return 0;
101
101
 
102
 
  if (! (last_prefix= (unsigned char*) alloc_root(&alloc, group_prefix_len)))
 
102
  if (! (last_prefix= (unsigned char*) alloc.alloc_root(group_prefix_len)))
103
103
      return 1;
104
104
  /*
105
105
    We may use group_prefix to store keys with all select fields, so allocate
106
106
    enough space for it.
107
107
  */
108
 
  if (! (group_prefix= (unsigned char*) alloc_root(&alloc,
109
 
                                                   real_prefix_len + min_max_arg_len)))
 
108
  if (! (group_prefix= (unsigned char*) alloc.alloc_root(real_prefix_len + min_max_arg_len)))
110
109
    return 1;
111
110
 
112
111
  if (key_infix_len > 0)
115
114
      The memory location pointed to by key_infix will be deleted soon, so
116
115
      allocate a new buffer and copy the key_infix into it.
117
116
    */
118
 
    unsigned char *tmp_key_infix= (unsigned char*) alloc_root(&alloc, key_infix_len);
 
117
    unsigned char *tmp_key_infix= (unsigned char*) alloc.alloc_root(key_infix_len);
119
118
    if (! tmp_key_infix)
120
119
      return 1;
121
120
    memcpy(tmp_key_infix, this->key_infix, key_infix_len);
170
169
{
171
170
  if (cursor->inited != Cursor::NONE)
172
171
  {
173
 
    cursor->ha_index_end();
 
172
    cursor->endIndexScan();
174
173
  }
175
174
  if (min_max_arg_part)
176
175
  {
179
178
             DeletePtr());
180
179
  }
181
180
  min_max_ranges.clear();
182
 
  free_root(&alloc,MYF(0));
 
181
  alloc.free_root(MYF(0));
183
182
  delete min_functions_it;
184
183
  delete max_functions_it;
185
184
  delete quick_prefix_select;
287
286
  int result;
288
287
 
289
288
  cursor->extra(HA_EXTRA_KEYREAD); /* We need only the key attributes */
290
 
  if ((result= cursor->ha_index_init(index,1)))
 
289
  if ((result= cursor->startIndexScan(index,1)))
291
290
    return result;
292
291
  if (quick_prefix_select && quick_prefix_select->reset())
293
292
    return 0;
580
579
        Remember this key, and continue looking for a non-NULL key that
581
580
        satisfies some other condition.
582
581
      */
583
 
      memcpy(tmp_record, record, head->s->rec_buff_length);
 
582
      memcpy(tmp_record, record, head->getShare()->rec_buff_length);
584
583
      found_null= true;
585
584
      continue;
586
585
    }
621
620
  */
622
621
  if (found_null && result)
623
622
  {
624
 
    memcpy(record, tmp_record, head->s->rec_buff_length);
 
623
    memcpy(record, tmp_record, head->getShare()->rec_buff_length);
625
624
    result= 0;
626
625
  }
627
626
  return result;