~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join.cc

  • Committer: Brian Aker
  • Date: 2009-09-23 21:40:36 UTC
  • mfrom: (971.6.13 eday-purecov)
  • Revision ID: brian@gaz-20090923214036-bustj80ei8ysbayf
Old message removal by Eric (no actual code has been harmed in the production of
this patch...)

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
        select_lex->leaf_tables, fields_list,
181
181
        all_fields, &conds, order, group_list,
182
182
        &hidden_group_fields))
183
 
    return(-1);       /* purecov: inspected */
 
183
    return(-1);
184
184
 
185
185
  ref_pointer_array= *rref_pointer_array;
186
186
 
195
195
        having->check_cols(1)));
196
196
    select_lex->having_fix_field= 0;
197
197
    if (having_fix_rc || session->is_error())
198
 
      return(-1);       /* purecov: inspected */
 
198
      return(-1);
199
199
    session->lex->allow_sum_func= save_allow_sum_func;
200
200
  }
201
201
 
317
317
  }
318
318
 
319
319
  if (error)
320
 
    goto err;         /* purecov: inspected */
 
320
    goto err;
321
321
 
322
322
  if (result && result->prepare(fields_list, unit_arg))
323
 
    goto err;         /* purecov: inspected */
 
323
    goto err;
324
324
 
325
325
  /* Init join struct */
326
326
  count_field_types(select_lex, &tmp_table_param, all_fields, 0);
343
343
  return(0); // All OK
344
344
 
345
345
err:
346
 
  return(-1);       /* purecov: inspected */
 
346
  return(-1);
347
347
}
348
348
 
349
349
/*
559
559
  if (!(session->options & OPTION_BIG_SELECTS) &&
560
560
      best_read > (double) session->variables.max_join_size &&
561
561
      !(select_options & SELECT_DESCRIBE))
562
 
  {           /* purecov: inspected */
 
