209
209
TYPELIB *typelib(memory::Root *mem_root, List<String> &strings)
211
TYPELIB *result= (TYPELIB*) mem_root->alloc_root(sizeof(TYPELIB));
211
TYPELIB *result= (TYPELIB*) mem_root->alloc(sizeof(TYPELIB));
214
212
result->count= strings.size();
215
213
result->name= "";
216
214
uint32_t nbytes= (sizeof(char*) + sizeof(uint32_t)) * (result->count + 1);
218
if (!(result->type_names= (const char**) mem_root->alloc_root(nbytes)))
216
result->type_names= (const char**) mem_root->alloc_root(nbytes);
221
217
result->type_lengths= (uint*) (result->type_names + result->count + 1);
223
219
List<String>::iterator it(strings.begin());
799
795
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),
797
table->getMemRoot()->multi_alloc_root(0,
798
&default_field, sizeof(Field*) * (field_count),
799
&from_field, sizeof(Field*)*field_count,
800
©_func, sizeof(*copy_func)*(copy_func_count+1),
801
¶m->keyinfo, sizeof(*param->keyinfo),
802
&key_part_info, sizeof(*key_part_info)*(param->group_parts+1),
803
¶m->start_recinfo, sizeof(*param->recinfo)*(field_count*2+4),
804
&group_buff, (group && ! using_unique_constraint ? param->group_length : 0),
814
806
/* CopyField belongs to Tmp_Table_Param, allocate it in Session mem_root */
815
807
param->copy_field= copy= new (session->mem_root) CopyField[field_count];
816
808
param->items_to_copy= copy_func;
1038
1030
uint32_t alloc_length=ALIGN_SIZE(reclength+MI_UNIQUE_HASH_LENGTH+1);
1039
1031
table->getMutableShare()->rec_buff_length= alloc_length;
1040
if (!(table->record[0]= (unsigned char*) table->alloc_root(alloc_length*2)))
1032
table->record[0]= (unsigned char*) table->alloc_root(alloc_length*2);
1044
1033
table->record[1]= table->getInsertRecord()+alloc_length;
1045
1034
table->getMutableShare()->resizeDefaultValues(alloc_length);
1256
1245
(table->getMutableShare()->uniques ? test(null_pack_length) : 0));
1257
1246
table->distinct= 1;
1258
1247
table->getMutableShare()->keys= 1;
1259
if (!(key_part_info= (KeyPartInfo*)
1260
table->alloc_root(keyinfo->key_parts * sizeof(KeyPartInfo))))
1248
key_part_info= (KeyPartInfo*)table->alloc_root(keyinfo->key_parts * sizeof(KeyPartInfo));
1262
1249
memset(key_part_info, 0, keyinfo->key_parts * sizeof(KeyPartInfo));
1263
1250
table->key_info=keyinfo;
1264
1251
keyinfo->key_part=key_part_info;