~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/sort.cc

  • Committer: Brian Aker
  • Date: 2010-11-06 19:38:41 UTC
  • mto: This revision was merged to the branch mainline in revision 1910.
  • Revision ID: brian@tangent.org-20101106193841-exc9cc3qc515zhev
Encapsulation of IO_CACHE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
        goto err;
205
205
    }
206
206
    if (internal::flush_io_cache(&tempfile) ||
207
 
        internal::reinit_io_cache(&tempfile,internal::READ_CACHE,0L,0,0))
 
207
        tempfile.reinit_io_cache(internal::READ_CACHE,0L,0,0))
208
208
      goto err;
209
209
    if (!no_messages)
210
210
      printf("  - Last merge and dumping keys\n");
222
222
    uint32_t     keyno=info->key;
223
223
    uint32_t     key_length, ref_length=idx->s->rec_reflength;
224
224
 
225
 
    if (!no_messages)
 
225
    if (not no_messages)
226
226
      printf("  - Adding exceptions\n");
227
 
    if (flush_io_cache(&tempfile_for_exceptions) ||
228
 
        reinit_io_cache(&tempfile_for_exceptions,internal::READ_CACHE,0L,0,0))
 
227
 
 
228
    if (flush_io_cache(&tempfile_for_exceptions) || tempfile_for_exceptions.reinit_io_cache(internal::READ_CACHE,0L,0,0))
 
229
    {
229
230
      goto err;
 
231
    }
230
232
 
231
233
    while (!my_b_read(&tempfile_for_exceptions,(unsigned char*)&key_length,
232
234
                      sizeof(key_length))
244
246
  if (sort_keys)
245
247
    free((unsigned char*) sort_keys);
246
248
  delete_dynamic(&buffpek);
247
 
  close_cached_file(&tempfile);
248
 
  close_cached_file(&tempfile_for_exceptions);
 
249
  tempfile.close_cached_file();
 
250
  tempfile_for_exceptions.close_cached_file();
249
251
 
250
252
  return(error ? -1 : 0);
251
253
} /* _create_index_by_sort */
357
359
       i < sort_info->total_keys ;
358
360
       i++,
359
361
         delete_dynamic(&sinfo->buffpek),
360
 
         close_cached_file(&sinfo->tempfile),
361
 
         close_cached_file(&sinfo->tempfile_for_exceptions),
 
362
         sinfo->tempfile.close_cached_file(),
 
363
         sinfo->tempfile_for_exceptions.close_cached_file(),
362
364
         sinfo++)
363
365
  {
364
366
    if (got_error)
406
408
          continue;
407
409
        }
408
410
      }
409
 
      if (flush_io_cache(&sinfo->tempfile) ||
410
 
          reinit_io_cache(&sinfo->tempfile,internal::READ_CACHE,0L,0,0))
 
411
      if (flush_io_cache(&sinfo->tempfile) || sinfo->tempfile.reinit_io_cache(internal::READ_CACHE,0L,0,0))
411
412
      {
412
413
        got_error=1;
413
414
        continue;
430
431
      if (param->testflag & T_VERBOSE)
431
432
        printf("Key %d  - Dumping 'long' keys\n", sinfo->key+1);
432
433
 
433
 
      if (flush_io_cache(&sinfo->tempfile_for_exceptions) ||
434
 
          reinit_io_cache(&sinfo->tempfile_for_exceptions,internal::READ_CACHE,0L,0,0))
 
434
      if (flush_io_cache(&sinfo->tempfile_for_exceptions) || sinfo->tempfile_for_exceptions.reinit_io_cache(internal::READ_CACHE,0L,0,0))
435
435
      {
436
436
        got_error=1;
437
437
        continue;
576
576
  from_file= t_file ; to_file= &t_file2;
577
577
  while (*maxbuffer >= MERGEBUFF2)
578
578
  {
579
 
    reinit_io_cache(from_file,internal::READ_CACHE,0L,0,0);
580
 
    reinit_io_cache(to_file,internal::WRITE_CACHE,0L,0,0);
 
579
    from_file->reinit_io_cache(internal::READ_CACHE,0L,0,0);
 
580
    to_file->reinit_io_cache(internal::WRITE_CACHE,0L,0,0);
581
581
    lastbuff=buffpek;
582
582
    for (i=0 ; i <= *maxbuffer-MERGEBUFF*3/2 ; i+=MERGEBUFF)
583
583
    {
594
594
    *maxbuffer= (int) (lastbuff-buffpek)-1;
595
595
  }
596
596
cleanup:
597
 
  close_cached_file(to_file);                   /* This holds old result */
 
597
  to_file->close_cached_file();                   /* This holds old result */
598
598
  if (to_file == t_file)
599
599
    *t_file=t_file2;                            /* Copy result file */
600
600