~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join.cc

  • Committer: Brian Aker
  • Date: 2010-07-30 20:31:19 UTC
  • mto: This revision was merged to the branch mainline in revision 1679.
  • Revision ID: brian@gaz-20100730203119-89g2ye4zwnvcacxg
First pass in encapsulating row

Show diffs side-by-side

added added

removed removed

Lines of Context:
2373
2373
          item->save_in_result_field(1);
2374
2374
      }
2375
2375
      copy_sum_funcs(sum_funcs_end[i+1], sum_funcs_end[i]);
2376
 
      if ((write_error= table_arg->cursor->insertRecord(table_arg->record[0])))
 
2376
      if ((write_error= table_arg->cursor->insertRecord(table_arg->getInsertRecord())))
2377
2377
      {
2378
2378
        my_error(ER_USE_SQL_BIG_RESULT, MYF(0));
2379
2379
        return 1;
2834
2834
    {
2835
2835
      int error;
2836
2836
      join->found_records++;
2837
 
      if ((error=table->cursor->insertRecord(table->record[0])))
 
2837
      if ((error=table->cursor->insertRecord(table->getInsertRecord())))
2838
2838
      {
2839
2839
        if (!table->cursor->is_fatal_error(error, HA_CHECK_DUP))
2840
2840
          goto end;
2882
2882
    if (item->maybe_null)
2883
2883
      group->buff[-1]= (char) group->field->is_null();
2884
2884
  }
2885
 
  if (!table->cursor->index_read_map(table->record[1],
 
2885
  if (!table->cursor->index_read_map(table->getUpdateRecord(),
2886
2886
                                   join->tmp_table_param.group_buff,
2887
2887
                                   HA_WHOLE_KEY,
2888
2888
                                   HA_READ_KEY_EXACT))
2889
2889
  {                                             /* Update old record */
2890
2890
    table->restoreRecord();
2891
2891
    update_tmptable_sum_func(join->sum_funcs,table);
2892
 
    if ((error= table->cursor->updateRecord(table->record[1],
2893
 
                                          table->record[0])))
 
2892
    if ((error= table->cursor->updateRecord(table->getUpdateRecord(),
 
2893
                                          table->getInsertRecord())))
2894
2894
    {
2895
2895
      table->print_error(error,MYF(0));
2896
2896
      return NESTED_LOOP_ERROR;
2909
2909
       group=group->next,key_part++)
2910
2910
  {
2911
2911
    if (key_part->null_bit)
2912
 
      memcpy(table->record[0]+key_part->offset, group->buff, 1);
 
2912
      memcpy(table->getInsertRecord()+key_part->offset, group->buff, 1);
2913
2913
  }
2914
2914
  init_tmptable_sum_functions(join->sum_funcs);
2915
2915
  copy_funcs(join->tmp_table_param.items_to_copy);
2916
 
  if ((error=table->cursor->insertRecord(table->record[0])))
 
2916
  if ((error=table->cursor->insertRecord(table->getInsertRecord())))
2917
2917
  {
2918
2918
    my_error(ER_USE_SQL_BIG_RESULT, MYF(0));
2919
2919
    return NESTED_LOOP_ERROR;        // Table is_full error
2940
2940
  copy_fields(&join->tmp_table_param);          // Groups are copied twice.
2941
2941
  copy_funcs(join->tmp_table_param.items_to_copy);
2942
2942
 
2943
 
  if (!(error= table->cursor->insertRecord(table->record[0])))
 
2943
  if (!(error= table->cursor->insertRecord(table->getInsertRecord())))
2944
2944
    join->send_records++;                       // New group
2945
2945
  else
2946
2946
  {
2949
2949
      table->print_error(error,MYF(0));
2950
2950
      return NESTED_LOOP_ERROR;
2951
2951
    }
2952
 
    if (table->cursor->rnd_pos(table->record[1],table->cursor->dup_ref))
 
2952
    if (table->cursor->rnd_pos(table->getUpdateRecord(),table->cursor->dup_ref))
2953
2953
    {
2954
2954
      table->print_error(error,MYF(0));
2955
2955
      return NESTED_LOOP_ERROR;
2956
2956
    }
2957
2957
    table->restoreRecord();
2958
2958
    update_tmptable_sum_func(join->sum_funcs,table);
2959
 
    if ((error= table->cursor->updateRecord(table->record[1],
2960
 
                                          table->record[0])))
 
2959
    if ((error= table->cursor->updateRecord(table->getUpdateRecord(),
 
2960
                                          table->getInsertRecord())))
2961
2961
    {
2962
2962
      table->print_error(error,MYF(0));
2963
2963
      return NESTED_LOOP_ERROR;
5404
5404
  }
5405
5405
  Field **first_field=entry->getFields() + entry->getShare()->sizeFields() - field_count;
5406
5406
  offset= (field_count ?
5407
 
           entry->getField(entry->getShare()->sizeFields() - field_count)->offset(entry->record[0]) : 0);
 
5407
           entry->getField(entry->getShare()->sizeFields() - field_count)->offset(entry->getInsertRecord()) : 0);
5408
5408
  reclength= entry->getShare()->getRecordLength() - offset;
5409
5409
 
5410
5410
  entry->free_io_cache();                               // Safety