~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/records.cc

  • Committer: Brian Aker
  • Date: 2008-07-10 19:37:55 UTC
  • mfrom: (51.1.67 remove-dbug)
  • Revision ID: brian@tangent.org-20080710193755-f5g761uieqa3wxmt
Merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
                      int use_record_cache, bool print_error)
146
146
{
147
147
  IO_CACHE *tempfile;
148
 
  DBUG_ENTER("init_read_record");
149
148
 
150
149
  bzero((char*) info,sizeof(*info));
151
150
  info->thd=thd;
179
178
    tempfile= table->sort.io_cache;
180
179
  if (tempfile && my_b_inited(tempfile)) // Test if ref-records was used
181
180
  {
182
 
    DBUG_PRINT("info",("using rr_from_tempfile"));
183
181
    info->read_record= (table->sort.addon_field ?
184
182
                        rr_unpack_from_tempfile : rr_from_tempfile);
185
183
    info->io_cache=tempfile;
209
207
    {
210
208
      if (! init_rr_cache(thd, info))
211
209
      {
212
 
        DBUG_PRINT("info",("using rr_from_cache"));
213
210
        info->read_record=rr_from_cache;
214
211
      }
215
212
    }
216
213
  }
217
214
  else if (select && select->quick)
218
215
  {
219
 
    DBUG_PRINT("info",("using rr_quick"));
220
216
    info->read_record=rr_quick;
221
217
  }
222
218
  else if (table->sort.record_pointers)
223
219
  {
224
 
    DBUG_PRINT("info",("using record_pointers"));
225
220
    table->file->ha_rnd_init(0);
226
221
    info->cache_pos=table->sort.record_pointers;
227
222
    info->cache_end=info->cache_pos+ 
231
226
  }
232
227
  else
233
228
  {
234
 
    DBUG_PRINT("info",("using rr_sequential"));
235
229
    info->read_record=rr_sequential;
236
230
    table->file->ha_rnd_init(1);
237
231
    /* We can use record cache if we don't update dynamic length tables */
488
482
static int init_rr_cache(THD *thd, READ_RECORD *info)
489
483
{
490
484
  uint rec_cache_size;
491
 
  DBUG_ENTER("init_rr_cache");
492
485
 
493
486
  info->struct_length= 3+MAX_REFLENGTH;
494
487
  info->reclength= ALIGN_SIZE(info->table->s->reclength+1);
511
504
  // Avoid warnings in qsort
512
505
  bzero(info->cache,rec_cache_size+info->cache_records* info->struct_length+1);
513
506
#endif
514
 
  DBUG_PRINT("info",("Allocated buffert for %d records",info->cache_records));
515
507
  info->read_positions=info->cache+rec_cache_size;
516
508
  info->cache_pos=info->cache_end=info->cache;
517
509
  return(0);
552
544
      length= (ulong) rest_of_file;
553
545
    if (!length || my_b_read(info->io_cache,info->cache,length))
554
546
    {
555
 
      DBUG_PRINT("info",("Found end of file"));
556
547
      return -1;                        /* End of file */
557
548
    }
558
549
 
581
572
      {
582
573
        record_pos[info->error_offset]=1;
583
574
        shortstore(record_pos,error);
584
 
        DBUG_PRINT("error",("Got error: %d:%d when reading row",
585
 
                            my_errno, error));
586
575
      }
587
576
      else
588
577
        record_pos[info->error_offset]=0;