~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

Merged embedded-innodb-bug586348-merge into embedded-innodb-isolation-level.

Show diffs side-by-side

added added

removed removed

Lines of Context:
344
344
  /* write_set and all_set are copies of read_set */
345
345
  def_write_set= def_read_set;
346
346
  s->all_set= def_read_set;
347
 
  this->s->all_set.setAll();
 
347
  this->getMutableShare()->all_set.setAll();
348
348
  default_column_bitmaps();
349
349
}
350
350
 
733
733
      (org_field->flags & BLOB_FLAG))
734
734
    new_field= new Field_varstring(convert_blob_length,
735
735
                                   org_field->maybe_null(),
736
 
                                   org_field->field_name, table->s,
 
736
                                   org_field->field_name, table->getMutableShare(),
737
737
                                   org_field->charset());
738
738
  else
739
739
    new_field= org_field->new_field(session->mem_root, table,
750
750
    if (org_field->maybe_null() || (item && item->maybe_null))
751
751
      new_field->flags&= ~NOT_NULL_FLAG;        // Because of outer join
752
752
    if (org_field->type() == DRIZZLE_TYPE_VARCHAR)
753
 
      table->s->db_create_options|= HA_OPTION_PACK_RECORD;
 
753
      table->getMutableShare()->db_create_options|= HA_OPTION_PACK_RECORD;
754
754
    else if (org_field->type() == DRIZZLE_TYPE_DOUBLE)
755
755
      ((Field_double *) new_field)->not_fixed= true;
756
756
  }
818
818
  unsigned char *pos, *group_buff, *bitmaps;
819
819
  unsigned char *null_flags;
820
820
  Field **reg_field, **from_field, **default_field;
821
 
  uint32_t *blob_field;
822
821
  CopyField *copy= 0;
823
822
  KeyInfo *keyinfo;
824
823
  KeyPartInfo *key_part_info;
882
881
 
883
882
  if (not share->getMemRoot()->multi_alloc_root(0, &reg_field, sizeof(Field*) * (field_count+1),
884
883
                                                &default_field, sizeof(Field*) * (field_count),
885
 
                                                &blob_field, sizeof(uint32_t)*(field_count+1),
886
884
                                                &from_field, sizeof(Field*)*field_count,
887
885
                                                &copy_func, sizeof(*copy_func)*(copy_func_count+1),
888
886
                                                &param->keyinfo, sizeof(*param->keyinfo),
924
922
  table->keys_in_use_for_query.reset();
925
923
 
926
924
  table->setShare(share);
927
 
  share->blob_field= blob_field;
 
925
  share->blob_field.resize(field_count+1);
 
926
  uint32_t *blob_field= &share->blob_field[0];
928
927
  share->blob_ptr_size= portable_sizeof_char_ptr;
929
928
  share->db_low_byte_first=1;                // True for HEAP and MyISAM
930
929
  share->table_charset= param->table_charset;
1131
1130
    uint32_t alloc_length=ALIGN_SIZE(reclength+MI_UNIQUE_HASH_LENGTH+1);
1132
1131
    share->rec_buff_length= alloc_length;
1133
1132
    if (!(table->record[0]= (unsigned char*)
1134
 
                            table->alloc_root(alloc_length*3)))
 
1133
                            table->alloc_root(alloc_length*2)))
1135
1134
    {
1136
1135
      goto err;
1137
1136
    }
1138
1137
    table->record[1]= table->record[0]+alloc_length;
1139
 
    share->default_values= table->record[1]+alloc_length;
 
1138
    share->resizeDefaultValues(alloc_length);
1140
1139
  }
1141
1140
  copy_func[0]= 0;                              // End marker
1142
1141
  param->func_count= copy_func - param->items_to_copy;
1207
1206
      ptrdiff_t diff;
1208
1207
      Field *orig_field= default_field[i];
1209
1208
      /* Get the value from default_values */
1210
 
      diff= (ptrdiff_t) (orig_field->table->s->default_values-
1211
 
                            orig_field->table->record[0]);
 
1209
      diff= (ptrdiff_t) (orig_field->table->getDefaultValues() - orig_field->table->record[0]);
1212
1210
      orig_field->move_field_offset(diff);      // Points now at default_values
1213
1211
      if (orig_field->is_real_null())
1214
1212
        field->set_null();
1378
1376
                                                (unsigned char*) 0,
1379
1377
                                                (uint32_t) 0,
1380
1378
                                                NULL,
1381
 
                                                table->s,
 
1379
                                                table->getMutableShare(),
1382
1380
                                                &my_charset_bin);
1383
1381
      if (!key_part_info->field)
1384
1382
        goto err;
1474
1472
  uint32_t record_length= 0;
1475
1473
  uint32_t null_count= 0;                 /* number of columns which may be null */
1476
1474
  uint32_t null_pack_length;              /* NULL representation array length */
1477
 
  uint32_t *blob_field;
1478
1475
  unsigned char *bitmaps;
1479
1476
  Table *table;
1480
1477
 
1481
1478
  TableShareInstance *share= getTemporaryShare(); // This will not go into the tableshare cache, so no key is used.
1482
1479
 
1483
1480
  if (! share->getMemRoot()->multi_alloc_root(0, &field, (field_count + 1) * sizeof(Field*),
1484
 
                                              &blob_field, (field_count+1) *sizeof(uint32_t),
1485
1481
                                              &bitmaps, bitmap_buffer_size(field_count)*2,
1486
1482
                                              NULL))
1487
1483
  {
1490
1486
 
1491
1487
  table= share->getTable();
1492
1488
  table->field= field;
1493
 
  share->blob_field= blob_field;
 
1489
  share->blob_field.resize(field_count+1);
1494
1490
  share->fields= field_count;
1495
1491
  share->blob_ptr_size= portable_sizeof_char_ptr;
1496
1492
  table->setup_tmp_table_column_bitmaps(bitmaps);
1853
1849
 */
1854
1850
void Table::storeRecordAsDefault()
1855
1851
{
1856
 
  memcpy(s->default_values, record[0], (size_t) s->reclength);
 
1852
  memcpy(s->getDefaultValues(), record[0], (size_t) s->reclength);
1857
1853
}
1858
1854
 
1859
1855
/*
1871
1867
 */
1872
1868
void Table::restoreRecordAsDefault()
1873
1869
{
1874
 
  memcpy(record[0], s->default_values, (size_t) s->reclength);
 
1870
  memcpy(record[0], s->getDefaultValues(), (size_t) s->reclength);
1875
1871
}
1876
1872
 
1877
1873
/*