~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/innobase/handler/handler0alter.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
}
130
130
 
131
131
/*************************************************************//**
132
 
Copies an InnoDB record to table->record[0]. */
 
132
Copies an InnoDB record to table->getInsertRecord(). */
133
133
extern "C" UNIV_INTERN
134
134
void
135
135
innobase_rec_to_mysql(
140
140
        const ulint*            offsets)        /*!< in: rec_get_offsets(
141
141
                                                rec, index, ...) */
142
142
{
143
 
        uint    n_fields        = table->s->fields;
 
143
        uint    n_fields        = table->getShare()->sizeFields();
144
144
        uint    i;
145
145
 
146
146
        ut_ad(n_fields == dict_table_get_n_user_cols(index->table));
147
147
 
148
148
        for (i = 0; i < n_fields; i++) {
149
 
                Field*          field   = table->field[i];
 
149
                Field*          field   = table->getField(i);
150
150
                ulint           ipos;
151
151
                ulint           ilen;
152
152
                const unsigned char*    ifield;
179
179
}
180
180
 
181
181
/*************************************************************//**
182
 
Resets table->record[0]. */
 
182
Resets table->getInsertRecord(). */
183
183
extern "C" UNIV_INTERN
184
184
void
185
185
innobase_rec_reset(
186
186
/*===============*/
187
187
        Table*                  table)          /*!< in/out: MySQL table */
188
188
{
189
 
        uint    n_fields        = table->s->fields;
 
189
        uint    n_fields        = table->getShare()->sizeFields();
190
190
        uint    i;
191
191
 
192
192
        for (i = 0; i < n_fields; i++) {
193
 
                table->field[i]->set_default();
 
193
                table->getField(i)->set_default();
194
194
        }
195
195
}
196
196
 
 
197
#if 0 // This is a part of the fast index code.
197
198
/******************************************************************//**
198
199
Removes the filename encoding of a database and table name. */
199
200
static
221
222
        }
222
223
}
223
224
 
 
225
 
224
226
/*******************************************************************//**
225
227
This function checks that index keys are sensible.
226
228
@return 0 or error number */
228
230
int
229
231
innobase_check_index_keys(
230
232
/*======================*/
231
 
        const KEY*      key_info,       /*!< in: Indexes to be created */
 
233
        const KeyInfo*  key_info,       /*!< in: Indexes to be created */
232
234
        ulint           num_of_keys)    /*!< in: Number of indexes to
233
235
                                        be created */
