209
TYPELIB *typelib(memory::Root *mem_root, List<String> &strings)
209
TYPELIB *typelib(memory::Root& mem_root, List<String> &strings)
211
TYPELIB *result= (TYPELIB*) mem_root->alloc_root(sizeof(TYPELIB));
211
TYPELIB *result= new (mem_root) TYPELIB;
214
212
result->count= strings.size();
215
213
result->name= "";
216
uint32_t nbytes= (sizeof(char*) + sizeof(uint32_t)) * (result->count + 1);
218
if (!(result->type_names= (const char**) mem_root->alloc_root(nbytes)))
214
result->type_names= (const char**) mem_root.alloc((sizeof(char*) + sizeof(uint32_t)) * (result->count + 1));
221
215
result->type_lengths= (uint*) (result->type_names + result->count + 1);
223
217
List<String>::iterator it(strings.begin());
669
663
Make sure that the blob fits into a Field_varstring which has
672
if (convert_blob_length && convert_blob_length <= Field_varstring::MAX_SIZE &&
673
(org_field->flags & BLOB_FLAG))
666
if (convert_blob_length && convert_blob_length <= Field_varstring::MAX_SIZE && (org_field->flags & BLOB_FLAG))
675
668
table->setVariableWidth();
676
new_field= new Field_varstring(convert_blob_length,
677
org_field->maybe_null(),
678
org_field->field_name,
679
org_field->charset());
669
new_field= new Field_varstring(convert_blob_length, org_field->maybe_null(), org_field->field_name, org_field->charset());
683
new_field= org_field->new_field(session->mem_root, table,
684
table == org_field->getTable());
673
new_field= org_field->new_field(session->mem_root, table, table == org_field->getTable());
799
788
table::Singular* table= &session->getInstanceTable(); // This will not go into the tableshare cache, so no key is used.
801
if (not table->getMemRoot()->multi_alloc_root(0,
802
&default_field, sizeof(Field*) * (field_count),
803
&from_field, sizeof(Field*)*field_count,
804
©_func, sizeof(*copy_func)*(copy_func_count+1),
805
¶m->keyinfo, sizeof(*param->keyinfo),
806
&key_part_info, sizeof(*key_part_info)*(param->group_parts+1),
807
¶m->start_recinfo, sizeof(*param->recinfo)*(field_count*2+4),
808
&group_buff, (group && ! using_unique_constraint ?
809
param->group_length : 0),
790
table->getMemRoot().multi_alloc(0,
791
&default_field, sizeof(Field*) * (field_count),
792
&from_field, sizeof(Field*)*field_count,
793
©_func, sizeof(*copy_func)*(copy_func_count+1),
794
¶m->keyinfo, sizeof(*param->keyinfo),
795
&key_part_info, sizeof(*key_part_info)*(param->group_parts+1),
796
¶m->start_recinfo, sizeof(*param->recinfo)*(field_count*2+4),
797
&group_buff, (group && ! using_unique_constraint ? param->group_length : 0),
814
799
/* CopyField belongs to Tmp_Table_Param, allocate it in Session mem_root */
815
800
param->copy_field= copy= new (session->mem_root) CopyField[field_count];
816
801
param->items_to_copy= copy_func;
820
805
memset(from_field, 0, sizeof(Field*)*field_count);
822
807
memory::Root* mem_root_save= session->mem_root;
823
session->mem_root= table->getMemRoot();
808
session->mem_root= &table->getMemRoot();
825
810
table->getMutableShare()->setFields(field_count+1);
826
811
table->setFields(table->getMutableShare()->getFields(true));
908
893
session->mem_root= mem_root_save;
909
894
*argp= new Item_field(new_field);
910
session->mem_root= table->getMemRoot();
895
session->mem_root= &table->getMemRoot();
911
896
if (!(new_field->flags & NOT_NULL_FLAG))
1038
1023
uint32_t alloc_length=ALIGN_SIZE(reclength+MI_UNIQUE_HASH_LENGTH+1);
1039
1024
table->getMutableShare()->rec_buff_length= alloc_length;
1040
if (!(table->record[0]= (unsigned char*) table->alloc_root(alloc_length*2)))
1025
table->record[0]= table->alloc(alloc_length*2);
1044
1026
table->record[1]= table->getInsertRecord()+alloc_length;
1045
1027
table->getMutableShare()->resizeDefaultValues(alloc_length);
1256
1238
(table->getMutableShare()->uniques ? test(null_pack_length) : 0));
1257
1239
table->distinct= 1;
1258
1240
table->getMutableShare()->keys= 1;
1259
if (!(key_part_info= (KeyPartInfo*)
1260
table->alloc_root(keyinfo->key_parts * sizeof(KeyPartInfo))))
1241
key_part_info= (KeyPartInfo*)table->alloc(keyinfo->key_parts * sizeof(KeyPartInfo));
1262
1242
memset(key_part_info, 0, keyinfo->key_parts * sizeof(KeyPartInfo));
1263
1243
table->key_info=keyinfo;
1264
1244
keyinfo->key_part=key_part_info;