~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/row/row0ins.c

  • Committer: Brian Aker
  • Date: 2010-12-19 06:20:54 UTC
  • mfrom: (2005.1.1 bug673105)
  • Revision ID: brian@tangent.org-20101219062054-1kt0l3dxs4z2z8md
Merge Dave.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
{
75
75
        ins_node_t*     node;
76
76
 
77
 
        node = static_cast<ins_node_t *>(mem_heap_alloc(heap, sizeof(ins_node_t)));
 
77
        node = mem_heap_alloc(heap, sizeof(ins_node_t));
78
78
 
79
79
        node->common.type = QUE_NODE_INSERT;
80
80
 
150
150
 
151
151
        dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
152
152
 
153
 
        ptr = static_cast<byte *>(mem_heap_zalloc(heap, DATA_ROW_ID_LEN));
 
153
        ptr = mem_heap_zalloc(heap, DATA_ROW_ID_LEN);
154
154
 
155
155
        dfield_set_data(dfield, ptr, DATA_ROW_ID_LEN);
156
156
 
161
161
        col = dict_table_get_sys_col(table, DATA_TRX_ID);
162
162
 
163
163
        dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
164
 
        ptr = static_cast<byte *>(mem_heap_zalloc(heap, DATA_TRX_ID_LEN));
 
164
        ptr = mem_heap_zalloc(heap, DATA_TRX_ID_LEN);
165
165
 
166
166
        dfield_set_data(dfield, ptr, DATA_TRX_ID_LEN);
167
167
 
172
172
        col = dict_table_get_sys_col(table, DATA_ROLL_PTR);
173
173
 
174
174
        dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
175
 
        ptr = static_cast<byte *>(mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN));
 
175
        ptr = mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN);
176
176
 
177
177
        dfield_set_data(dfield, ptr, DATA_ROLL_PTR_LEN);
178
178
}
371
371
 
372
372
        while (que_node_get_type(parent) == QUE_NODE_UPDATE) {
373
373
 
374
 
                upd_node = static_cast<upd_node_t *>(parent);
 
374
                upd_node = parent;
375
375
 
376
376
                if (upd_node->table == table && upd_node->is_delete == FALSE) {
377
377
 
518
518
                                        col->prtype, col->mbminmaxlen,
519
519
                                        col->len,
520
520
                                        ufield_len,
521
 
                                        static_cast<const char *>(dfield_get_data(&ufield->new_val)))
 
521
                                        dfield_get_data(&ufield->new_val))
