~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/optimizer/quick_ror_intersect_select.cc

  • Committer: Stewart Smith
  • Date: 2010-11-07 06:43:17 UTC
  • mfrom: (1909 merge)
  • mto: This revision was merged to the branch mainline in revision 1915.
  • Revision ID: stewart@flamingspork.com-20101107064317-i0usp0cqk97ftxev
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <vector>
29
29
 
30
30
using namespace std;
31
 
using namespace drizzled;
 
31
 
 
32
namespace drizzled
 
33
{
32
34
 
33
35
 
34
36
optimizer::QuickRorIntersectSelect::QuickRorIntersectSelect(Session *session_param,
52
54
  {
53
55
    memset(&alloc, 0, sizeof(memory::Root));
54
56
  }
55
 
  last_rowid= (unsigned char*) alloc_root(parent_alloc ? parent_alloc : &alloc,
56
 
                                          head->cursor->ref_length);
 
57
 
 
58
  if (parent_alloc)
 
59
  {
 
60
    last_rowid= (unsigned char*) parent_alloc->alloc_root(head->cursor->ref_length);
 
61
  }
 
62
  else
 
63
  {
 
64
    last_rowid= (unsigned char*) alloc.alloc_root(head->cursor->ref_length);
 
65
  }
57
66
}
58
67
 
59
68
 
64
73
           DeletePtr());
65
74
  quick_selects.clear();
66
75
  delete cpk_quick;
67
 
  free_root(&alloc,MYF(0));
 
76
  alloc.free_root(MYF(0));
68
77
  if (need_to_fetch_row && head->cursor->inited != Cursor::NONE)
69
78
  {
70
 
    head->cursor->ha_rnd_end();
 
79
    head->cursor->endTableScan();
71
80
  }
72
81
  return;
73
82
}
110
119
    ++it;
111
120
  }
112
121
 
113
 
  if (need_to_fetch_row && head->cursor->ha_rnd_init(1))
 
122
  if (need_to_fetch_row && head->cursor->startTableScan(1))
114
123
  {
115
124
    return 0;
116
125
  }
143
152
}
144
153
 
145
154
 
146
 
bool optimizer::QuickRorIntersectSelect::is_keys_used(const MyBitmap *fields)
 
155
bool optimizer::QuickRorIntersectSelect::is_keys_used(const boost::dynamic_bitset<>& fields)
147
156
{
148
157
  for (vector<optimizer::QuickRangeSelect *>::iterator it= quick_selects.begin();
149
158
       it != quick_selects.end();
245
254
       it != quick_selects.end();
246
255
       ++it)
247
256
  {
248
 
    KEY *key_info= head->key_info + (*it)->index;
 
257
    KeyInfo *key_info= head->key_info + (*it)->index;
249
258
    if (! first)
250
259
      str->append(',');
251
260
    else
254
263
  }
255
264
  if (cpk_quick)
256
265
  {
257
 
    KEY *key_info= head->key_info + cpk_quick->index;
 
266
    KeyInfo *key_info= head->key_info + cpk_quick->index;
258
267
    str->append(',');
259
268
    str->append(key_info->name);
260
269
  }
272
281
       it != quick_selects.end();
273
282
       ++it)
274
283
  {
275
 
    KEY *key_info= head->key_info + (*it)->index;
 
284
    KeyInfo *key_info= head->key_info + (*it)->index;
276
285
    if (first)
277
286
    {
278
287
      first= false;
283
292
      used_lengths->append(',');
284
293
    }
285
294
    key_names->append(key_info->name);
286
 
    length= int64_t2str((*it)->max_used_key_length, buf, 10) - buf;
 
295
    length= internal::int64_t2str((*it)->max_used_key_length, buf, 10) - buf;
287
296
    used_lengths->append(buf, length);
288
297
  }
289
298
 
290
299
  if (cpk_quick)
291
300
  {
292
 
    KEY *key_info= head->key_info + cpk_quick->index;
 
301
    KeyInfo *key_info= head->key_info + cpk_quick->index;
293
302
    key_names->append(',');
294
303
    key_names->append(key_info->name);
295
 
    length= int64_t2str(cpk_quick->max_used_key_length, buf, 10) - buf;
 
304
    length= internal::int64_t2str(cpk_quick->max_used_key_length, buf, 10) - buf;
296
305
    used_lengths->append(',');
297
306
    used_lengths->append(buf, length);
298
307
  }
299
308
}
300
309
 
 
310
} /* namespace drizzled */