~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/handler/ha_innodb.h

Extracted the LOAD command into its own class and implementation files.
Removed the corresponding case label from the switch statement.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
                                        or undefined */
78
78
        uint            num_write_row;  /* number of write_row() calls */
79
79
 
80
 
        UNIV_INTERN uint store_key_val_for_row(uint keynr, char* buff, 
81
 
                                   uint buff_len, const unsigned char* record);
82
 
        UNIV_INTERN void update_session(Session* session);
83
 
        UNIV_INTERN void update_session();
84
 
        UNIV_INTERN int change_active_index(uint32_t keynr);
85
 
        UNIV_INTERN int general_fetch(unsigned char* buf, uint32_t direction, uint32_t match_mode);
86
 
        UNIV_INTERN ulint innobase_lock_autoinc();
87
 
        UNIV_INTERN uint64_t innobase_peek_autoinc();
 
80
        uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
 
81
                                   const unsigned char* record);
 
82
        void update_session(Session* session);
 
83
        void update_session();
 
84
        int change_active_index(uint32_t keynr);
 
85
        int general_fetch(unsigned char* buf, uint32_t direction, uint32_t match_mode);
 
86
        ulint innobase_lock_autoinc();
 
87
        uint64_t innobase_peek_autoinc();
88
88
        ulint innobase_set_max_autoinc(uint64_t auto_inc);
89
89
        ulint innobase_reset_autoinc(uint64_t auto_inc);
90
 
        UNIV_INTERN ulint innobase_get_autoinc(uint64_t* value);
 
90
        ulint innobase_get_autoinc(uint64_t* value);
91
91
        ulint innobase_update_autoinc(uint64_t  auto_inc);
92
 
        UNIV_INTERN ulint innobase_initialize_autoinc();
93
 
        UNIV_INTERN dict_index_t* innobase_get_index(uint keynr);
94
 
        UNIV_INTERN uint64_t innobase_get_int_col_max_value(const Field* field);
 
92
        ulint innobase_initialize_autoinc();
 
93
        dict_index_t* innobase_get_index(uint keynr);
 
94
        uint64_t innobase_get_int_col_max_value(const Field* field);
95
95
 
96
96
        /* Init values for the class: */
97
97
 public:
98
 
        UNIV_INTERN ha_innobase(StorageEngine *engine, TableShare *table_arg);
99
 
        UNIV_INTERN ~ha_innobase();
 
98
        ha_innobase(StorageEngine *engine, TableShare *table_arg);
 
99
        ~ha_innobase();
100
100
        /*
101
101
          Get the row type from the storage engine.  If this method returns
102
102
          ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used.
103
103
        */
104
 
        UNIV_INTERN enum row_type get_row_type() const;
105
 
 
106
 
        UNIV_INTERN const char* index_type(uint key_number);
107
 
        UNIV_INTERN Table_flags table_flags() const;
108
 
        UNIV_INTERN uint32_t index_flags(uint idx, uint part, bool all_parts) const;
109
 
        UNIV_INTERN uint32_t max_supported_keys() const;
110
 
        UNIV_INTERN uint32_t max_supported_key_length() const;
111
 
        UNIV_INTERN uint32_t max_supported_key_part_length() const;
112
 
        UNIV_INTERN const key_map* keys_to_use_for_scanning();
113
 
 
114
 
        UNIV_INTERN int open(const char *name, int mode, uint test_if_locked);
115
 
        UNIV_INTERN int close(void);
116
 
        UNIV_INTERN double scan_time();
117
 
        UNIV_INTERN double read_time(uint index, uint ranges, ha_rows rows);
118
 
 
119
 
        UNIV_INTERN int write_row(unsigned char * buf);
120
 
        UNIV_INTERN int update_row(const unsigned char * old_data, unsigned char * new_data);
121
 
        UNIV_INTERN int delete_row(const unsigned char * buf);
122
 
        UNIV_INTERN bool was_semi_consistent_read();
123
 
        UNIV_INTERN void try_semi_consistent_read(bool yes);
124
 
        UNIV_INTERN void unlock_row();
 
104
        enum row_type get_row_type() const;
 
105
 
 
106
        const char* index_type(uint key_number);
 
107
        Table_flags table_flags() const;
 
108
        uint32_t index_flags(uint idx, uint part, bool all_parts) const;
 
109
        uint32_t max_supported_keys() const;
 
110
        uint32_t max_supported_key_length() const;
 
111
        uint32_t max_supported_key_part_length() const;
 
112
        const key_map* keys_to_use_for_scanning();
 
113
 
 
114
        int open(const char *name, int mode, uint test_if_locked);
 
115
        int close(void);
 
116
        double scan_time();
 
117
        double read_time(uint index, uint ranges, ha_rows rows);
 
118
 
 
119
        int write_row(unsigned char * buf);
 