562
  {
563
563
    my_message(ER_TOO_BIG_SELECT, ER(ER_TOO_BIG_SELECT), MYF(0));
564
564
    error= -1;
565
565
    return 1;
574
574
  select= make_select(*table, const_table_map,
575
575
                      const_table_map, conds, 1, &error);
576
576
  if (error)
577
 
  {           /* purecov: inspected */
578
 
    error= -1;          /* purecov: inspected */
 
577
  {
 
578
    error= -1;
579
579
    return 1;
580
580
  }
581
581
 
1080
1080
    */
1081
1081
    if (select_lex->uncacheable && !is_top_level_join() &&
1082
1082
        init_save_join_tab())
1083
 
      return(-1);                         /* purecov: inspected */
 
1083
      return(-1);
1084
1084
  }
1085
1085
 
1086
1086
  error= 0;
1150
1150
bool JOIN::init_save_join_tab()
1151
1151
{
1152
1152
  if (!(tmp_join= (JOIN*)session->alloc(sizeof(JOIN))))
1153
 
    return 1;                                  /* purecov: inspected */
 
1153
    return 1;
1154
1154
  error= 0;              // Ensure that tmp_join.error= 0
1155
1155
  restore_tmp();
1156
1156
  return 0;
2399
2399
  if (join->session->killed)                    // Aborted by user
2400
2400
  {
2401
2401
    join->session->send_kill_message();
2402
 
    return NESTED_LOOP_KILLED;               /* purecov: inspected */
 
2402
    return NESTED_LOOP_KILLED;
2403
2403
  }
2404
2404
  if (!select_cond || select_cond->val_int())
2405
2405
  {
2604
2604
    if (join->session->killed)
2605
2605
    {
2606
2606
      join->session->send_kill_message();
2607
 
      return NESTED_LOOP_KILLED; // Aborted by user /* purecov: inspected */
 
2607
      return NESTED_LOOP_KILLED;
2608
2608
    }
2609
2609
    SQL_SELECT *select=join_tab->select;
2610
2610
    if (rc == NESTED_LOOP_OK &&
2637
2637
    join_tab->readCachedRecord();               // Restore current record
2638
2638
  reset_cache_write(&join_tab->cache);
2639
2639
  if (error > 0)                                // Fatal error
2640
 
    return NESTED_LOOP_ERROR;                   /* purecov: inspected */
 
2640
    return NESTED_LOOP_ERROR;
2641
2641
  for (JoinTable *tmp2=join->join_tab; tmp2 != join_tab ; tmp2++)
2642
2642
    tmp2->table->status=tmp2->status;
2643
2643
  return NESTED_LOOP_OK;
2678
2678
    if (join->do_send_rows)
2679
2679
      error=join->result->send_data(*join->fields);
2680
2680
    if (error)
2681
 
      return NESTED_LOOP_ERROR; /* purecov: inspected */
 
2681
      return NESTED_LOOP_ERROR;
2682
2682
    if (++join->send_records >= join->unit->select_limit_cnt && join->do_send_rows)
2683
2683
    {
2684
2684
      if (join->select_options & OPTION_FOUND_ROWS)
2736
2736
  if (join->session->killed)                    // Aborted by user
2737
2737
  {
2738
2738
    join->session->send_kill_message();
2739
 
    return NESTED_LOOP_KILLED;             /* purecov: inspected */
 
2739
    return NESTED_LOOP_KILLED;
2740
2740
  }
2741
2741
  if (!end_of_records)
2742
2742
  {
2783
2783
  if (join->session->killed)                    // Aborted by user
2784
2784
  {
2785
2785
    join->session->send_kill_message();
2786
 
    return NESTED_LOOP_KILLED;             /* purecov: inspected */
 
2786
    return NESTED_LOOP_KILLED;
2787
2787
  }
2788
2788
 
2789
2789
  join->found_records++;
2807
2807
    if ((error= table->file->ha_update_row(table->record[1],
2808
2808
                                          table->record[0])))
2809
2809
    {
2810
 
      table->file->print_error(error,MYF(0));   /* purecov: inspected */
2811
 
      return NESTED_LOOP_ERROR;            /* purecov: inspected */
 
2810
      table->file->print_error(error,MYF(0));
 
2811
      return NESTED_LOOP_ERROR;
2812
2812
    }
2813
2813
    return NESTED_LOOP_OK;
2814
2814
  }
2854
2854
  if (join->session->killed)                    // Aborted by user
2855
2855
  {
2856
2856
    join->session->send_kill_message();
2857
 
    return NESTED_LOOP_KILLED;             /* purecov: inspected */
 
2857
    return NESTED_LOOP_KILLED;
2858
2858
  }
2859
2859
 
2860
2860
  init_tmptable_sum_functions(join->sum_funcs);
2867
2867
  {
2868
2868
    if ((int) table->file->get_dup_key(error) < 0)
2869
2869
    {
2870
 
      table->file->print_error(error,MYF(0));   /* purecov: inspected */
2871
 
      return NESTED_LOOP_ERROR;            /* purecov: inspected */
 
2870
      table->file->print_error(error,MYF(0));
 
2871
      return NESTED_LOOP_ERROR;
2872
2872
    }
2873
2873
    if (table->file->rnd_pos(table->record[1],table->file->dup_ref))
2874
2874
    {
2875
 
      table->file->print_error(error,MYF(0));   /* purecov: inspected */
2876
 
      return NESTED_LOOP_ERROR;            /* purecov: inspected */
 
2875
      table->file->print_error(error,MYF(0));
 
2876
      return NESTED_LOOP_ERROR;
2877
2877
    }
2878
2878
    table->restoreRecord();
2879
2879
    update_tmptable_sum_func(join->sum_funcs,table);
2880
2880
    if ((error= table->file->ha_update_row(table->record[1],
2881
2881
                                          table->record[0])))
2882
2882
    {
2883
 
      table->file->print_error(error,MYF(0));   /* purecov: inspected */
2884
 
      return NESTED_LOOP_ERROR;            /* purecov: inspected */
 
2883
      table->file->print_error(error,MYF(0));
 
2884
      return NESTED_LOOP_ERROR;
2885
2885
    }
2886
2886
  }
2887
2887
  return NESTED_LOOP_OK;
4276
4276
  if (!join->table_reexec)
4277
4277
  {
4278
4278
    if (!(join->table_reexec= (Table**) join->session->alloc(sizeof(Table*))))
4279
 
      return(true);                        /* purecov: inspected */
 
4279
      return(true);
4280
4280
    if (join->tmp_join)
4281
4281
      join->tmp_join->table_reexec= join->table_reexec;
4282
4282
  }
4284
4284
  {
4285
4285
    if (!(join->join_tab_reexec=
4286
4286
          (JoinTable*) join->session->alloc(sizeof(JoinTable))))
4287
 
      return(true);                        /* purecov: inspected */
 
4287
      return(true);
4288
4288
    if (join->tmp_join)
4289
4289
      join->tmp_join->join_tab_reexec= join->join_tab_reexec;
4290
4290
  }
4972
4972
      }
4973
4973
      break;
4974
4974
    default:
4975
 
      break;                                    /* purecov: deadcode */
 
4975
      break;
4976
4976
    case AM_UNKNOWN:
4977
4977
    case AM_MAYBE_REF:
4978
 
      abort();                                  /* purecov: deadcode */
 
4978
      abort();
4979
4979
    }
4980
4980
  }
4981
4981
  join->join_tab[join->tables-1].next_select=0; /* Set by do_select */
5528
5528
  stat_ref=(JoinTable**) join->session->alloc(sizeof(JoinTable*)*MAX_TABLES);
5529
5529
  table_vector=(Table**) join->session->alloc(sizeof(Table*)*(table_count*2));
5530
5530
  if (! stat || ! stat_ref || ! table_vector)
5531
 
    return 1;                           // Eom /* purecov: inspected */
 
5531
    return 1;
5532
5532
 
5533
5533
  join->best_ref=stat_vector;
5534
5534