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

« back to all changes in this revision

Viewing changes to drizzled/records.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <drizzled/records.h>
31
31
#include <drizzled/session.h>
32
32
#include <drizzled/table.h>
 
33
#include <drizzled/system_variables.h>
33
34
 
34
 
namespace drizzled
35
 
{
 
35
namespace drizzled {
36
36
 
37
37
static int rr_sequential(ReadRecord *info);
38
38
static int rr_quick(ReadRecord *info);
81
81
                                 int use_record_cache,
82
82
                                 bool print_error_arg)
83
83
{
84
 
  internal::IO_CACHE *tempfile;
 
84
  internal::io_cache_st *tempfile;
85
85
  int error= 0;
86
86
 
87
87
  session= session_arg;
105
105
  ignore_not_found_rows= 0;
106
106
  table->status=0;                      /* And it's always found */
107
107
 
108
 
  if (select && my_b_inited(select->file))
 
108
  if (select && select->file->inited())
109
109
  {
110
110
    tempfile= select->file;
111
111
  }
114
114
    tempfile= table->sort.io_cache;
115
115
  }
116
116
 
117
 
  if (tempfile && my_b_inited(tempfile)) // Test if ref-records was used
 
117
  if (tempfile && tempfile->inited()) // Test if ref-records was used
118
118
  {
119
 
    read_record= (table->sort.addon_field ?
120
 
                  rr_unpack_from_tempfile : rr_from_tempfile);
 
119
    read_record= table->sort.addon_field ? rr_unpack_from_tempfile : rr_from_tempfile;
121
120
 
122
121
    io_cache=tempfile;
123
122
    io_cache->reinit_io_cache(internal::READ_CACHE,0L,0,0);
316
315
  int tmp;
317
316
  for (;;)
318
317
  {
319
 
    if (my_b_read(info->io_cache,info->ref_pos,info->ref_length))
 
318
    if (info->io_cache->read(info->ref_pos, info->ref_length))
320
319
      return -1;                                        /* End of cursor */
321
320
    if (!(tmp=info->cursor->rnd_pos(info->record,info->ref_pos)))
322
321
      break;
347
346
*/
348
347
static int rr_unpack_from_tempfile(ReadRecord *info)
349
348
{
350
 
  if (my_b_read(info->io_cache, info->rec_buf, info->ref_length))
 
349
  if (info->io_cache->read(info->rec_buf, info->ref_length))
351
350
    return -1;
352
351
  Table *table= info->table;
353
352
  (*table->sort.unpack)(table->sort.addon_field, info->rec_buf);
430
429
  }
431
430
 
432
431
  // We have to allocate one more byte to use uint3korr (see comments for it)
433
 
  if (cache_records <= 2 ||
434
 
      !(cache=(unsigned char*) malloc(local_rec_cache_size + cache_records * struct_length + 1)))
435
 
  {
 
432
  if (cache_records <= 2)
436
433
    return false;
437
 
  }
 
434
  cache= (unsigned char*) malloc(local_rec_cache_size + cache_records * struct_length + 1);
438
435
#ifdef HAVE_VALGRIND
439
436
  // Avoid warnings in qsort
440
437
  memset(cache, 0, local_rec_cache_size + cache_records * struct_length + 1);
472
469
      return ((int) error);
473
470
    }
474
471
    length=info->rec_cache_size;
475
 
    rest_of_file= info->io_cache->end_of_file - my_b_tell(info->io_cache);
 
472
    rest_of_file= info->io_cache->end_of_file - info->io_cache->tell();
476
473
    if ((internal::my_off_t) length > rest_of_file)
477
474
    {
478
475
      length= (uint32_t) rest_of_file;
479
476
    }
480
477
 
481
 
    if (!length || my_b_read(info->io_cache, info->getCache(), length))
 
478
    if (!length || info->io_cache->read(info->getCache(), length))
482
479
    {
483
480
      return -1;                        /* End of cursor */
484
481
    }