120
        int update_row(const unsigned char * old_data, unsigned char * new_data);
 
121
        int delete_row(const unsigned char * buf);
 
122
        bool was_semi_consistent_read();
 
123
        void try_semi_consistent_read(bool yes);
 
124
        void unlock_row();
125
125
 
126
126
#ifdef ROW_MERGE_IS_INDEX_USABLE
127
127
        /** Check if an index can be used by this transaction.
131
131
        *               in the read view of this transaction */
132
132
        bool is_index_available(uint keynr);
133
133
#endif /* ROW_MERGE_IS_INDEX_USABLE */
134
 
        UNIV_INTERN int index_init(uint index, bool sorted);
135
 
        UNIV_INTERN int index_end();
136
 
        UNIV_INTERN int index_read(unsigned char * buf, 
137
 
                const unsigned char * key, uint key_len, 
138
 
                enum ha_rkey_function find_flag);
139
 
        UNIV_INTERN int index_read_idx(unsigned char * buf, uint index, const unsigned char * key,
 
134
        int index_init(uint index, bool sorted);
 
135
        int index_end();
 
136
        int index_read(unsigned char * buf, const unsigned char * key,
 
137
                uint key_len, enum ha_rkey_function find_flag);
 
138
        int index_read_idx(unsigned char * buf, uint index, const unsigned char * key,
140
139
                           uint key_len, enum ha_rkey_function find_flag);
141
 
        UNIV_INTERN int index_read_last(unsigned char * buf, const unsigned char * key, uint key_len);
142
 
        UNIV_INTERN int index_next(unsigned char * buf);
143
 
        UNIV_INTERN int index_next_same(unsigned char * buf, const unsigned char *key, uint keylen);
144
 
        UNIV_INTERN int index_prev(unsigned char * buf);
145
 
        UNIV_INTERN int index_first(unsigned char * buf);
146
 
        UNIV_INTERN int index_last(unsigned char * buf);
147
 
 
148
 
        UNIV_INTERN int rnd_init(bool scan);
149
 
        UNIV_INTERN int rnd_end();
150
 
        UNIV_INTERN int rnd_next(unsigned char *buf);
151
 
        UNIV_INTERN int rnd_pos(unsigned char * buf, unsigned char *pos);
152
 
 
153
 
        UNIV_INTERN void position(const unsigned char *record);
154
 
        UNIV_INTERN int info(uint);
155
 
        UNIV_INTERN int analyze(Session* session,HA_CHECK_OPT* check_opt);
156
 
        UNIV_INTERN int optimize(Session* session,HA_CHECK_OPT* check_opt);
157
 
        UNIV_INTERN int discard_or_import_tablespace(bool discard);
158
 
        UNIV_INTERN int extra(enum ha_extra_function operation);
159
 
        UNIV_INTERN int reset();
160
 
        UNIV_INTERN int external_lock(Session *session, int lock_type);
161
 
        UNIV_INTERN int start_stmt(Session *session, thr_lock_type lock_type);
 
140
        int index_read_last(unsigned char * buf, const unsigned char * key, uint key_len);
 
141
        int index_next(unsigned char * buf);
 
142
        int index_next_same(unsigned char * buf, const unsigned char *key, uint keylen);
 
143
        int index_prev(unsigned char * buf);
 
144
        int index_first(unsigned char * buf);
 
145
        int index_last(unsigned char * buf);
 
146
 
 
147
        int rnd_init(bool scan);
 
148
        int rnd_end();
 
149
        int rnd_next(unsigned char *buf);
 
150
        int rnd_pos(unsigned char * buf, unsigned char *pos);
 
151
 
 
152
        void position(const unsigned char *record);
 
153
        int info(uint);
 
154
        int analyze(Session* session,HA_CHECK_OPT* check_opt);
 
155
        int optimize(Session* session,HA_CHECK_OPT* check_opt);
 
156
        int discard_or_import_tablespace(bool discard);
 
157
        int extra(enum ha_extra_function operation);
 
158
        int reset();
 
159
        int external_lock(Session *session, int lock_type);
 
160
        int start_stmt(Session *session, thr_lock_type lock_type);
162
161
        void position(unsigned char *record);
163
 
        UNIV_INTERN ha_rows records_in_range(uint inx, key_range *min_key, key_range
 
162
        ha_rows records_in_range(uint inx, key_range *min_key, key_range
164
163
                                                                *max_key);
165
 
        UNIV_INTERN ha_rows estimate_rows_upper_bound();
 
164
        ha_rows estimate_rows_upper_bound();
166
165
 
167
 
        UNIV_INTERN void update_create_info(HA_CREATE_INFO* create_info);
168
 
        UNIV_INTERN int delete_all_rows();
169
 
        UNIV_INTERN int check(Session* session, HA_CHECK_OPT* check_opt);
170
 
        UNIV_INTERN char* update_table_comment(const char* comment);
171
 
        UNIV_INTERN char* get_foreign_key_create_info();
172
 
        UNIV_INTERN int get_foreign_key_list(Session *session, List<FOREIGN_KEY_INFO> *f_key_list);
173
 
        UNIV_INTERN bool can_switch_engines();
174
 
        UNIV_INTERN uint referenced_by_foreign_key();
175
 
        UNIV_INTERN void free_foreign_key_create_info(char* str);
176
 
        UNIV_INTERN THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
 
166
        void update_create_info(HA_CREATE_INFO* create_info);
 
167
        int delete_all_rows();
 
168
        int check(Session* session, HA_CHECK_OPT* check_opt);
 
169
        char* update_table_comment(const char* comment);
 
170
        char* get_foreign_key_create_info();
 
171
        int get_foreign_key_list(Session *session, List<FOREIGN_KEY_INFO> *f_key_list);
 
172
        bool can_switch_engines();
 
173
        uint referenced_by_foreign_key();
 
174
        void free_foreign_key_create_info(char* str);
 
175
        THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
177
176
                                        enum thr_lock_type lock_type);
178
 
        UNIV_INTERN void init_table_handle_for_HANDLER();
179
 
        UNIV_INTERN virtual void get_auto_increment(uint64_t offset, 
180
 
                                                    uint64_t increment,
181
 
                                                    uint64_t nb_desired_values,
182
 
                                                    uint64_t *first_value,
183
 
                                                    uint64_t *nb_reserved_values);
184
 
        UNIV_INTERN int reset_auto_increment(uint64_t value);
185
 
 
186
 
        UNIV_INTERN virtual bool get_error_message(int error, String *buf);
187
 
 
188
 
        UNIV_INTERN bool primary_key_is_clustered();
189
 
        UNIV_INTERN int cmp_ref(const unsigned char *ref1, const unsigned char *ref2);
 
177
        void init_table_handle_for_HANDLER();
 
178
        virtual void get_auto_increment(uint64_t offset, uint64_t increment,
 
179
                                        uint64_t nb_desired_values,
 
180
                                        uint64_t *first_value,
 
181
                                        uint64_t *nb_reserved_values);
 
182
        int reset_auto_increment(uint64_t value);
 
183
 
 
184
        virtual bool get_error_message(int error, String *buf);
 
185
 
 
186
        bool primary_key_is_clustered();
 
187
        int cmp_ref(const unsigned char *ref1, const unsigned char *ref2);
190
188
        /** Fast index creation (smart ALTER TABLE) @see handler0alter.cc @{ */
191
 
        UNIV_INTERN int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys);