234
236
{
238
240
        ut_ad(num_of_keys);
239
241
 
240
242
        for (key_num = 0; key_num < num_of_keys; key_num++) {
241
 
                const KEY&      key = key_info[key_num];
 
243
                const KeyInfo&  key = key_info[key_num];
242
244
 
243
245
                /* Check that the same index name does not appear
244
246
                twice in indexes to be created. */
245
247
 
246
248
                for (ulint i = 0; i < key_num; i++) {
247
 
                        const KEY&      key2 = key_info[i];
 
249
                        const KeyInfo&  key2 = key_info[i];
248
250
 
249
251
                        if (0 == strcmp(key.name, key2.name)) {
250
252
                                errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB: key name `%s` appears"
260
262
                that the same colum does not appear twice in the index. */
261
263
 
262
264
                for (ulint i = 0; i < key.key_parts; i++) {
263
 
                        const KEY_PART_INFO&    key_part1
 
265
                        const KeyPartInfo&      key_part1
264
266
                                = key.key_part[i];
265
267
                        const Field*            field
266
268
                                = key_part1.field;
300
302
                        }
301
303
 
302
304
                        for (ulint j = 0; j < i; j++) {
303
 
                                const KEY_PART_INFO&    key_part2
 
305
                                const KeyPartInfo&      key_part2
304
306
                                        = key.key_part[j];
305
307
 
306
308
                                if (strcmp(key_part1.field->field_name,
327
329
void
328
330
innobase_create_index_field_def(
329
331
/*============================*/
330
 
        KEY_PART_INFO*          key_part,       /*!< in: MySQL key definition */
 
332
        KeyPartInfo*            key_part,       /*!< in: MySQL key definition */
331
333
        mem_heap_t*             heap,           /*!< in: memory heap */
332
334
        merge_index_field_t*    index_field)    /*!< out: index field
333
335
                                                definition for key_part */
367
369
void
368
370
innobase_create_index_def(
369
371
/*======================*/
370
 
        KEY*                    key,            /*!< in: key definition */
 
372
        KeyInfo*                        key,            /*!< in: key definition */
371
373
        bool                    new_primary,    /*!< in: TRUE=generating
372
374
                                                a new primary key
373
375
                                                on the table */
484
486
 
485
487
 
486
488
@return key definitions or NULL */
 
489
 
487
490
static
488
491
merge_index_def_t*
489
492
innobase_create_key_def(
492
495
        const dict_table_t*table,               /*!< in: table definition */
493
496
        mem_heap_t*     heap,           /*!< in: heap where space for key
494
497
                                        definitions are allocated */
495
 
        KEY*            key_info,       /*!< in: Indexes to be created */
 
498
        KeyInfo*                key_info,       /*!< in: Indexes to be created */
496
499
        ulint&          n_keys)         /*!< in/out: Number of indexes to
497
500
                                        be created */
498
501
{
596
599
        return(name);
597
600
}
598
601
 
 
602
 
599
603
/*******************************************************************//**
600
604
Create indexes.
601
605
@return 0 or error number */
603
607
int
604
608
ha_innobase::add_index(
605
609
/*===================*/
 
610
                       Session *session,
606
611
        Table*  i_table,        /*!< in: Table where indexes are created */
607
 
        KEY*    key_info,       /*!< in: Indexes to be created */
 
612
        KeyInfo*        key_info,       /*!< in: Indexes to be created */
608
613
        uint    num_of_keys)    /*!< in: Number of indexes to be created */
609
614
{
610
615
        dict_index_t**  index;          /*!< Index to be created */
627
632
                return(HA_ERR_WRONG_COMMAND);
628
633
        }
629
634
 
630
 
        update_session();
 
635
        update_session(session);
631
636
 
632
637
        heap = mem_heap_create(1024);
633
638
 
907
912
int
908
913
ha_innobase::prepare_drop_index(
909
914
/*============================*/
 
915
                                Session *session,
910
916
        Table*  i_table,        /*!< in: Table where indexes are dropped */
911
917
        uint*   key_num,        /*!< in: Key nums to be dropped */
912
918
        uint    num_of_keys)    /*!< in: Number of keys to be dropped */
922
928
                return(HA_ERR_WRONG_COMMAND);
923
929
        }
924
930
 
925
 
        update_session();
 
931
        update_session(session);
926
932
 
927
933
        trx_search_latch_release_if_reserved(prebuilt->trx);
928
934
        trx = prebuilt->trx;
943
949
        }
944
950
 
945
951
        for (n_key = 0; n_key < num_of_keys; n_key++) {
946
 
                const KEY*      key;
 
952
                const KeyInfo*  key;
947
953
                dict_index_t*   index;
948
954
 
949
955
                key = i_table->key_info + key_num[n_key];
1107
1113
int
1108
1114
ha_innobase::final_drop_index(
1109
1115
/*==========================*/
 
1116
                              Session *session,
1110
1117
        Table*  )               /*!< in: Table where indexes are dropped */
1111
1118
{
1112
1119
        dict_index_t*   index;          /*!< Index to be dropped */
1117
1124
                return(HA_ERR_WRONG_COMMAND);
1118
1125
        }
1119
1126
 
1120
 
        update_session();
 
1127
        update_session(session);
1121
1128
 
1122
1129
        trx_search_latch_release_if_reserved(prebuilt->trx);
1123
1130
        trx_start_if_not_started(prebuilt->trx);
1198
1205
 
1199
1206
        return(err);
1200
1207
}
 
1208
#endif