#include <ha_innodb.h>
Public Types | |
enum | { NONE = 0, INDEX, RND } |
Public Member Functions | |
UNIV_INTERN | ha_innobase (plugin::StorageEngine &engine, Table &table_arg) |
UNIV_INTERN | ~ha_innobase () |
UNIV_INTERN plugin::TransactionalStorageEngine * | getTransactionalEngine () |
UNIV_INTERN const char * | index_type (uint key_number) |
UNIV_INTERN const key_map * | keys_to_use_for_scanning () |
UNIV_INTERN int | doOpen (const drizzled::identifier::Table &identifier, int mode, uint test_if_locked) |
UNIV_INTERN int | close (void) |
UNIV_INTERN double | scan_time () |
UNIV_INTERN double | read_time (uint index, uint ranges, ha_rows rows) |
UNIV_INTERN int | doInsertRecord (unsigned char *buf) |
UNIV_INTERN int | doUpdateRecord (const unsigned char *old_data, unsigned char *new_data) |
UNIV_INTERN int | doDeleteRecord (const unsigned char *buf) |
UNIV_INTERN bool | was_semi_consistent_read () |
UNIV_INTERN void | try_semi_consistent_read (bool yes) |
UNIV_INTERN void | unlock_row () |
UNIV_INTERN int | doStartIndexScan (uint index, bool sorted) |
UNIV_INTERN int | doEndIndexScan () |
UNIV_INTERN int | index_read (unsigned char *buf, const unsigned char *key, uint key_len, enum ha_rkey_function find_flag) |
UNIV_INTERN int | index_read_idx (unsigned char *buf, uint index, const unsigned char *key, uint key_len, enum ha_rkey_function find_flag) |
UNIV_INTERN int | index_read_last (unsigned char *buf, const unsigned char *key, uint key_len) |
UNIV_INTERN int | index_next (unsigned char *buf) |
UNIV_INTERN int | index_next_same (unsigned char *buf, const unsigned char *key, uint keylen) |
UNIV_INTERN int | index_prev (unsigned char *buf) |
UNIV_INTERN int | index_first (unsigned char *buf) |
UNIV_INTERN int | index_last (unsigned char *buf) |
UNIV_INTERN int | doStartTableScan (bool scan) |
UNIV_INTERN int | doEndTableScan () |
UNIV_INTERN int | rnd_next (unsigned char *buf) |
UNIV_INTERN int | rnd_pos (unsigned char *buf, unsigned char *pos) |
UNIV_INTERN void | position (const unsigned char *record) |
UNIV_INTERN int | info (uint) |
UNIV_INTERN int | analyze (Session *session) |
UNIV_INTERN int | discard_or_import_tablespace (bool discard) |
UNIV_INTERN int | extra (enum ha_extra_function operation) |
UNIV_INTERN int | reset () |
UNIV_INTERN int | external_lock (Session *session, int lock_type) |
void | position (unsigned char *record) |
UNIV_INTERN ha_rows | records_in_range (uint inx, key_range *min_key, key_range *max_key) |
UNIV_INTERN ha_rows | estimate_rows_upper_bound () |
UNIV_INTERN int | delete_all_rows () |
UNIV_INTERN int | check (Session *session) |
UNIV_INTERN char * | update_table_comment (const char *comment) |
UNIV_INTERN char * | get_foreign_key_create_info () |
UNIV_INTERN int | get_foreign_key_list (Session *session, List< ForeignKeyInfo > *f_key_list) |
UNIV_INTERN bool | can_switch_engines () |
UNIV_INTERN uint | referenced_by_foreign_key () |
UNIV_INTERN void | free_foreign_key_create_info (char *str) |
UNIV_INTERN THR_LOCK_DATA ** | store_lock (Session *session, THR_LOCK_DATA **to, enum thr_lock_type lock_type) |
virtual UNIV_INTERN void | get_auto_increment (uint64_t offset, uint64_t increment, uint64_t nb_desired_values, uint64_t *first_value, uint64_t *nb_reserved_values) |
UNIV_INTERN int | reset_auto_increment (uint64_t value) |
UNIV_INTERN bool | primary_key_is_clustered () |
UNIV_INTERN int | cmp_ref (const unsigned char *ref1, const unsigned char *ref2) |
int | read_range_first (const key_range *start_key, const key_range *end_key, bool eq_range_arg, bool sorted) |
int | read_range_next () |
plugin::StorageEngine * | getEngine () const |
TableShare * | getShare () |
Table * | getTable () const |
uint64_t | getNextInsertId () |
uint64_t | getAutoIncrement () |
virtual Cursor * | clone (memory::Root *mem_root) |
int | ha_open (const identifier::Table &identifier, int mode, int test_if_locked) |
int | startIndexScan (uint32_t idx, bool sorted) __attribute__((warn_unused_result)) |
int | endIndexScan () |
int | startTableScan (bool scan) __attribute__((warn_unused_result)) |
int | endTableScan () |
int | ha_reset () |
int | ha_index_or_rnd_end () |
int | ha_external_lock (Session *session, int lock_type) |
int | insertRecord (unsigned char *buf) __attribute__((warn_unused_result)) |
int | updateRecord (const unsigned char *old_data, unsigned char *new_data) __attribute__((warn_unused_result)) |
int | deleteRecord (const unsigned char *buf) __attribute__((warn_unused_result)) |
void | ha_release_auto_increment () |
int | ha_check (Session *session, HA_CHECK_OPT *check_opt) |
void | ha_start_bulk_insert (ha_rows rows) |
int | ha_end_bulk_insert () |
int | ha_delete_all_rows () |
int | ha_reset_auto_increment (uint64_t value) |
int | ha_analyze (Session *session, HA_CHECK_OPT *check_opt) |
int | ha_disable_indexes (uint32_t mode) |
int | ha_enable_indexes (uint32_t mode) |
int | ha_discard_or_import_tablespace (bool discard) |
void | closeMarkForDelete (const char *name) |
void | adjust_next_insert_id_after_explicit_value (uint64_t nr) |
int | update_auto_increment () |
virtual double | read_time (uint32_t, uint32_t ranges, ha_rows rows) |
virtual double | index_only_read_time (uint32_t keynr, double records) |
virtual ha_rows | multi_range_read_info_const (uint32_t keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint32_t n_ranges, uint32_t *bufsz, uint32_t *flags, optimizer::CostVector *cost) |
virtual int | multi_range_read_info (uint32_t keyno, uint32_t n_ranges, uint32_t keys, uint32_t *bufsz, uint32_t *flags, optimizer::CostVector *cost) |
virtual int | multi_range_read_init (RANGE_SEQ_IF *seq, void *seq_init_param, uint32_t n_ranges, uint32_t mode) |
virtual int | multi_range_read_next (char **range_info) |
bool | has_transactions () |
virtual bool | is_fatal_error (int error, uint32_t flags) |
virtual ha_rows | records () |
virtual uint64_t | tableSize () |
virtual uint64_t | rowSize () |
virtual const char * | index_type (uint32_t) |
uint32_t | get_index (void) const |
virtual int | index_read_map (unsigned char *buf, const unsigned char *key, key_part_map keypart_map, enum ha_rkey_function find_flag) |
Positions an index cursor to the index specified in the handle. Fetches the row if available. If the key value is null, begin at the first key of the index. | |
virtual int | index_read_idx_map (unsigned char *buf, uint32_t index, const unsigned char *key, key_part_map keypart_map, enum ha_rkey_function find_flag) |
Positions an index cursor to the index specified in the handle. Fetches the row if available. If the key value is null, begin at the first key of the index. | |
virtual int | index_next_same (unsigned char *, const unsigned char *, uint32_t) |
virtual int | index_read_last_map (unsigned char *buf, const unsigned char *key, key_part_map keypart_map) |
The following functions works like index_read, but it find the last row with the current key value or prefix. | |
int | compare_key (key_range *range) |
virtual int | read_first_row (unsigned char *buf, uint32_t primary_key) |
virtual int | rnd_same (unsigned char *, uint32_t) |
virtual ha_rows | records_in_range (uint32_t, key_range *, key_range *) |
virtual int | info (uint32_t)=0 |
virtual uint32_t | calculate_key_hash_value (Field **) |
virtual int | extra_opt (enum ha_extra_function operation, uint32_t) |
void | set_next_insert_id (uint64_t id) |
void | restore_auto_increment (uint64_t prev_insert_id) |
virtual int | indexes_are_disabled (void) |
virtual void | append_create_info (String *) |
virtual bool | isOrdered (void) |
Public Attributes | |
unsigned char * | ref |
unsigned char * | dup_ref |
ha_statistics | stats |
range_seq_t | mrr_iter |
RANGE_SEQ_IF | mrr_funcs |
uint32_t | ranges_in_seq |
bool | mrr_is_output_sorted |
bool | mrr_have_range |
bool | eq_range |
KEY_MULTI_RANGE | mrr_cur_range |
key_range | save_end_range |
key_range * | end_range |
KeyPartInfo * | range_key_part |
int | key_compare_result_on_equal |
uint32_t | errkey |
uint32_t | key_used_on_scan |
uint32_t | active_index |
uint32_t | ref_length |
enum drizzled::Cursor:: { ... } | inited |
bool | locked |
uint64_t | next_insert_id |
uint64_t | insert_id_for_cur_row |
Discrete_interval | auto_inc_interval_for_cur_row |
Protected Member Functions | |
void | ha_statistic_increment (uint64_t system_status_var::*offset) const |
void ** | ha_data (Session *) const |
Protected Attributes | |
ha_rows | estimation_rows_to_insert |
Private Member Functions | |
UNIV_INTERN uint | store_key_val_for_row (uint keynr, char *buff, uint buff_len, const unsigned char *record) |
UNIV_INTERN void | update_session (Session *session) |
UNIV_INTERN int | change_active_index (uint32_t keynr) |
UNIV_INTERN int | general_fetch (unsigned char *buf, uint32_t direction, uint32_t match_mode) |
UNIV_INTERN ulint | innobase_lock_autoinc () |
UNIV_INTERN uint64_t | innobase_peek_autoinc () |
UNIV_INTERN ulint | innobase_set_max_autoinc (uint64_t auto_inc) |
UNIV_INTERN ulint | innobase_reset_autoinc (uint64_t auto_inc) |
UNIV_INTERN ulint | innobase_get_autoinc (uint64_t *value) |
ulint | innobase_update_autoinc (uint64_t auto_inc) |
UNIV_INTERN void | innobase_initialize_autoinc () |
UNIV_INTERN dict_index_t * | innobase_get_index (uint keynr) |
Private Attributes | |
row_prebuilt_t * | prebuilt |
Session * | user_session |
THR_LOCK_DATA | lock |
INNOBASE_SHARE * | share |
std::vector< unsigned char > | upd_buff |
std::vector< unsigned char > | key_val_buff |
ulong | upd_and_key_val_buff_len |
uint | primary_key |
ulong | start_of_scan |
uint | last_match_mode |
uint | num_write_row |
The class defining a handle to an Innodb table
Definition at line 80 of file ha_innodb.h.
UNIV_INTERN ha_innobase::ha_innobase | ( | plugin::StorageEngine & | engine_arg, |
Table & | table_arg | ||
) |
Construct ha_innobase Cursor.
Definition at line 1580 of file ha_innodb.cc.
UNIV_INTERN ha_innobase::~ha_innobase | ( | ) |
Destruct ha_innobase Cursor.
Definition at line 1594 of file ha_innodb.cc.
UNIV_INTERN int ha_innobase::analyze | ( | Session * | session | ) | [virtual] |
Updates index cardinalities of the table, based on 8 random dives into each index tree. This does NOT calculate exact statistics on the table.
session | in: connection thread handle |
Reimplemented from drizzled::Cursor.
Definition at line 7329 of file ha_innodb.cc.
References info().
UNIV_INTERN bool ha_innobase::can_switch_engines | ( | void | ) | [virtual] |
Checks if ALTER TABLE may change the storage engine of the table. Changing storage engines is not allowed for tables for which there are foreign key constraints (parent or child tables).
Reimplemented from drizzled::Cursor.
Definition at line 7778 of file ha_innodb.cc.
References dict_table_struct::foreign_list, trx_struct::op_info, prebuilt, dict_table_struct::referenced_list, row_mysql_unlock_data_dictionary(), session_to_trx(), row_prebuilt_struct::table, row_prebuilt_struct::trx, ut_a, and UT_LIST_GET_FIRST.
UNIV_INTERN int ha_innobase::change_active_index | ( | uint32_t | keynr | ) | [private] |
Changes the active index of a handle.
Definition at line 5286 of file ha_innodb.cc.
References build_template(), row_prebuilt_struct::index, row_prebuilt_struct::index_usable, innobase_get_index(), dict_index_struct::n_fields, prebuilt, row_merge_is_index_usable(), row_prebuilt_struct::search_tuple, session_to_trx(), row_prebuilt_struct::trx, user_session, ut_a, and ut_ad.
Referenced by doStartIndexScan(), doStartTableScan(), index_read_idx(), and rnd_pos().
UNIV_INTERN int ha_innobase::check | ( | Session * | session | ) | [virtual] |
Tries to check that an InnoDB table is not corrupted. If corruption is noticed, prints to stderr information about it. In case of corruption may also assert a failure and crash the server.
session | in: user thread handle |
Reimplemented from drizzled::Cursor.
Definition at line 7346 of file ha_innodb.cc.
References build_template(), dict_table_struct::ibd_file_missing, row_prebuilt_struct::index, row_prebuilt_struct::index_usable, row_prebuilt_struct::mysql_template, row_prebuilt_struct::n_template, dict_index_struct::name, dict_table_struct::name, row_prebuilt_struct::need_to_access_clustered, trx_struct::op_info, prebuilt, row_check_index_for_mysql(), row_merge_is_index_usable(), row_prebuilt_struct::search_tuple, row_prebuilt_struct::select_lock_type, session_to_trx(), row_prebuilt_struct::sql_stat_start, row_prebuilt_struct::table, row_prebuilt_struct::template_type, row_prebuilt_struct::trx, user_session, ut_a, and ut_print_name().
UNIV_INTERN int ha_innobase::close | ( | void | ) | [virtual] |
Closes a handle to an InnoDB table.
Implements drizzled::Cursor.
Definition at line 3524 of file ha_innodb.cc.
References getTransactionalEngine(), drizzled::Table::in_use, key_val_buff, prebuilt, row_prebuilt_free(), share, srv_active_wake_master_thread(), and upd_buff.
void drizzled::Cursor::closeMarkForDelete | ( | const char * | name | ) | [inherited] |
Drop table in the engine: public interface.
Definition at line 799 of file cursor.cc.
References drizzled::Cursor::setTransactionReadWrite().
UNIV_INTERN int ha_innobase::cmp_ref | ( | const unsigned char * | ref1, |
const unsigned char * | ref2 | ||
) | [virtual] |
Compares two 'refs'. A 'ref' is the (internal) primary key value of the row. If there is no explicitly declared non-null unique key or a primary key, then InnoDB internally uses the row id as the primary key.
ref1 | in: an (internal) primary key value in the MySQL key value format |
ref2 | in: an (internal) primary key value in the MySQL key value format |
Reimplemented from drizzled::Cursor.
Definition at line 8722 of file ha_innodb.cc.
References row_prebuilt_struct::clust_index_was_generated, innobase_read_from_2_little_endian(), drizzled::Table::key_info, and prebuilt.
int drizzled::Cursor::compare_key | ( | key_range * | range | ) | [inherited] |
Compare if found key (in row) is over max-value.
range | range to compare to row. May be 0 for no range |
key.cc::key_cmp()
Definition at line 1256 of file cursor.cc.
References drizzled::key_cmp().
Referenced by drizzled::Cursor::read_range_first(), and drizzled::Cursor::read_range_next().
UNIV_INTERN int ha_innobase::delete_all_rows | ( | void | ) | [virtual] |
Deletes all rows of an InnoDB table.
Reimplemented from drizzled::Cursor.
Definition at line 6385 of file ha_innodb.cc.
References convert_error_code_to_mysql(), dict_table_struct::flags, prebuilt, row_truncate_table_for_mysql(), row_prebuilt_struct::table, row_prebuilt_struct::trx, update_session(), and user_session.
UNIV_INTERN int ha_innobase::discard_or_import_tablespace | ( | bool | discard | ) | [virtual] |
Discards or imports an InnoDB tablespace.
Reimplemented from drizzled::Cursor.
Definition at line 6354 of file ha_innodb.cc.
References convert_error_code_to_mysql(), dict_table_struct::flags, dict_table_struct::name, prebuilt, row_discard_tablespace_for_mysql(), row_import_tablespace_for_mysql(), session_to_trx(), row_prebuilt_struct::table, row_prebuilt_struct::trx, and ut_a.
UNIV_INTERN int ha_innobase::doDeleteRecord | ( | const unsigned char * | record | ) | [virtual] |
Deletes a row given as the parameter.
record | in: a row in MySQL format |
Reimplemented from drizzled::Cursor.
Definition at line 4844 of file ha_innodb.cc.
References convert_error_code_to_mysql(), dict_table_struct::flags, trx_struct::id, innobase_active_small(), innodb_srv_conc_enter_innodb(), innodb_srv_conc_exit_innodb(), prebuilt, row_get_prebuilt_update_vector(), row_update_for_mysql(), session_to_trx(), row_prebuilt_struct::table, row_prebuilt_struct::trx, row_prebuilt_struct::upd_node, user_session, and ut_a.
UNIV_INTERN int ha_innobase::doEndIndexScan | ( | void | ) | [virtual] |
Currently does nothing.
Reimplemented from drizzled::Cursor.
Definition at line 4964 of file ha_innodb.cc.
Referenced by doEndTableScan().
UNIV_INTERN int ha_innobase::doEndTableScan | ( | void | ) | [virtual] |
Ends a table scan.
Reimplemented from drizzled::Cursor.
Definition at line 5546 of file ha_innodb.cc.
References doEndIndexScan().
UNIV_INTERN int ha_innobase::doInsertRecord | ( | unsigned char * | record | ) | [virtual] |
Stores a row in an InnoDB database, to the table specified in this handle.
record | in: a row in MySQL format |
Reimplemented from drizzled::Cursor.
Definition at line 4314 of file ha_innodb.cc.
References row_prebuilt_struct::autoinc_error, row_prebuilt_struct::autoinc_increment, row_prebuilt_struct::autoinc_last_value, build_template(), convert_error_code_to_mysql(), trx_struct::duplicates, dict_table_struct::flags, getTransactionalEngine(), trx_struct::id, innobase_active_small(), innobase_get_int_col_max_value(), innobase_next_autoinc(), innobase_set_max_autoinc(), innodb_srv_conc_enter_innodb(), innodb_srv_conc_exit_innodb(), lock_get_src_table(), lock_is_table_exclusive(), row_prebuilt_struct::mysql_template, trx_struct::n_autoinc_rows, drizzled::Table::next_number_field, num_write_row, prebuilt, row_insert_for_mysql(), row_lock_table_for_mysql(), session_to_trx(), row_prebuilt_struct::sql_stat_start, row_prebuilt_struct::table, row_prebuilt_struct::template_type, row_prebuilt_struct::trx, user_session, ut_a, ut_error, and ut_print_buf().
UNIV_INTERN int ha_innobase::doOpen | ( | const drizzled::identifier::Table & | identifier, |
int | mode, | ||
uint | test_if_locked | ||
) |
Creates and opens a handle to a table which already exists in an InnoDB database.
mode | in: not used |
test_if_locked | in: not used |
Definition at line 3230 of file ha_innodb.cc.
References row_prebuilt_struct::clust_index_was_generated, row_prebuilt_struct::default_rec, dict_index_is_clust(), dict_table_get_format(), get_share(), getTransactionalEngine(), dict_table_struct::ibd_file_missing, drizzled::Table::in_use, info(), innobase_build_index_translation(), innobase_get_index(), innobase_initialize_autoinc(), drizzled::Table::key_info, key_val_buff, st_innobase_share::lock, row_prebuilt_struct::mysql_row_len, prebuilt, drizzled::Cursor::ref_length, row_create_prebuilt(), row_table_got_default_clust_index(), share, row_prebuilt_struct::table, trx_sys_file_format_max_upgrade(), upd_buff, user_session, ut_ad, and UT_NOT_USED.
UNIV_INTERN int ha_innobase::doStartIndexScan | ( | uint | keynr, |
bool | sorted | ||
) |
Initializes a handle to use an index.
keynr | in: key (index) number |
sorted | in: 1 if result MUST be sorted according to index |
Definition at line 4951 of file ha_innodb.cc.
References change_active_index().
UNIV_INTERN int ha_innobase::doStartTableScan | ( | bool | scan | ) | [virtual] |
Initialize a table scan.
scan | in: TRUE if table/index scan FALSE otherwise |
Implements drizzled::Cursor.
Definition at line 5514 of file ha_innodb.cc.
References change_active_index(), row_prebuilt_struct::clust_index_was_generated, prebuilt, start_of_scan, and try_semi_consistent_read().
UNIV_INTERN int ha_innobase::doUpdateRecord | ( | const unsigned char * | old_row, |
unsigned char * | new_row | ||
) | [virtual] |
Updates a row given as a parameter to a new value. Note that we are given whole rows, not just the fields which are updated: this incurs some overhead for CPU when we check which fields are actually updated. TODO: currently InnoDB does not prevent the 'Halloween problem': in a searched update a single row can get updated several times if its index columns are updated!
old_row | in: old row in MySQL format |
new_row | in: new row in MySQL format |
Reimplemented from drizzled::Cursor.
Definition at line 4706 of file ha_innodb.cc.
References row_prebuilt_struct::autoinc_increment, calc_row_difference(), convert_error_code_to_mysql(), trx_struct::duplicates, dict_table_struct::flags, drizzled::Table::found_next_number_field, trx_struct::id, innobase_active_small(), innobase_get_autoinc(), innobase_get_int_col_max_value(), innobase_next_autoinc(), innobase_set_max_autoinc(), innodb_srv_conc_enter_innodb(), innodb_srv_conc_exit_innodb(), upd_struct::n_fields, drizzled::Table::next_number_field, prebuilt, row_get_prebuilt_update_vector(), row_update_for_mysql(), session_to_trx(), row_prebuilt_struct::table, row_prebuilt_struct::template_type, row_prebuilt_struct::trx, upd_buff, row_prebuilt_struct::upd_node, upd_node_struct::update, user_session, and ut_a.
UNIV_INTERN ha_rows ha_innobase::estimate_rows_upper_bound | ( | void | ) | [virtual] |
Gives an UPPER BOUND to the number of rows in a table. This is used in filesort.cc.
Reimplemented from drizzled::Cursor.
Definition at line 6841 of file ha_innodb.cc.
References trx_struct::op_info, prebuilt, dict_index_struct::stat_n_leaf_pages, row_prebuilt_struct::table, row_prebuilt_struct::trx, trx_search_latch_release_if_reserved(), update_session(), and ut_a.
Referenced by read_time().
UNIV_INTERN int ha_innobase::external_lock | ( | Session * | session, |
int | lock_type | ||
) | [virtual] |
As MySQL will execute an external lock for every new table it uses when it starts to process an SQL statement. We can use this function to store the pointer to the Session in the handle.
session | in: handle to the user thread |
lock_type | in: lock type |
Reimplemented from drizzled::Cursor.
Definition at line 7934 of file ha_innodb.cc.
References row_prebuilt_struct::hint_need_to_fetch_extra_cols, row_prebuilt_struct::mysql_has_locked, prebuilt, reset_template(), row_prebuilt_struct::select_lock_type, row_prebuilt_struct::sql_stat_start, row_prebuilt_struct::stored_select_lock_type, row_prebuilt_struct::trx, and update_session().
UNIV_INTERN int ha_innobase::extra | ( | enum ha_extra_function | operation | ) | [virtual] |
Tells something additional to the Cursor about how to do things.
operation | in: HA_EXTRA_FLUSH or some other flag |
Reimplemented from drizzled::Cursor.
Definition at line 7836 of file ha_innodb.cc.
References row_prebuilt_struct::blob_heap, trx_struct::duplicates, row_prebuilt_struct::keep_other_fields_on_keyread, prebuilt, row_prebuilt_struct::read_just_key, reset_template(), row_mysql_prebuilt_free_blob_heap(), and session_to_trx().
UNIV_INTERN void ha_innobase::free_foreign_key_create_info | ( | char * | str | ) | [virtual] |
Frees the foreign key create info for a table stored in InnoDB, if it is non-NULL.
str | in, own: create info string to free |
Reimplemented from drizzled::Cursor.
Definition at line 7822 of file ha_innodb.cc.
UNIV_INTERN int ha_innobase::general_fetch | ( | unsigned char * | buf, |
uint32_t | direction, | ||
uint32_t | match_mode | ||
) | [private] |
Reads the next or previous row from a cursor, which must have previously been positioned using index_read.
Definition at line 5369 of file ha_innodb.cc.
References convert_error_code_to_mysql(), dict_table_struct::flags, innodb_srv_conc_enter_innodb(), innodb_srv_conc_exit_innodb(), prebuilt, row_search_for_mysql(), session_to_trx(), row_prebuilt_struct::table, row_prebuilt_struct::trx, user_session, and ut_a.
Referenced by index_next(), index_next_same(), index_prev(), and rnd_next().
UNIV_INTERN void ha_innobase::get_auto_increment | ( | uint64_t | offset, |
uint64_t | increment, | ||
uint64_t | nb_desired_values, | ||
uint64_t * | first_value, | ||
uint64_t * | nb_reserved_values | ||
) | [virtual] |
This function initializes the auto-inc counter if it has not been initialized yet. This function does not change the value of the auto-inc counter if it already has been initialized. Returns the value of the auto-inc counter in *first_value, and UINT64_T_MAX in *nb_reserved_values (as we have a table-level lock). offset, increment, nb_desired_values are ignored. first_value is set to -1 if error (deadlock or lock wait timeout)
offset | in: table autoinc offset |
increment | in: table autoinc increment |
nb_desired_values | in: number of values reqd |
first_value | out: the autoinc value |
nb_reserved_values | out: count of reserved values |
Implements drizzled::Cursor.
Definition at line 8567 of file ha_innodb.cc.
References row_prebuilt_struct::autoinc_increment, row_prebuilt_struct::autoinc_last_value, innobase_get_autoinc(), innobase_get_int_col_max_value(), innobase_next_autoinc(), trx_struct::n_autoinc_rows, prebuilt, row_prebuilt_struct::table, row_prebuilt_struct::trx, update_session(), and ut_a.
UNIV_INTERN char * ha_innobase::get_foreign_key_create_info | ( | void | ) | [virtual] |
Gets the foreign key create info for a table stored in InnoDB.
Reimplemented from drizzled::Cursor.
Definition at line 7586 of file ha_innodb.cc.
References trx_struct::op_info, prebuilt, row_prebuilt_struct::table, row_prebuilt_struct::trx, trx_search_latch_release_if_reserved(), update_session(), and ut_a.
UNIV_INTERN int ha_innobase::get_foreign_key_list | ( | Session * | , |
List< ForeignKeyInfo > * | |||
) | [virtual] |
used in REPLACE; is > 0 if table is referred by a FOREIGN KEY
Foreign id
Foreign Fields
Reimplemented from drizzled::Cursor.
Definition at line 7640 of file ha_innodb.cc.
References DICT_FOREIGN_ON_DELETE_CASCADE, DICT_FOREIGN_ON_DELETE_NO_ACTION, DICT_FOREIGN_ON_DELETE_SET_NULL, DICT_FOREIGN_ON_UPDATE_CASCADE, DICT_FOREIGN_ON_UPDATE_NO_ACTION, DICT_FOREIGN_ON_UPDATE_SET_NULL, dict_foreign_struct::foreign_col_names, dict_table_struct::foreign_list, dict_foreign_struct::id, dict_sys_struct::mutex, dict_foreign_struct::n_fields, dict_index_struct::name, trx_struct::op_info, prebuilt, dict_foreign_struct::referenced_col_names, dict_foreign_struct::referenced_index, dict_foreign_struct::referenced_table_name, row_prebuilt_struct::table, row_prebuilt_struct::trx, trx_search_latch_release_if_reserved(), dict_foreign_struct::type, update_session(), ut_a, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.
uint64_t drizzled::Cursor::getAutoIncrement | ( | ) | [inline, inherited] |
UNIV_INTERN plugin::TransactionalStorageEngine* ha_innobase::getTransactionalEngine | ( | ) | [inline] |
Returns the plugin::TransactionStorageEngine pointer of the cursor's underlying engine.
Have a TransactionalCursor subclass...
Definition at line 135 of file ha_innodb.h.
Referenced by close(), doInsertRecord(), and doOpen().
int drizzled::Cursor::ha_analyze | ( | Session * | session, |
HA_CHECK_OPT * | check_opt | ||
) | [inherited] |
Analyze table: public interface.
Definition at line 741 of file cursor.cc.
References drizzled::Cursor::setTransactionReadWrite().
int drizzled::Cursor::ha_check | ( | Session * | session, |
HA_CHECK_OPT * | check_opt | ||
) | [inherited] |
to be actually called to get 'check()' functionality
Performs checks upon the table.
session | thread doing CHECK Table operation |
check_opt | options from the parser |
int drizzled::Cursor::ha_delete_all_rows | ( | ) | [inherited] |
Delete all rows: public interface.
This is now equalivalent to TRUNCATE TABLE.
Trigger post-truncate notification to plugins...
Definition at line 696 of file cursor.cc.
References drizzled::Cursor::delete_all_rows(), drizzled::Table::in_use, drizzled::Cursor::setTransactionReadWrite(), drizzled::TransactionServices::singleton(), and drizzled::TransactionServices::truncateTable().
Referenced by drizzled::select_union::cleanup(), and drizzled::delete_query().
int drizzled::Cursor::ha_disable_indexes | ( | uint32_t | mode | ) | [inherited] |
Disable indexes: public interface.
Definition at line 755 of file cursor.cc.
References drizzled::Cursor::setTransactionReadWrite().
Referenced by drizzled::alter_table_manage_keys(), and drizzled::internal_alter_table().
int drizzled::Cursor::ha_discard_or_import_tablespace | ( | bool | discard | ) | [inherited] |
Discard or import tablespace: public interface.
Definition at line 785 of file cursor.cc.
References drizzled::Cursor::setTransactionReadWrite().
int drizzled::Cursor::ha_enable_indexes | ( | uint32_t | mode | ) | [inherited] |
Enable indexes: public interface.
Definition at line 770 of file cursor.cc.
References drizzled::Cursor::setTransactionReadWrite().
Referenced by drizzled::alter_table_manage_keys(), and drizzled::internal_alter_table().
int drizzled::Cursor::ha_external_lock | ( | Session * | session, |
int | lock_type | ||
) | [inherited] |
These functions represent the public interface to *users* of the Cursor class, hence they are *not* virtual. For the inheritance interface, see the (private) functions doInsertRecord(), doUpdateRecord(), and doDeleteRecord() below.
Definition at line 1387 of file cursor.cc.
References drizzled::Cursor::external_lock(), and drizzled::Cursor::next_insert_id.
int drizzled::Cursor::ha_open | ( | const identifier::Table & | identifier, |
int | mode, | ||
int | test_if_locked | ||
) | [inherited] |
Open database-Cursor.
Try O_RDONLY if cannot open as O_RDWR Don't wait for locks if not HA_OPEN_WAIT_IF_LOCKED is set
Definition at line 223 of file cursor.cc.
References drizzled::Table::db_stat, and drizzled::Cursor::ref_length.
void drizzled::Cursor::ha_release_auto_increment | ( | ) | [inherited] |
Reserves an interval of auto_increment values from the Cursor.
offset and increment means that we want values to be of the form offset + N * increment, where N>=0 is integer. If the function sets *first_value to ~(uint64_t)0 it means an error. If the function sets *nb_reserved_values to UINT64_MAX it means it has reserved to "positive infinite".
offset | |
increment | |
nb_desired_values | how many values we want |
first_value | (OUT) the first value reserved by the Cursor |
nb_reserved_values | (OUT) how many values the Cursor reserved |
Definition at line 608 of file cursor.cc.
References drizzled::Cursor::auto_inc_interval_for_cur_row, drizzled::Session::auto_inc_intervals_forced, drizzled::Table::in_use, drizzled::Cursor::insert_id_for_cur_row, and drizzled::Cursor::next_insert_id.
Referenced by drizzled::insert_query().
int drizzled::Cursor::ha_reset | ( | ) | [inherited] |
Check Cursor usage and reset state of file to after 'open'
Definition at line 1449 of file cursor.cc.
References drizzled::Cursor::reset().
Referenced by drizzled::Session::free_cached_table(), and drizzled::Session::mark_used_tables_as_free_for_reuse().
int drizzled::Cursor::ha_reset_auto_increment | ( | uint64_t | value | ) | [inherited] |
Reset auto increment: public interface.
Definition at line 726 of file cursor.cc.
References drizzled::Cursor::reset_auto_increment(), and drizzled::Cursor::setTransactionReadWrite().
Referenced by drizzled::delete_query().
UNIV_INTERN int ha_innobase::index_first | ( | unsigned char * | buf | ) | [virtual] |
Positions a cursor on the first record in an index and reads the corresponding row to buf.
buf | in/out: buffer for the row |
Reimplemented from drizzled::Cursor.
Definition at line 5465 of file ha_innodb.cc.
References index_read().
Referenced by rnd_next().
UNIV_INTERN int ha_innobase::index_last | ( | unsigned char * | buf | ) | [virtual] |
Positions a cursor on the last record in an index and reads the corresponding row to buf.
buf | in/out: buffer for the row |
Reimplemented from drizzled::Cursor.
Definition at line 5490 of file ha_innodb.cc.
References index_read().
UNIV_INTERN int ha_innobase::index_next | ( | unsigned char * | buf | ) | [virtual] |
Reads the next row from a cursor, which must have previously been positioned using index_read.
buf | in/out: buffer for next row in MySQL format |
Reimplemented from drizzled::Cursor.
Definition at line 5418 of file ha_innodb.cc.
References general_fetch(), and ROW_SEL_NEXT.
UNIV_INTERN int ha_innobase::index_next_same | ( | unsigned char * | buf, |
const unsigned char * | key, | ||
uint | keylen | ||
) |
Reads the next row matching to the key value given as the parameter.
buf | in/out: buffer for the row |
key | in: key value |
keylen | in: key value length |
Definition at line 5433 of file ha_innodb.cc.
References general_fetch(), and ROW_SEL_NEXT.
double drizzled::Cursor::index_only_read_time | ( | uint32_t | keynr, |
double | key_records | ||
) | [virtual, inherited] |
Calculate cost of 'index only' scan for given index and number of records
keynr | Index number |
records | Estimated number of records to be retrieved |
Definition at line 882 of file cursor.cc.
References drizzled::Table::key_info, and drizzled::Cursor::ref_length.
Referenced by drizzled::best_access_path(), drizzled::Cursor::multi_range_read_info(), and drizzled::Cursor::multi_range_read_info_const().
UNIV_INTERN int ha_innobase::index_prev | ( | unsigned char * | buf | ) | [virtual] |
Reads the previous row from a cursor, which must have previously been positioned using index_read.
buf | in/out: buffer for previous row in MySQL format |
Reimplemented from drizzled::Cursor.
Definition at line 5450 of file ha_innodb.cc.
References general_fetch(), and ROW_SEL_PREV.
UNIV_INTERN int ha_innobase::index_read | ( | unsigned char * | buf, |
const unsigned char * | key_ptr, | ||
uint | key_len, | ||
enum ha_rkey_function | find_flag | ||
) |
Positions an index cursor to the index specified in the handle. Fetches the row if any.
buf | in/out: buffer for the returned row |
key_ptr | in: key value; if this is NULL we position the cursor at the start or end of index; this can also contain an InnoDB row id, in which case key_len is the InnoDB row id length; the key value can also be a prefix of a full key value, and the last column can be a prefix of a full column |
key_len | in: key value length |
find_flag | in: search flags from my_base.h |
Definition at line 5092 of file ha_innodb.cc.
References build_template(), convert_error_code_to_mysql(), convert_search_mode_to_innobase(), dict_table_struct::flags, row_prebuilt_struct::index, row_prebuilt_struct::index_usable, innodb_srv_conc_enter_innodb(), innodb_srv_conc_exit_innodb(), key_val_buff, prebuilt, row_search_for_mysql(), row_sel_convert_mysql_key_to_innobase(), ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX, row_prebuilt_struct::search_tuple, session_to_trx(), row_prebuilt_struct::sql_stat_start, row_prebuilt_struct::table, row_prebuilt_struct::trx, user_session, and ut_a.
Referenced by index_first(), index_last(), index_read_idx(), index_read_last(), and rnd_pos().
UNIV_INTERN int ha_innobase::index_read_idx | ( | unsigned char * | buf, |
uint | keynr, | ||
const unsigned char * | key, | ||
uint | key_len, | ||
enum ha_rkey_function | find_flag | ||
) |
Positions an index cursor to the index specified in keynr. Fetches the row if any. ??? This is only used to read whole keys ???
buf | in/out: buffer for the returned row |
keynr | in: use this index |
key | in: key value; if this is NULL we position the cursor at the start or end of index |
key_len | in: key value length |
find_flag | in: search flags from my_base.h |
Definition at line 5344 of file ha_innodb.cc.
References change_active_index(), and index_read().
UNIV_INTERN int ha_innobase::index_read_last | ( | unsigned char * | buf, |
const unsigned char * | key_ptr, | ||
uint | key_len | ||
) |
The following functions works like index_read, but it find the last row with the current key value or prefix.
buf | out: fetched row |
key_ptr | in: key value, or a prefix of a full key value |
key_len | in: length of the key val or prefix in bytes |
Definition at line 5215 of file ha_innodb.cc.
References index_read().
UNIV_INTERN const char * ha_innobase::index_type | ( | uint | key_number | ) |
InnoDB database tables Returns the index type.
key_number | out: index type |
Definition at line 2822 of file ha_innodb.cc.
UNIV_INTERN int ha_innobase::info | ( | uint | flag | ) |
Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object.
flag | in: what information MySQL requests |
Definition at line 7048 of file ha_innodb.cc.
References row_prebuilt_struct::autoinc_last_value, row_prebuilt_struct::clust_index_was_generated, os_file_stat_struct::ctime, trx_struct::error_key_num, drizzled::Table::found_next_number_field, drizzled::Table::in_use, dict_table_struct::indexes, innobase_get_index(), innobase_get_mysql_key_number_for_index(), innobase_peek_autoinc(), drizzled::Table::key_info, dict_index_struct::n_uniq, dict_index_struct::name, dict_table_struct::name, trx_struct::op_info, os_file_get_status(), prebuilt, share, dict_table_struct::space, SRV_FORCE_NO_IBUF_MERGE, dict_table_struct::stat_clustered_index_size, dict_index_struct::stat_n_diff_key_vals, dict_table_struct::stat_n_rows, dict_table_struct::stat_sum_of_other_index_sizes, row_prebuilt_struct::table, row_prebuilt_struct::trx, trx_get_error_info(), trx_search_latch_release_if_reserved(), update_session(), user_session, ut_a, and UT_LIST_GET_LEN.
UNIV_INTERN ulint ha_innobase::innobase_get_autoinc | ( | uint64_t * | value | ) | [private] |
Read the next autoinc value. Acquire the relevant locks before reading the AUTOINC value. If SUCCESS then the table AUTOINC mutex will be locked on return and all relevant locks acquired.
value | out: autoinc value |
Definition at line 8507 of file ha_innodb.cc.
References row_prebuilt_struct::autoinc_error, prebuilt, and row_prebuilt_struct::table.
Referenced by doUpdateRecord(), and get_auto_increment().
UNIV_INTERN dict_index_t * ha_innobase::innobase_get_index | ( | uint | keynr | ) | [private] |
Get the index for a handle. Does not change active index.
keynr | in: use this index; MAX_KEY means always clustered index, even if it was internally generated by InnoDB |
Definition at line 5231 of file ha_innodb.cc.
References st_innobase_share::idx_trans_tbl, innodb_idx_translate_struct::index_mapping, innobase_index_lookup(), drizzled::Table::key_info, dict_table_struct::name, dict_index_struct::name, prebuilt, share, row_prebuilt_struct::table, ut_a, and ut_strcmp().
Referenced by change_active_index(), doOpen(), info(), innobase_initialize_autoinc(), and records_in_range().
UNIV_INTERN void ha_innobase::innobase_initialize_autoinc | ( | ) | [private] |
Set the autoinc column max value. This should only be called once from ha_innobase::open(). Therefore there's no need for a covering lock.
Definition at line 3133 of file ha_innodb.cc.
References drizzled::Field::field_name, drizzled::Table::found_next_number_field, innobase_get_index(), innobase_get_int_col_max_value(), innobase_next_autoinc(), dict_table_struct::name, prebuilt, row_search_max_autoinc(), session_to_trx(), SRV_FORCE_NO_IBUF_MERGE, row_prebuilt_struct::table, dict_index_struct::table, row_prebuilt_struct::trx, update_session(), user_session, ut_a, ut_error, and ut_print_timestamp().
Referenced by doOpen().
UNIV_INTERN ulint ha_innobase::innobase_lock_autoinc | ( | void | ) | [private] |
This special handling is really to overcome the limitations of MySQL's binlogging. We need to eliminate the non-determinism that will arise in INSERT ... SELECT type of statements, since MySQL binlog only stores the min value of the autoinc interval. Once that is fixed we can get rid of the special lock handling.
Definition at line 4265 of file ha_innodb.cc.
References prebuilt, and row_prebuilt_struct::table.
UNIV_INTERN uint64_t ha_innobase::innobase_peek_autoinc | ( | void | ) | [private] |
This function reads the global auto-inc counter. It doesn't use the AUTOINC lock even if the lock mode is set to TRADITIONAL.
Definition at line 8533 of file ha_innodb.cc.
References dict_table_struct::name, prebuilt, row_prebuilt_struct::table, ut_a, and ut_print_timestamp().
Referenced by info().
UNIV_INTERN ulint ha_innobase::innobase_reset_autoinc | ( | uint64_t | autoinc | ) | [private] |
Reset the autoinc value in the table.
autoinc | in: value to store |
Definition at line 4280 of file ha_innodb.cc.
References prebuilt, and row_prebuilt_struct::table.
Referenced by reset_auto_increment().
UNIV_INTERN ulint ha_innobase::innobase_set_max_autoinc | ( | uint64_t | auto_inc | ) | [private] |
Store the autoinc value in the table. The autoinc value is only set if it's greater than the existing autoinc value in the table.
auto_inc | in: value to store |
Definition at line 4297 of file ha_innodb.cc.
References prebuilt, and row_prebuilt_struct::table.
Referenced by doInsertRecord(), and doUpdateRecord().
bool drizzled::Cursor::is_fatal_error | ( | int | error, |
uint32_t | flags | ||
) | [virtual, inherited] |
This method is used to analyse the error to see whether the error is ignorable or not, certain handlers can have more error that are ignorable than others. E.g. the partition Cursor can get inserts into a range where there is no partition and this is an ignorable error. HA_ERR_FOUND_DUP_UNIQUE is a special case in MyISAM that means the same thing as HA_ERR_FOUND_DUP_KEY but can in some cases lead to a slightly different error message.
Definition at line 197 of file cursor.cc.
Referenced by drizzled::update_query().
UNIV_INTERN const key_map * ha_innobase::keys_to_use_for_scanning | ( | ) | [virtual] |
Returns the key map of keys that are usable for scanning.
Reimplemented from drizzled::Cursor.
Definition at line 2862 of file ha_innodb.cc.
int drizzled::Cursor::multi_range_read_info | ( | uint32_t | keyno, |
uint32_t | n_ranges, | ||
uint32_t | n_rows, | ||
uint32_t * | bufsz, | ||
uint32_t * | flags, | ||
optimizer::CostVector * | cost | ||
) | [virtual, inherited] |
Get cost and other information about MRR scan over some sequence of ranges
Calculate estimated cost and other information about an MRR scan for some sequence of ranges.
The ranges themselves will be known only at execution phase. When this function is called we only know number of ranges and a (rough) E(records) within those ranges.
Currently this function is only called for "n-keypart singlepoint" ranges, i.e. each range is "keypart1=someconst1 AND ... AND keypartN=someconstN"
The flags parameter is a combination of those flags: HA_MRR_SORTED, HA_MRR_INDEX_ONLY, HA_MRR_NO_ASSOCIATION, HA_MRR_LIMITS.
keyno | Index number |
n_ranges | Estimated number of ranges (i.e. intervals) in the range sequence. |
n_rows | Estimated total number of records contained within all of the ranges |
bufsz | INOUT IN: Size of the buffer available for use OUT: Size of the buffer that will be actually used, or 0 if buffer is not needed. |
flags | INOUT A combination of HA_MRR_* flags |
cost | OUT Estimated cost of MRR access |
0 | OK, *cost contains cost of the scan, *bufsz and *flags contain scan parameters. |
other | Error or can't perform the requested scan |
Definition at line 1014 of file cursor.cc.
References drizzled::Cursor::index_only_read_time().
ha_rows drizzled::Cursor::multi_range_read_info_const | ( | uint32_t | keyno, |
RANGE_SEQ_IF * | seq, | ||
void * | seq_init_param, | ||
uint32_t | n_ranges, | ||
uint32_t * | bufsz, | ||
uint32_t * | flags, | ||
optimizer::CostVector * | cost | ||
) | [virtual, inherited] |
Get cost and other information about MRR scan over a known list of ranges
Calculate estimated cost and other information about an MRR scan for given sequence of ranges.
keyno | Index number |
seq | Range sequence to be traversed |
seq_init_param | First parameter for seq->init() |
n_ranges_arg | Number of ranges in the sequence, or 0 if the caller can't efficiently determine it |
bufsz | INOUT IN: Size of the buffer available for use OUT: Size of the buffer that is expected to be actually used, or 0 if buffer is not needed. |
flags | INOUT A combination of HA_MRR_* flags |
cost | OUT Estimated cost of MRR access |
HA_POS_ERROR | Error or the engine is unable to perform the requested scan. Values of OUT parameters are undefined. |
other | OK, *cost contains cost of the scan, *bufsz and *flags contain scan parameters. |
Definition at line 927 of file cursor.cc.
References drizzled::Cursor::index_only_read_time(), and TIME_FOR_COMPARE.
int drizzled::Cursor::multi_range_read_init | ( | RANGE_SEQ_IF * | seq_funcs, |
void * | seq_init_param, | ||
uint32_t | n_ranges, | ||
uint32_t | mode | ||
) | [virtual, inherited] |
Initialize the MRR scan
Initialize the MRR scan. This function may do heavyweight scan initialization like row prefetching/sorting/etc (NOTE: but better not do it here as we may not need it, e.g. if we never satisfy WHERE clause on previous tables. For many implementations it would be natural to do such initializations in the first multi_read_range_next() call)
mode is a combination of the following flags: HA_MRR_SORTED, HA_MRR_INDEX_ONLY, HA_MRR_NO_ASSOCIATION
seq | Range sequence to be traversed |
seq_init_param | First parameter for seq->init() |
n_ranges | Number of ranges in the sequence |
mode | Flags, see the description section for the details |
buf | INOUT: memory buffer to be used |
Until WL#2623 is done (see its text, section 3.2), the following will also hold: The caller will guarantee that if "seq->init == mrr_ranges_array_init" then seq_init_param is an array of n_ranges KEY_MULTI_RANGE structures. This property will only be used by NDB Cursor until WL#2623 is done.
Buffer memory management is done according to the following scenario: The caller allocates the buffer and provides it to the callee by filling the members of HANDLER_BUFFER structure. The callee consumes all or some fraction of the provided buffer space, and sets the HANDLER_BUFFER members accordingly. The callee may use the buffer memory until the next multi_range_read_init() call is made, all records have been read, or until doEndIndexScan() call is made, whichever comes first.
0 | OK |
1 | Error |
Definition at line 1075 of file cursor.cc.
References drizzled::Cursor::mrr_have_range, and drizzled::Cursor::mrr_iter.
int drizzled::Cursor::multi_range_read_next | ( | char ** | range_info | ) | [virtual, inherited] |
Get next record in MRR scan
Default MRR implementation: read the next record
range_info | OUT Undefined if HA_MRR_NO_ASSOCIATION flag is in effect Otherwise, the opaque value associated with the range that contains the returned record. |
0 | OK |
other | Error code |
Definition at line 1100 of file cursor.cc.
References drizzled::Cursor::mrr_cur_range, drizzled::Cursor::mrr_have_range, drizzled::Cursor::mrr_iter, drizzled::Cursor::read_range_first(), drizzled::Cursor::read_range_next(), and drizzled::Cursor::was_semi_consistent_read().
UNIV_INTERN void ha_innobase::position | ( | const unsigned char * | record | ) | [virtual] |
Stores a reference to the current row to 'ref' field of the handle. Note that in the case where we have generated the clustered index for the table, the function parameter is illogical: we MUST ASSUME that 'record' is the current 'position' of the handle, because if row ref is actually the row id internally generated in InnoDB, then 'record' does not contain it. We just guess that the row id must be for the record where the handle was positioned the last time.
record | in: row in MySQL format |
Implements drizzled::Cursor.
Definition at line 5640 of file ha_innodb.cc.
References row_prebuilt_struct::clust_index_was_generated, prebuilt, drizzled::Cursor::ref_length, row_prebuilt_struct::row_id, session_to_trx(), store_key_val_for_row(), row_prebuilt_struct::trx, and ut_a.
UNIV_INTERN bool ha_innobase::primary_key_is_clustered | ( | ) | [virtual] |
Determines if the primary key is clustered index.
Reimplemented from drizzled::Cursor.
Definition at line 2873 of file ha_innodb.cc.
int drizzled::Cursor::read_first_row | ( | unsigned char * | buf, |
uint32_t | primary_key | ||
) | [virtual, inherited] |
int ha_innobase::read_range_first | ( | const key_range * | start_key, |
const key_range * | end_key, | ||
bool | eq_range_arg, | ||
bool | sorted | ||
) | [virtual] |
Fast index creation (smart ALTER TABLE)
Reimplemented from drizzled::Cursor.
Definition at line 9290 of file ha_innodb.cc.
int ha_innobase::read_range_next | ( | ) | [virtual] |
Read next row between two endpoints.
0 | Found row |
HA_ERR_END_OF_FILE | No rows in range |
\:: | Error code |
Reimplemented from drizzled::Cursor.
Definition at line 9305 of file ha_innodb.cc.
UNIV_INTERN double ha_innobase::read_time | ( | uint | index, |
uint | ranges, | ||
ha_rows | rows | ||
) |
Calculate the time it takes to read a set of ranges through an index This enables us to optimise reads for clustered indexes.
index | in: key number |
ranges | in: how many ranges |
rows | in: estimated number of rows in the ranges |
Definition at line 6910 of file ha_innodb.cc.
References estimate_rows_upper_bound(), and scan_time().
ha_rows drizzled::Cursor::records | ( | ) | [virtual, inherited] |
UNIV_INTERN ha_rows ha_innobase::records_in_range | ( | uint | keynr, |
key_range * | min_key, | ||
key_range * | max_key | ||
) |
Estimates the number of index records in a range.
keynr | in: index number |
min_key | in: start key value of the range, may also be 0 |
max_key | in: range end key val, may also be 0 |
Definition at line 6724 of file ha_innodb.cc.
References convert_search_mode_to_innobase(), dtuple_create(), innobase_get_index(), drizzled::Table::key_info, key_val_buff, mem_heap_create, mem_heap_free, trx_struct::op_info, prebuilt, row_merge_is_index_usable(), row_sel_convert_mysql_key_to_innobase(), session_to_trx(), row_prebuilt_struct::trx, trx_search_latch_release_if_reserved(), and ut_a.
UNIV_INTERN uint ha_innobase::referenced_by_foreign_key | ( | void | ) | [virtual] |
Checks if a table is referenced by a foreign key. The MySQL manual states that a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a delete is then allowed internally to resolve a duplicate key conflict in REPLACE, not an update.
Reimplemented from drizzled::Cursor.
Definition at line 7806 of file ha_innodb.cc.
References prebuilt, and row_prebuilt_struct::table.
UNIV_INTERN int ha_innobase::reset | ( | void | ) | [virtual] |
Reset state of file to after 'open'. This function is called after every statement for all tables used by that statement.
Reimplemented from drizzled::Cursor.
Definition at line 7892 of file ha_innodb.cc.
References row_prebuilt_struct::autoinc_last_value, row_prebuilt_struct::blob_heap, prebuilt, reset_template(), and row_mysql_prebuilt_free_blob_heap().
UNIV_INTERN int ha_innobase::reset_auto_increment | ( | uint64_t | value | ) | [virtual] |
Reset the auto-increment counter to the given value, i.e. the next row inserted will get the given value. This is called e.g. after TRUNCATE is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is returned by storage engines that don't support this operation.
value | in: new value for table autoinc |
Reimplemented from drizzled::Cursor.
Definition at line 8674 of file ha_innodb.cc.
References convert_error_code_to_mysql(), dict_table_struct::flags, innobase_reset_autoinc(), prebuilt, row_lock_table_autoinc_for_mysql(), row_prebuilt_struct::table, update_session(), and user_session.
UNIV_INTERN int ha_innobase::rnd_next | ( | unsigned char * | buf | ) | [virtual] |
Reads the next row in a table scan (also used to read the FIRST row in a table scan).
buf | in/out: returns the row in this buffer, in MySQL format |
Implements drizzled::Cursor.
Definition at line 5558 of file ha_innodb.cc.
References general_fetch(), index_first(), ROW_SEL_NEXT, and start_of_scan.
UNIV_INTERN int ha_innobase::rnd_pos | ( | unsigned char * | buf, |
unsigned char * | pos | ||
) | [virtual] |
Fetches a row from the table based on a row reference.
buf | in/out: buffer for the row |
pos | in: primary key value of the row in the MySQL format, or the row id if the clustered index was internally generated by InnoDB; the length of data in pos has to be ref_length |
Implements drizzled::Cursor.
Definition at line 5587 of file ha_innodb.cc.
References change_active_index(), row_prebuilt_struct::clust_index_was_generated, index_read(), prebuilt, drizzled::Cursor::ref_length, session_to_trx(), row_prebuilt_struct::trx, and ut_a.
UNIV_INTERN double ha_innobase::scan_time | ( | void | ) | [virtual] |
How many seeks it will take to read through the table. This is to be comparable to the number returned by records_in_range so that we can decide if we should scan the table or use keys.
Reimplemented from drizzled::Cursor.
Definition at line 6893 of file ha_innodb.cc.
References prebuilt, dict_table_struct::stat_clustered_index_size, and row_prebuilt_struct::table.
Referenced by read_time().
UNIV_INTERN uint ha_innobase::store_key_val_for_row | ( | uint | keynr, |
char * | buff, | ||
uint | buff_len, | ||
const unsigned char * | record | ||
) | [private] |
Stores a key value for a row to a buffer.
keynr | in: key number |
buff | in/out: buffer for the key value (in MySQL format) |
buff_len | in: buffer length |
record | in: row in MySQL format |
Definition at line 3807 of file ha_innodb.cc.
References get_field_offset(), innobase_write_to_2_little_endian(), drizzled::Table::key_info, drizzled::Field::pack_length(), row_mysql_read_blob_ref(), row_mysql_read_true_varchar(), row_mysql_store_true_var_len(), and ut_a.
Referenced by position().
UNIV_INTERN THR_LOCK_DATA ** ha_innobase::store_lock | ( | Session * | session, |
THR_LOCK_DATA ** | to, | ||
enum thr_lock_type | lock_type | ||
) | [virtual] |
Converts a MySQL table lock stored in the 'lock' field of the handle to a proper type before storing pointer to the lock into an array of pointers. MySQL also calls this if it wants to reset some table locks to a not-locked state during the processing of an SQL query. An example is that during a SELECT the read lock is released early on the 'const' tables where we only fetch one row. MySQL does not call this when it releases all locks at the end of an SQL statement.
session | in: user thread handle |
to | in: pointer to an array of pointers to lock structs; pointer to the 'lock' field of current handle is stored next to this array |
lock_type | in: lock type to store in 'lock'; this may also be TL_IGNORE |
Reimplemented from drizzled::Cursor.
Definition at line 8366 of file ha_innodb.cc.
References check_trx_exists(), prebuilt, row_prebuilt_struct::select_lock_type, srv_locks_unsafe_for_binlog, and row_prebuilt_struct::stored_select_lock_type.
UNIV_INTERN void ha_innobase::try_semi_consistent_read | ( | bool | ) | [virtual] |
Tell the engine whether it should avoid unnecessary lock waits. If yes, in an UPDATE or DELETE, if the row under the cursor was locked by another transaction, the engine may try an optimistic read of the last committed row value under the cursor.
Reimplemented from drizzled::Cursor.
Definition at line 4927 of file ha_innodb.cc.
References prebuilt, row_prebuilt_struct::row_read_type, session_to_trx(), srv_locks_unsafe_for_binlog, row_prebuilt_struct::trx, and ut_a.
Referenced by doStartTableScan().
UNIV_INTERN void ha_innobase::unlock_row | ( | void | ) | [virtual] |
Removes a new lock set on a row, if it was not read optimistically. This can be called after a row has been read in the processing of an UPDATE or a DELETE query, if the option innodb_locks_unsafe_for_binlog is set.
Reimplemented from drizzled::Cursor.
Definition at line 4886 of file ha_innodb.cc.
References prebuilt, row_prebuilt_struct::row_read_type, row_unlock_for_mysql(), row_prebuilt_struct::select_lock_type, srv_locks_unsafe_for_binlog, and row_prebuilt_struct::trx.
UNIV_INTERN void ha_innobase::update_session | ( | Session * | session | ) | [inline, private] |
Updates the user_thd field in a handle and also allocates a new InnoDB transaction handle if needed, and updates the transaction fields in the prebuilt struct.
session | in: thd to use the handle |
Definition at line 1604 of file ha_innodb.cc.
References check_trx_exists(), prebuilt, row_update_prebuilt_trx(), row_prebuilt_struct::trx, and user_session.
Referenced by delete_all_rows(), estimate_rows_upper_bound(), external_lock(), get_auto_increment(), get_foreign_key_create_info(), get_foreign_key_list(), info(), innobase_initialize_autoinc(), reset_auto_increment(), and update_table_comment().
UNIV_INTERN char * ha_innobase::update_table_comment | ( | const char * | comment | ) |
Adds information about free space in the InnoDB tablespace to a table comment which is printed out when a user calls SHOW TABLE STATUS. Adds also info on foreign keys.
comment | in: table comment defined by user |
Definition at line 7511 of file ha_innodb.cc.
References trx_struct::op_info, prebuilt, dict_table_struct::space, row_prebuilt_struct::table, row_prebuilt_struct::trx, trx_search_latch_release_if_reserved(), and update_session().
UNIV_INTERN bool ha_innobase::was_semi_consistent_read | ( | void | ) | [virtual] |
In an UPDATE or DELETE, if the row under the cursor was locked by another transaction, and the engine used an optimistic read of the last committed row value under the cursor, then the engine returns 1 from this function. MySQL must NOT try to update this optimistic value. If the optimistic value does not match the WHERE condition, MySQL can decide to skip over this row. Currently only works for InnoDB. This can be used to avoid unnecessary lock waits.
If this method returns nonzero, it will also signal the storage engine that the next read will be a locking re-read of the row.
Reimplemented from drizzled::Cursor.
Definition at line 4918 of file ha_innodb.cc.
References prebuilt, and row_prebuilt_struct::row_read_type.
Discrete_interval drizzled::Cursor::auto_inc_interval_for_cur_row [inherited] |
Interval returned by get_auto_increment() and being consumed by the inserter.
Definition at line 224 of file cursor.h.
Referenced by drizzled::Cursor::ha_release_auto_increment().
uint64_t drizzled::Cursor::insert_id_for_cur_row [inherited] |
insert id for the current row (*autogenerated*; if not autogenerated, it's 0). At first successful insertion, this variable is stored into Session::first_successful_insert_id_in_cur_stmt.
Definition at line 219 of file cursor.h.
Referenced by drizzled::Cursor::ha_release_auto_increment().
std::vector<unsigned char> ha_innobase::key_val_buff [private] |
buffer used in converting search key values from MySQL format to Innodb format
Definition at line 93 of file ha_innodb.h.
Referenced by close(), doOpen(), index_read(), and records_in_range().
KEY_MULTI_RANGE drizzled::Cursor::mrr_cur_range [inherited] |
Current range (the one we're now returning rows from)
Definition at line 175 of file cursor.h.
Referenced by drizzled::Cursor::multi_range_read_next().
bool drizzled::Cursor::mrr_have_range [inherited] |
true <=> we're currently traversing a range in mrr_cur_range.
Definition at line 170 of file cursor.h.
Referenced by drizzled::Cursor::multi_range_read_init(), and drizzled::Cursor::multi_range_read_next().
range_seq_t drizzled::Cursor::mrr_iter [inherited] |
MultiRangeRead-related members:
Definition at line 162 of file cursor.h.
Referenced by drizzled::Cursor::multi_range_read_init(), and drizzled::Cursor::multi_range_read_next().
uint64_t drizzled::Cursor::next_insert_id [inherited] |
next_insert_id is the next value which should be inserted into the auto_increment column: in a inserting-multi-row statement (like INSERT SELECT), for the first row where the autoinc value is not specified by the statement, get_auto_increment() called and asked to generate a value, next_insert_id is set to the next value, then for all other rows next_insert_id is used (and increased each time) without calling get_auto_increment().
Definition at line 199 of file cursor.h.
Referenced by drizzled::Cursor::ha_external_lock(), and drizzled::Cursor::ha_release_auto_increment().
uint ha_innobase::num_write_row [private] |
number of doInsertRecord() calls
Definition at line 106 of file ha_innodb.h.
Referenced by doInsertRecord().
row_prebuilt_t* ha_innobase::prebuilt [private] |
prebuilt struct in InnoDB, used to save CPU time with prebuilt data structures
Definition at line 82 of file ha_innodb.h.
Referenced by can_switch_engines(), change_active_index(), check(), close(), cmp_ref(), delete_all_rows(), discard_or_import_tablespace(), doDeleteRecord(), doInsertRecord(), doOpen(), doStartTableScan(), doUpdateRecord(), estimate_rows_upper_bound(), external_lock(), extra(), general_fetch(), get_auto_increment(), get_foreign_key_create_info(), get_foreign_key_list(), index_read(), info(), innobase_get_autoinc(), innobase_get_index(), innobase_initialize_autoinc(), innobase_lock_autoinc(), innobase_peek_autoinc(), innobase_reset_autoinc(), innobase_set_max_autoinc(), position(), records_in_range(), referenced_by_foreign_key(), reset(), reset_auto_increment(), rnd_pos(), scan_time(), store_lock(), try_semi_consistent_read(), unlock_row(), update_session(), update_table_comment(), and was_semi_consistent_read().
uint32_t drizzled::Cursor::ref_length [inherited] |
Length of ref (1-8 or the clustered key length)
Definition at line 186 of file cursor.h.
Referenced by doOpen(), drizzled::Cursor::ha_open(), drizzled::Cursor::index_only_read_time(), position(), drizzled::optimizer::QuickIndexMergeSelect::read_keys_and_merge(), rnd_pos(), drizzled::FileSort::run(), and drizzled::update_query().
key_range drizzled::Cursor::save_end_range [inherited] |
The following are for read_range()
Definition at line 178 of file cursor.h.
Referenced by drizzled::Cursor::read_range_first().
INNOBASE_SHARE* ha_innobase::share [private] |
information for MySQL table locking
Definition at line 89 of file ha_innodb.h.
Referenced by close(), doOpen(), info(), and innobase_get_index().
ulong ha_innobase::start_of_scan [private] |
this is set to 1 when we are starting a table scan but have not yet fetched any row, else 0
Definition at line 100 of file ha_innodb.h.
Referenced by doStartTableScan(), and rnd_next().
std::vector<unsigned char> ha_innobase::upd_buff [private] |
buffer used in updates
Definition at line 92 of file ha_innodb.h.
Referenced by close(), doOpen(), and doUpdateRecord().
Session* ha_innobase::user_session [private] |
the thread handle of the user currently using the handle; this is set in external_lock function
Definition at line 85 of file ha_innodb.h.
Referenced by change_active_index(), check(), delete_all_rows(), doDeleteRecord(), doInsertRecord(), doOpen(), doUpdateRecord(), general_fetch(), index_read(), info(), innobase_initialize_autoinc(), reset_auto_increment(), and update_session().