192
 
        UNIV_INTERN int prepare_drop_index(TABLE *table_arg, uint *key_num,
193
 
                                           uint num_of_keys);
194
 
        UNIV_INTERN int final_drop_index(TABLE *table_arg);
 
189
        int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys);
 
190
        int prepare_drop_index(TABLE *table_arg, uint *key_num,
 
191
                               uint num_of_keys);
 
192
        int final_drop_index(TABLE *table_arg);
195
193
        /** @} */
196
194
public:
 
195
  /**
 
196
   * Multi Range Read interface
 
197
   */
 
198
  int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
 
199
                            uint32_t n_ranges, uint32_t mode,
 
200
                            HANDLER_BUFFER *buf);
 
201
  int multi_range_read_next(char **range_info);
 
202
  ha_rows multi_range_read_info_const(uint32_t keyno, RANGE_SEQ_IF *seq,
 
203
                                      void *seq_init_param,
 
204
                                      uint32_t n_ranges, uint32_t *bufsz,
 
205
                                      uint32_t *flags, COST_VECT *cost);
 
206
  int multi_range_read_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys,
 
207
                            uint32_t *bufsz, uint32_t *flags, COST_VECT *cost);
 
208
  DsMrr_impl ds_mrr;
 
209
 
197
210
  int read_range_first(const key_range *start_key, const key_range *end_key,
198
211
                       bool eq_range_arg, bool sorted);
199
212
  int read_range_next();
251
264
Converts an InnoDB error code to a MySQL error code and also tells to MySQL
252
265
about a possible transaction rollback inside InnoDB caused by a lock wait
253
266
timeout or a deadlock. */
254
 
extern "C" UNIV_INTERN
 
267
extern "C"
255
268
int
256
269
convert_error_code_to_mysql(
257
270
/*========================*/
262
275
 
263
276
/*************************************************************************
264
277
Allocates an InnoDB transaction for a MySQL handler object. */
265
 
extern "C" UNIV_INTERN
 
278
extern "C"
266
279
trx_t*
267
280
innobase_trx_allocate(
268
281
/*==================*/