522
522
                                    < ufield_len) {
523
523
 
524
524
                                        return(ULINT_UNDEFINED);
543
543
                                        byte*   padded_data;
544
544
                                        ulint   mbminlen;
545
545
 
546
 
                                        padded_data = static_cast<unsigned char *>(mem_heap_alloc(
547
 
                                                heap, min_size));
 
546
                                        padded_data = mem_heap_alloc(
 
547
                                                heap, min_size);
548
548
 
549
549
                                        pad = padded_data + ufield_len;
550
550
                                        pad_len = min_size - ufield_len;
801
801
 
802
802
        row_ins_invalidate_query_cache(thr, table->name);
803
803
 
804
 
        node = static_cast<upd_node_t *>(thr->run_node);
 
804
        node = thr->run_node;
805
805
 
806
806
        if (node->is_delete && 0 == (foreign->type
807
807
                                     & (DICT_FOREIGN_ON_DELETE_CASCADE
1238
1238
        }
1239
1239
 
1240
1240
        if (que_node_get_type(thr->run_node) == QUE_NODE_UPDATE) {
1241
 
                upd_node = static_cast<upd_node_t *>(thr->run_node);
 
1241
                upd_node = thr->run_node;
1242
1242
 
1243
1243
                if (!(upd_node->is_delete) && upd_node->foreign == foreign) {
1244
1244
                        /* If a cascaded update is done as defined by a
1769
1769
row_ins_duplicate_error_in_clust(
1770
1770
/*=============================*/
1771
1771
        btr_cur_t*      cursor, /*!< in: B-tree cursor */
1772
 
        const dtuple_t* entry,  /*!< in: entry to insert */
 
1772
        dtuple_t*       entry,  /*!< in: entry to insert */
1773
1773
        que_thr_t*      thr,    /*!< in: query thread */
1774
1774
        mtr_t*          mtr)    /*!< in: mtr */
1775
1775
{
1965
1965
                                depending on whether we wish optimistic or
1966
1966
                                pessimistic descent down the index tree */
1967
1967
        dict_index_t*   index,  /*!< in: index */
1968
 
        dtuple_t*       entry,  /*!< in/out: index entry to insert */
 
1968
        dtuple_t*       entry,  /*!< in: index entry to insert */
1969
1969
        ulint           n_ext,  /*!< in: number of externally stored columns */
1970
1970
        que_thr_t*      thr)    /*!< in: query thread */
1971
1971
{
2110
2110
        mtr_commit(&mtr);
2111
2111
 
2112
2112
        if (UNIV_LIKELY_NULL(big_rec)) {
2113
 
                rec_t*  exit_rec;
 
2113
                rec_t*  rec;
2114
2114
                ulint*  offsets;
2115
2115
                mtr_start(&mtr);
2116
2116
 
2117
2117
                btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
2118
2118
                                            BTR_MODIFY_TREE, &cursor, 0,
2119
2119
                                            __FILE__, __LINE__, &mtr);
2120
 
                exit_rec = btr_cur_get_rec(&cursor);
2121
 
                offsets = rec_get_offsets(exit_rec, index, NULL,
 
2120
                rec = btr_cur_get_rec(&cursor);
 
2121
                offsets = rec_get_offsets(rec, index, NULL,
2122
2122
                                          ULINT_UNDEFINED, &heap);
2123
2123
 
2124
2124
                err = btr_store_big_rec_extern_fields(
2125
2125
                        index, btr_cur_get_block(&cursor),
2126
 
                        exit_rec, offsets, big_rec, &mtr);
 
2126
                        rec, offsets, big_rec, &mtr);
2127
2127
 
2128
2128
                if (modify) {
2129
2129
                        dtuple_big_rec_free(big_rec);
2151
2151
row_ins_index_entry(
2152
2152
/*================*/
2153
2153
        dict_index_t*   index,  /*!< in: index */
2154
 
        dtuple_t*       entry,  /*!< in/out: index entry to insert */
 
2154
        dtuple_t*       entry,  /*!< in: index entry to insert */
2155
2155
        ulint           n_ext,  /*!< in: number of externally stored columns */
2156
 
        ibool           foreign,/*!< in: TRUE=check foreign key constraints
2157
 
                                (foreign=FALSE only during CREATE INDEX) */
 
2156
        ibool           foreign,/*!< in: TRUE=check foreign key constraints */
2158
2157
        que_thr_t*      thr)    /*!< in: query thread */
2159
2158
{
2160
2159
        enum db_err     err;
2161
2160
 
2162
2161
        if (foreign && UT_LIST_GET_FIRST(index->table->foreign_list)) {
2163
 
                err = static_cast<db_err>(row_ins_check_foreign_constraints(index->table, index,
2164
 
                                                        entry, thr));
 
2162
                err = row_ins_check_foreign_constraints(index->table, index,
 
2163
                                                        entry, thr);
2165
2164
                if (err != DB_SUCCESS) {
2166
2165
 
2167
2166
                        return(err);
2170
2169
 
2171
2170
        /* Try first optimistic descent to the B-tree */
2172
2171
 
2173
 
        err = static_cast<db_err>(row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry,
2174
 
                                      n_ext, thr));
 
2172
        err = row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry,
 
2173
                                      n_ext, thr);
2175
2174
        if (err != DB_FAIL) {
2176
2175
 
2177
2176
                return(err);
2179
2178
 
2180
2179
        /* Try then pessimistic descent to the B-tree */
2181
2180
 
2182
 
        err = static_cast<db_err>(row_ins_index_entry_low(BTR_MODIFY_TREE, index, entry,
2183
 
                                      n_ext, thr));
 
2181
        err = row_ins_index_entry_low(BTR_MODIFY_TREE, index, entry,
 
2182
                                      n_ext, thr);
2184
2183
        return(err);
2185
2184
}
2186
2185
 
2223
2222
                        len = dtype_get_at_most_n_mbchars(
2224
2223
                                col->prtype, col->mbminmaxlen,
2225
2224
                                ind_field->prefix_len,
2226
 
                                len, static_cast<const char *>(dfield_get_data(row_field)));
 
2225
                                len, dfield_get_data(row_field));
2227
2226
 
2228
2227
                        ut_ad(!dfield_is_ext(row_field));
2229
2228
                }
2255
2254
 
2256
2255
        ut_ad(dtuple_check_typed(node->entry));
2257
2256
 
2258
 
        err = static_cast<db_err>(row_ins_index_entry(node->index, node->entry, 0, TRUE, thr));
 
2257
        err = row_ins_index_entry(node->index, node->entry, 0, TRUE, thr);
2259
2258
 
2260
2259
        return(err);
2261
2260
}
2427
2426
 
2428
2427
        trx_start_if_not_started(trx);
2429
2428
 
2430
 
        node = static_cast<ins_node_t *>(thr->run_node);
 
2429
        node = thr->run_node;
2431
2430
 
2432
2431
        ut_ad(que_node_get_type(node) == QUE_NODE_INSERT);
2433
2432