~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.cc

  • Committer: Brian Aker
  • Date: 2009-01-28 19:37:25 UTC
  • mfrom: (779.3.11 devel)
  • Revision ID: brian@tangent.org-20090128193725-pz7g7dnp2dx0863e
Merge from Monty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2718
2718
*/
2719
2719
 
2720
2720
int
2721
 
handler::ha_create(const char *name, Table *form, HA_CREATE_INFO *info)
 
2721
handler::ha_create(const char *name, Table *form, HA_CREATE_INFO *create_info)
2722
2722
{
2723
2723
  mark_trx_read_write();
2724
2724
 
2725
 
  return create(name, form, info);
 
2725
  return create(name, form, create_info);
2726
2726
}
2727
2727
 
2728
2728
 
2734
2734
 
2735
2735
int
2736
2736
handler::ha_create_handler_files(const char *name, const char *old_name,
2737
 
                        int action_flag, HA_CREATE_INFO *info)
 
2737
                                 int action_flag, HA_CREATE_INFO *create_info)
2738
2738
{
2739
2739
  mark_trx_read_write();
2740
2740
 
2741
 
  return create_handler_files(name, old_name, action_flag, info);
 
2741
  return create_handler_files(name, old_name, action_flag, create_info);
2742
2742
}
2743
2743
 
2744
2744
 
3067
3067
    Estimated cost of 'index only' scan
3068
3068
*/
3069
3069
 
3070
 
double handler::index_only_read_time(uint32_t keynr, double records)
 
3070
double handler::index_only_read_time(uint32_t keynr, double key_records)
3071
3071
{
3072
 
  double read_time;
3073
3072
  uint32_t keys_per_block= (stats.block_size/2/
3074
3073
                        (table->key_info[keynr].key_length + ref_length) + 1);
3075
 
  read_time=((double) (records + keys_per_block-1) /
3076
 
             (double) keys_per_block);
3077
 
  return read_time;
 
3074
  return ((double) (key_records + keys_per_block-1) /
 
3075
          (double) keys_per_block);
3078
3076
}
3079
3077
 
3080
3078
 
3367
3365
  @retval other Error
3368
3366
*/
3369
3367
 
3370
 
int DsMrr_impl::dsmrr_init(handler *h, KEY *key,
 
3368
int DsMrr_impl::dsmrr_init(handler *h_in, KEY *key,
3371
3369
                           RANGE_SEQ_IF *seq_funcs, void *seq_init_param,
3372
3370
                           uint32_t n_ranges, uint32_t mode, HANDLER_BUFFER *buf)
3373
3371
{
3375
3373
  uint32_t keyno;
3376
3374
  Item *pushed_cond= NULL;
3377
3375
  handler *new_h2;
3378
 
  keyno= h->active_index;
 
3376
  keyno= h_in->active_index;
3379
3377
  assert(h2 == NULL);
3380
3378
  if (mode & HA_MRR_USE_DEFAULT_IMPL || mode & HA_MRR_SORTED)
3381
3379
  {
3382
3380
    use_default_impl= true;
3383
 
    return(h->handler::multi_range_read_init(seq_funcs, seq_init_param,
 
3381
    return(h_in->handler::multi_range_read_init(seq_funcs, seq_init_param,
3384
3382
                                                  n_ranges, mode, buf));
3385
3383
  }
3386
3384
  rowids_buf= buf->buffer;
3387
3385
  //psergey-todo: don't add key_length as it is not needed anymore
3388
 
  rowids_buf += key->key_length + h->ref_length;
 
3386
  rowids_buf += key->key_length + h_in->ref_length;
3389
3387
 
3390
3388
  is_mrr_assoc= !test(mode & HA_MRR_NO_ASSOCIATION);
3391
3389
  rowids_buf_end= buf->buffer_end;
3392
3390
 
3393
 
  elem_size= h->ref_length + (int)is_mrr_assoc * sizeof(void*);
 
3391
  elem_size= h_in->ref_length + (int)is_mrr_assoc * sizeof(void*);
3394
3392
  rowids_buf_last= rowids_buf +
3395
3393
                      ((rowids_buf_end - rowids_buf)/ elem_size)*
3396
3394
                      elem_size;
3398
3396
 
3399
3397
  /* Create a separate handler object to do rndpos() calls. */
3400
3398
  Session *session= current_session;
3401
 
  if (!(new_h2= h->clone(session->mem_root)) ||
 
3399
  if (!(new_h2= h_in->clone(session->mem_root)) ||
3402
3400
      new_h2->ha_external_lock(session, F_RDLCK))
3403
3401
  {
3404
3402
    delete new_h2;
3405
3403
    return(1);
3406
3404
  }
3407
3405
 
3408
 
  if (keyno == h->pushed_idx_cond_keyno)
3409
 
    pushed_cond= h->pushed_idx_cond;
3410
 
  if (h->ha_index_end())
 
3406
  if (keyno == h_in->pushed_idx_cond_keyno)
 
3407
    pushed_cond= h_in->pushed_idx_cond;
 
3408
  if (h_in->ha_index_end())
3411
3409
  {
3412
3410
    new_h2= h2;
3413
3411
    goto error;
3435
3433
  if (dsmrr_eof)
3436
3434
    buf->end_of_used_area= rowids_buf_last;
3437
3435
 
3438
 
  if (h->ha_rnd_init(false))
 
3436
  if (h_in->ha_rnd_init(false))
3439
3437
    goto error;
3440
3438
 
3441
3439
  return(0);
3526
3524
  DS-MRR implementation: multi_range_read_next() function
3527
3525
*/
3528
3526
 
3529
 
int DsMrr_impl::dsmrr_next(handler *h, char **range_info)
 
3527
int DsMrr_impl::dsmrr_next(handler *h_in, char **range_info)
3530
3528
{
3531
3529
  int res;
3532
3530
 
3533
3531
  if (use_default_impl)
3534
 
    return h->handler::multi_range_read_next(range_info);
 
3532
    return h_in->handler::multi_range_read_next(range_info);
3535
3533
 
3536
3534
  if (rowids_buf_cur == rowids_buf_last)
3537
3535
  {
3552
3550
    goto end;
3553
3551
  }
3554
3552
 
3555
 
  res= h->rnd_pos(table->record[0], rowids_buf_cur);
3556
 
  rowids_buf_cur += h->ref_length;
 
3553
  res= h_in->rnd_pos(table->record[0], rowids_buf_cur);
 
3554
  rowids_buf_cur += h_in->ref_length;
3557
3555
  if (is_mrr_assoc)
3558
3556
  {
3559
3557
    memcpy(range_info, rowids_buf_cur, sizeof(void*));