~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/records.cc

  • Committer: Brian Aker
  • Date: 2008-10-20 04:28:21 UTC
  • mto: (492.3.21 drizzle-clean-code)
  • mto: This revision was merged to the branch mainline in revision 530.
  • Revision ID: brian@tangent.org-20081020042821-rqqdrccuu8195k3y
Second pass of thd cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
static int rr_unpack_from_buffer(READ_RECORD *info);
30
30
static int rr_from_pointers(READ_RECORD *info);
31
31
static int rr_from_cache(READ_RECORD *info);
32
 
static int init_rr_cache(Session *thd, READ_RECORD *info);
 
32
static int init_rr_cache(Session *session, READ_RECORD *info);
33
33
static int rr_cmp(unsigned char *a,unsigned char *b);
34
34
static int rr_index_first(READ_RECORD *info);
35
35
static int rr_index(READ_RECORD *info);
44
44
    join_read_first/next functions.
45
45
 
46
46
  @param info         READ_RECORD structure to initialize.
47
 
  @param thd          Thread handle
 
47
  @param session          Thread handle
48
48
  @param table        Table to be accessed
49
49
  @param print_error  If true, call table->file->print_error() if an error
50
50
                      occurs (except for end-of-records error)
52
52
*/
53
53
 
54
54
void init_read_record_idx(READ_RECORD *info,
55
 
                          Session *thd __attribute__((unused)),
 
55
                          Session *session __attribute__((unused)),
56
56
                          Table *table,
57
57
                          bool print_error, uint32_t idx)
58
58
{
139
139
    This is the most basic access method of a table using rnd_init,
140
140
    rnd_next and rnd_end. No indexes are used.
141
141
*/
142
 
void init_read_record(READ_RECORD *info,Session *thd, Table *table,
 
142
void init_read_record(READ_RECORD *info,Session *session, Table *table,
143
143
                      SQL_SELECT *select,
144
144
                      int use_record_cache, bool print_error)
145
145
{
146
146
  IO_CACHE *tempfile;
147
147
 
148
148
  memset(info, 0, sizeof(*info));
149
 
  info->thd=thd;
 
149
  info->session=session;
150
150
  info->table=table;
151
151
  info->file= table->file;
152
152
  info->forms= &info->table;            /* Only one table */
191
191
      and table->sort.io_cache is read sequentially
192
192
    */
193
193
    if (!table->sort.addon_field &&
194
 
        thd->variables.read_rnd_buff_size &&
 
194
        session->variables.read_rnd_buff_size &&
195
195
        !(table->file->ha_table_flags() & HA_FAST_KEY_READ) &&
196
196
        (table->db_stat & HA_READ_ONLY ||
197
197
         table->reginfo.lock_type <= TL_READ_NO_INSERT) &&
203
203
        !table->s->blob_fields &&
204
204
        info->ref_length <= MAX_REFLENGTH)
205
205
    {
206
 
      if (! init_rr_cache(thd, info))
 
206
      if (! init_rr_cache(session, info))
207
207
      {
208
208
        info->read_record=rr_from_cache;
209
209
      }
233
233
         !(table->s->db_options_in_use & HA_OPTION_PACK_RECORD) ||
234
234
         (use_record_cache < 0 &&
235
235
          !(table->file->ha_table_flags() & HA_NOT_DELETE_WITH_CACHE))))
236
 
      table->file->extra_opt(HA_EXTRA_CACHE, thd->variables.read_buff_size);
 
236
      table->file->extra_opt(HA_EXTRA_CACHE, session->variables.read_buff_size);
237
237
  }
238
238
  /* 
239
239
    Do condition pushdown for UPDATE/DELETE.
240
240
    TODO: Remove this from here as it causes two condition pushdown calls 
241
241
    when we're running a SELECT and the condition cannot be pushed down.
242
242
  */
243
 
  if (thd->variables.engine_condition_pushdown && 
 
243
  if (session->variables.engine_condition_pushdown && 
244
244
      select && select->cond && 
245
245
      (select->cond->used_tables() & table->map) &&
246
246
      !table->file->pushed_cond)
290
290
  int tmp;
291
291
  while ((tmp= info->select->quick->get_next()))
292
292
  {
293
 
    if (info->thd->killed)
 
293
    if (info->session->killed)
294
294
    {
295
295
      my_error(ER_SERVER_SHUTDOWN, MYF(0));
296
296
      return 1;
359
359
  int tmp;
360
360
  while ((tmp=info->file->rnd_next(info->record)))
361
361
  {
362
 
    if (info->thd->killed)
 
362
    if (info->session->killed)
363
363
    {
364
 
      info->thd->send_kill_message();
 
364
      info->session->send_kill_message();
365
365
      return 1;
366
366
    }
367
367
    /*
479
479
}
480
480
        /* cacheing of records from a database */
481
481
 
482
 
static int init_rr_cache(Session *thd, READ_RECORD *info)
 
482
static int init_rr_cache(Session *session, READ_RECORD *info)
483
483
{
484
484
  uint32_t rec_cache_size;
485
485
 
489
489
    info->reclength= ALIGN_SIZE(info->struct_length);
490
490
 
491
491
  info->error_offset= info->table->s->reclength;
492
 
  info->cache_records= (thd->variables.read_rnd_buff_size /
 
492
  info->cache_records= (session->variables.read_rnd_buff_size /
493
493
                        (info->reclength+info->struct_length));
494
494
  rec_cache_size= info->cache_records*info->reclength;
495
495
  info->rec_cache_size= info->cache_records*info->ref_length;