77
77
/* 3: ID -------------------------------*/
78
78
dfield = dtuple_get_nth_field(entry, 1/*ID*/);
80
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 8));
80
ptr = mem_heap_alloc(heap, 8);
81
81
mach_write_to_8(ptr, table->id);
83
83
dfield_set_data(dfield, ptr, 8);
91
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
91
ptr = mem_heap_alloc(heap, 4);
92
92
mach_write_to_4(ptr, table->n_def
93
93
| ((table->flags & DICT_TF_COMPACT) << 31));
94
94
dfield_set_data(dfield, ptr, 4);
95
95
/* 5: TYPE -----------------------------*/
96
96
dfield = dtuple_get_nth_field(entry, 3/*TYPE*/);
98
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
98
ptr = mem_heap_alloc(heap, 4);
99
99
if (table->flags & (~DICT_TF_COMPACT & ~(~0 << DICT_TF_BITS))) {
100
100
ut_a(table->flags & DICT_TF_COMPACT);
101
101
ut_a(dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP);
111
111
/* 6: MIX_ID (obsolete) ---------------------------*/
112
112
dfield = dtuple_get_nth_field(entry, 4/*MIX_ID*/);
114
ptr = static_cast<unsigned char *>(mem_heap_zalloc(heap, 8));
114
ptr = mem_heap_zalloc(heap, 8);
116
116
dfield_set_data(dfield, ptr, 8);
117
117
/* 7: MIX_LEN (additional flags) --------------------------*/
119
119
dfield = dtuple_get_nth_field(entry, 5/*MIX_LEN*/);
121
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
121
ptr = mem_heap_alloc(heap, 4);
122
122
mach_write_to_4(ptr, table->flags >> DICT_TF2_SHIFT);
124
124
dfield_set_data(dfield, ptr, 4);
129
129
/* 9: SPACE ----------------------------*/
130
130
dfield = dtuple_get_nth_field(entry, 7/*SPACE*/);
132
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
132
ptr = mem_heap_alloc(heap, 4);
133
133
mach_write_to_4(ptr, table->space);
135
135
dfield_set_data(dfield, ptr, 4);
173
173
/* 0: TABLE_ID -----------------------*/
174
174
dfield = dtuple_get_nth_field(entry, 0/*TABLE_ID*/);
176
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 8));
176
ptr = mem_heap_alloc(heap, 8);
177
177
mach_write_to_8(ptr, table->id);
179
179
dfield_set_data(dfield, ptr, 8);
180
180
/* 1: POS ----------------------------*/
181
181
dfield = dtuple_get_nth_field(entry, 1/*POS*/);
183
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
183
ptr = mem_heap_alloc(heap, 4);
184
184
mach_write_to_4(ptr, i);
186
186
dfield_set_data(dfield, ptr, 4);
192
192
/* 5: MTYPE --------------------------*/
193
193
dfield = dtuple_get_nth_field(entry, 3/*MTYPE*/);
195
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
195
ptr = mem_heap_alloc(heap, 4);
196
196
mach_write_to_4(ptr, column->mtype);
198
198
dfield_set_data(dfield, ptr, 4);
199
199
/* 6: PRTYPE -------------------------*/
200
200
dfield = dtuple_get_nth_field(entry, 4/*PRTYPE*/);
202
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
202
ptr = mem_heap_alloc(heap, 4);
203
203
mach_write_to_4(ptr, column->prtype);
205
205
dfield_set_data(dfield, ptr, 4);
206
206
/* 7: LEN ----------------------------*/
207
207
dfield = dtuple_get_nth_field(entry, 5/*LEN*/);
209
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
209
ptr = mem_heap_alloc(heap, 4);
210
210
mach_write_to_4(ptr, column->len);
212
212
dfield_set_data(dfield, ptr, 4);
213
213
/* 8: PREC ---------------------------*/
214
214
dfield = dtuple_get_nth_field(entry, 6/*PREC*/);
216
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
216
ptr = mem_heap_alloc(heap, 4);
217
217
mach_write_to_4(ptr, 0/* unused */);
219
219
dfield_set_data(dfield, ptr, 4);
371
371
/* 0: TABLE_ID -----------------------*/
372
372
dfield = dtuple_get_nth_field(entry, 0/*TABLE_ID*/);
374
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 8));
374
ptr = mem_heap_alloc(heap, 8);
375
375
mach_write_to_8(ptr, table->id);
377
377
dfield_set_data(dfield, ptr, 8);
378
378
/* 1: ID ----------------------------*/
379
379
dfield = dtuple_get_nth_field(entry, 1/*ID*/);
381
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 8));
381
ptr = mem_heap_alloc(heap, 8);
382
382
mach_write_to_8(ptr, index->id);
384
384
dfield_set_data(dfield, ptr, 8);
389
389
/* 5: N_FIELDS ----------------------*/
390
390
dfield = dtuple_get_nth_field(entry, 3/*N_FIELDS*/);
392
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
392
ptr = mem_heap_alloc(heap, 4);
393
393
mach_write_to_4(ptr, index->n_fields);
395
395
dfield_set_data(dfield, ptr, 4);
396
396
/* 6: TYPE --------------------------*/
397
397
dfield = dtuple_get_nth_field(entry, 4/*TYPE*/);
399
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
399
ptr = mem_heap_alloc(heap, 4);
400
400
mach_write_to_4(ptr, index->type);
402
402
dfield_set_data(dfield, ptr, 4);
409
409
dfield = dtuple_get_nth_field(entry, 5/*SPACE*/);
411
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
411
ptr = mem_heap_alloc(heap, 4);
412
412
mach_write_to_4(ptr, index->space);
414
414
dfield_set_data(dfield, ptr, 4);
421
421
dfield = dtuple_get_nth_field(entry, 6/*PAGE_NO*/);
423
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
423
ptr = mem_heap_alloc(heap, 4);
424
424
mach_write_to_4(ptr, FIL_NULL);
426
426
dfield_set_data(dfield, ptr, 4);
472
472
/* 0: INDEX_ID -----------------------*/
473
473
dfield = dtuple_get_nth_field(entry, 0/*INDEX_ID*/);
475
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 8));
475
ptr = mem_heap_alloc(heap, 8);
476
476
mach_write_to_8(ptr, index->id);
478
478
dfield_set_data(dfield, ptr, 8);
481
481
dfield = dtuple_get_nth_field(entry, 1/*POS*/);
483
ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
483
ptr = mem_heap_alloc(heap, 4);
485
485
if (index_contains_column_prefix_field) {
486
486
/* If there are column prefix fields in the index, then
828
828
appropriate field in the SYS_INDEXES record: this mini-transaction
829
829
marks the B-tree totally truncated */
831
btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
831
btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
833
833
btr_free_root(space, zip_size, root_page_no, mtr);
1431
1431
if (foreign->id == NULL) {
1432
1432
/* Generate a new constraint id */
1433
1433
ulint namelen = strlen(table->name);
1434
char* id = static_cast<char *>(mem_heap_alloc(foreign->heap, namelen + 20));
1434
char* id = mem_heap_alloc(foreign->heap, namelen + 20);
1435
1435
/* no overflow if number < 1e13 */
1436
1436
sprintf(id, "%s_ibfk_%lu", table->name, (ulong) (*id_nr)++);
1437
1437
foreign->id = id;