~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/records.cc

  • Committer: Brian Aker
  • Date: 2010-12-25 00:28:49 UTC
  • mto: This revision was merged to the branch mainline in revision 2031.
  • Revision ID: brian@tangent.org-20101225002849-g73mg6ihulajis0o
First pass in refactoring of the name of my_decimal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
  Functions for easy reading of records, possible through a cache
21
21
*/
22
22
#include "config.h"
23
 
 
24
 
#include "drizzled/drizzled.h"
25
23
#include "drizzled/error.h"
 
24
#include "drizzled/table.h"
 
25
#include "drizzled/session.h"
 
26
#include "drizzled/records.h"
 
27
#include "drizzled/optimizer/range.h"
 
28
#include "drizzled/internal/my_sys.h"
26
29
#include "drizzled/internal/iocache.h"
27
 
#include "drizzled/internal/my_sys.h"
28
 
#include "drizzled/optimizer/range.h"
29
 
#include "drizzled/plugin/storage_engine.h"
30
 
#include "drizzled/records.h"
31
 
#include "drizzled/session.h"
32
 
#include "drizzled/table.h"
 
30
#include "drizzled/drizzled.h"
33
31
 
34
32
namespace drizzled
35
33
{
50
48
  read_record= rr_sequential;
51
49
}
52
50
 
53
 
int ReadRecord::init_read_record_idx(Session *,
54
 
                                     Table *table_arg,
55
 
                                     bool print_error_arg,
56
 
                                     uint32_t idx)
 
51
void ReadRecord::init_read_record_idx(Session *, 
 
52
                                      Table *table_arg,
 
53
                                      bool print_error_arg, 
 
54
                                      uint32_t idx)
57
55
{
58
56
  table_arg->emptyRecord();
59
57
  table= table_arg;
63
61
 
64
62
  table->status=0;                      /* And it's always found */
65
63
  if (not table->cursor->inited)
66
 
  {
67
 
    int error= table->cursor->startIndexScan(idx, 1);
68
 
    if (error != 0)
69
 
      return error;
70
 
  }
 
64
    table->cursor->startIndexScan(idx, 1);
71
65
  /* read_record will be changed to rr_index in rr_index_first */
72
66
  read_record= rr_index_first;
73
 
 
74
 
  return 0;
75
67
}
76
68
 
77
69
 
78
 
int ReadRecord::init_read_record(Session *session_arg,
79
 
                                 Table *table_arg,
80
 
                                 optimizer::SqlSelect *select_arg,
81
 
                                 int use_record_cache,
82
 
                                 bool print_error_arg)
 
70
void ReadRecord::init_read_record(Session *session_arg, 
 
71
                                  Table *table_arg,
 
72
                                  optimizer::SqlSelect *select_arg,
 
73
                                  int use_record_cache, 
 
74
                                  bool print_error_arg)
83
75
{
84
76
  internal::IO_CACHE *tempfile;
85
 
  int error= 0;
86
77
 
87
78
  session= session_arg;
88
79
  table= table_arg;
123
114
    io_cache->reinit_io_cache(internal::READ_CACHE,0L,0,0);
124
115
    ref_pos=table->cursor->ref;
125
116
    if (!table->cursor->inited)
126
 
    {
127
 
      error= table->cursor->startTableScan(0);
128
 
      if (error != 0)
129
 
        return error;
130
 
    }
 
117
      table->cursor->startTableScan(0);
131
118
 
132
119
    /*
133
120
      table->sort.addon_field is checked because if we use addon fields,
159
146
  }
160
147
  else if (table->sort.record_pointers)
161
148
  {
162
 
    error= table->cursor->startTableScan(0);
163
 
    if (error != 0)
164
 
      return error;
165
 
 
 
149
    table->cursor->startTableScan(0);
166
150
    cache_pos=table->sort.record_pointers;
167
151
    cache_end= cache_pos+ table->sort.found_records * ref_length;
168
152
    read_record= (table->sort.addon_field ?  rr_unpack_from_buffer : rr_from_pointers);
170
154
  else
171
155
  {
172
156
    read_record= rr_sequential;
173
 
    error= table->cursor->startTableScan(1);
174
 
    if (error != 0)
175
 
      return error;
176
 
 
 
157
    table->cursor->startTableScan(1);
177
158
    /* We can use record cache if we don't update dynamic length tables */
178
159
    if (!table->no_cache &&
179
160
        (use_record_cache > 0 ||
184
165
    }
185
166
  }
186
167
 
187
 
  return 0;
 
168
  return;
188
169
} /* init_read_record */
189
170
 
190
171