~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/records.cc

Merge in stewart

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
  read_record= rr_sequential;
49
49
}
50
50
 
51
 
void ReadRecord::init_read_record_idx(Session *, 
52
 
                                      Table *table_arg,
53
 
                                      bool print_error_arg, 
54
 
                                      uint32_t idx)
 
51
int ReadRecord::init_read_record_idx(Session *,
 
52
                                     Table *table_arg,
 
53
                                     bool print_error_arg,
 
54
                                     uint32_t idx)
55
55
{
56
56
  table_arg->emptyRecord();
57
57
  table= table_arg;
61
61
 
62
62
  table->status=0;                      /* And it's always found */
63
63
  if (not table->cursor->inited)
64
 
    table->cursor->startIndexScan(idx, 1);
 
64
  {
 
65
    int error= table->cursor->startIndexScan(idx, 1);
 
66
    if (error != 0)
 
67
      return error;
 
68
  }
65
69
  /* read_record will be changed to rr_index in rr_index_first */
66
70
  read_record= rr_index_first;
 
71
 
 
72
  return 0;
67
73
}
68
74
 
69
75
 
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)
 
76
int ReadRecord::init_read_record(Session *session_arg,
 
77
                                 Table *table_arg,
 
78
                                 optimizer::SqlSelect *select_arg,
 
79
                                 int use_record_cache,
 
80
                                 bool print_error_arg)
75
81
{
76
82
  internal::IO_CACHE *tempfile;
 
83
  int error= 0;
77
84
 
78
85
  session= session_arg;
79
86
  table= table_arg;
114
121
    io_cache->reinit_io_cache(internal::READ_CACHE,0L,0,0);
115
122
    ref_pos=table->cursor->ref;
116
123
    if (!table->cursor->inited)
117
 
      table->cursor->startTableScan(0);
 
124
    {
 
125
      error= table->cursor->startTableScan(0);
 
126
      if (error != 0)
 
127
        return error;
 
128
    }
118
129
 
119
130
    /*
120
131
      table->sort.addon_field is checked because if we use addon fields,
146
157
  }
147
158
  else if (table->sort.record_pointers)
148
159
  {
149
 
    table->cursor->startTableScan(0);
 
160
    error= table->cursor->startTableScan(0);
 
161
    if (error != 0)
 
162
      return error;
 
163
 
150
164
    cache_pos=table->sort.record_pointers;
151
165
    cache_end= cache_pos+ table->sort.found_records * ref_length;
152
166
    read_record= (table->sort.addon_field ?  rr_unpack_from_buffer : rr_from_pointers);
154
168
  else
155
169
  {
156
170
    read_record= rr_sequential;
157
 
    table->cursor->startTableScan(1);
 
171
    error= table->cursor->startTableScan(1);
 
172
    if (error != 0)
 
173
      return error;
 
174
 
158
175
    /* We can use record cache if we don't update dynamic length tables */
159
176
    if (!table->no_cache &&
160
177
        (use_record_cache > 0 ||
165
182
    }
166
183
  }
167
184
 
168
 
  return;
 
185
  return 0;
169
186
} /* init_read_record */
170
187
 
171
188