~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/dict/dict0crea.c

  • Committer: Monty Taylor
  • Date: 2010-12-22 03:15:22 UTC
  • mto: (2023.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2024.
  • Revision ID: mordred@inaugust.com-20101222031522-bmi73y3y00f480qs
Fixed some valgrind warning suppressions which were getting fooled by a
different stack.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
        /* 3: ID -------------------------------*/
78
78
        dfield = dtuple_get_nth_field(entry, 1/*ID*/);
79
79
 
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);
82
82
 
83
83
        dfield_set_data(dfield, ptr, 8);
88
88
#error
89
89
#endif
90
90
 
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*/);
97
97
 
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*/);
113
113
 
114
 
        ptr = static_cast<unsigned char *>(mem_heap_zalloc(heap, 8));
 
114
        ptr = mem_heap_zalloc(heap, 8);
115
115
 
116
116
        dfield_set_data(dfield, ptr, 8);
117
117
        /* 7: MIX_LEN (additional flags) --------------------------*/
118
118
 
119
119
        dfield = dtuple_get_nth_field(entry, 5/*MIX_LEN*/);
120
120
 
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);
123
123
 
124
124
        dfield_set_data(dfield, ptr, 4);
129
129
        /* 9: SPACE ----------------------------*/
130
130
        dfield = dtuple_get_nth_field(entry, 7/*SPACE*/);
131
131
 
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);
134
134
 
135
135
        dfield_set_data(dfield, ptr, 4);
173
173
        /* 0: TABLE_ID -----------------------*/
174
174
        dfield = dtuple_get_nth_field(entry, 0/*TABLE_ID*/);
175
175
 
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);
178
178
 
179
179
        dfield_set_data(dfield, ptr, 8);
180
180
        /* 1: POS ----------------------------*/
181
181
        dfield = dtuple_get_nth_field(entry, 1/*POS*/);
182
182
 
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);
185
185
 
186
186
        dfield_set_data(dfield, ptr, 4);
192
192
        /* 5: MTYPE --------------------------*/
193
193
        dfield = dtuple_get_nth_field(entry, 3/*MTYPE*/);
194
194
 
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);
197
197
 
198
198
        dfield_set_data(dfield, ptr, 4);
199
199
        /* 6: PRTYPE -------------------------*/
200
200
        dfield = dtuple_get_nth_field(entry, 4/*PRTYPE*/);
201
201
 
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);
204
204
 
205
205
        dfield_set_data(dfield, ptr, 4);
206
206
        /* 7: LEN ----------------------------*/
207
207
        dfield = dtuple_get_nth_field(entry, 5/*LEN*/);
208
208
 
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);
211
211
 
212
212
        dfield_set_data(dfield, ptr, 4);
213
213
        /* 8: PREC ---------------------------*/
214
214
        dfield = dtuple_get_nth_field(entry, 6/*PREC*/);
215
215
 
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 */);
218
218
 
219
219
        dfield_set_data(dfield, ptr, 4);
371
371
        /* 0: TABLE_ID -----------------------*/
372
372
        dfield = dtuple_get_nth_field(entry, 0/*TABLE_ID*/);
373
373
 
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);
376
376
 
377
377
        dfield_set_data(dfield, ptr, 8);
378
378
        /* 1: ID ----------------------------*/
379
379
        dfield = dtuple_get_nth_field(entry, 1/*ID*/);
380
380
 
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);
383
383
 
384
384
        dfield_set_data(dfield, ptr, 8);
389
389
        /* 5: N_FIELDS ----------------------*/
390
390
        dfield = dtuple_get_nth_field(entry, 3/*N_FIELDS*/);
391
391
 
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);
394
394
 
395
395
        dfield_set_data(dfield, ptr, 4);
396
396
        /* 6: TYPE --------------------------*/
397
397
        dfield = dtuple_get_nth_field(entry, 4/*TYPE*/);
398
398
 
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);
401
401
 
402
402
        dfield_set_data(dfield, ptr, 4);
408
408
 
409
409
        dfield = dtuple_get_nth_field(entry, 5/*SPACE*/);
410
410
 
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);
413
413
 
414
414
        dfield_set_data(dfield, ptr, 4);
420
420
 
421
421
        dfield = dtuple_get_nth_field(entry, 6/*PAGE_NO*/);
422
422
 
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);
425
425
 
426
426
        dfield_set_data(dfield, ptr, 4);
472
472
        /* 0: INDEX_ID -----------------------*/
473
473
        dfield = dtuple_get_nth_field(entry, 0/*INDEX_ID*/);
474
474
 
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);
477
477
 
478
478
        dfield_set_data(dfield, ptr, 8);
480
480
 
481
481
        dfield = dtuple_get_nth_field(entry, 1/*POS*/);
482
482
 
483
 
        ptr = static_cast<unsigned char *>(mem_heap_alloc(heap, 4));
 
483
        ptr = mem_heap_alloc(heap, 4);
484
484
 
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 */
830
830
 
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);
832
832
 
833
833
        btr_free_root(space, zip_size, root_page_no, mtr);
834
834
create:
883
883
{
884
884
        tab_node_t*     node;
885
885
 
886
 
        node = static_cast<tab_node_t *>(mem_heap_alloc(heap, sizeof(tab_node_t)));
 
886
        node = mem_heap_alloc(heap, sizeof(tab_node_t));
887
887
 
888
888
        node->common.type = QUE_NODE_CREATE_TABLE;
889
889
 
919
919
{
920
920
        ind_node_t*     node;
921
921
 
922
 
        node = static_cast<ind_node_t *>(mem_heap_alloc(heap, sizeof(ind_node_t)));
 
922
        node = mem_heap_alloc(heap, sizeof(ind_node_t));
923
923
 
924
924
        node->common.type = QUE_NODE_CREATE_INDEX;
925
925
 
961
961
 
962
962
        trx = thr_get_trx(thr);
963
963
 
964
 
        node = static_cast<tab_node_t *>(thr->run_node);
 
964
        node = thr->run_node;
965
965
 
966
966
        ut_ad(que_node_get_type(node) == QUE_NODE_CREATE_TABLE);
967
967
 
1068
1068
 
1069
1069
        trx = thr_get_trx(thr);
1070
1070
 
1071
 
        node = static_cast<ind_node_t *>(thr->run_node);
 
1071
        node = thr->run_node;
1072
1072
 
1073
1073
        ut_ad(que_node_get_type(node) == QUE_NODE_CREATE_INDEX);
1074
1074
 
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;