MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ha_innobase Class Reference

#include <ha_innodb.h>

Inheritance diagram for ha_innobase:
Collaboration diagram for ha_innobase:

Public Member Functions

 ha_innobase (handlerton *hton, TABLE_SHARE *table_arg)
 ~ha_innobase ()
enum row_type get_row_type () const
const char * table_type () const
const char * index_type (uint key_number)
const char ** bas_ext () const
Table_flags table_flags () const
ulong index_flags (uint idx, uint part, bool all_parts) const
uint max_supported_keys () const
uint max_supported_key_length () const
uint max_supported_key_part_length () const
const key_mapkeys_to_use_for_scanning ()
int open (const char *name, int mode, uint test_if_locked)
handlerclone (const char *name, MEM_ROOT *mem_root)
int close (void)
double scan_time ()
double read_time (uint index, uint ranges, ha_rows rows)
longlong get_memory_buffer_size () const
int write_row (uchar *buf)
int update_row (const uchar *old_data, uchar *new_data)
int delete_row (const uchar *buf)
bool was_semi_consistent_read ()
void try_semi_consistent_read (bool yes)
void unlock_row ()
int index_init (uint index, bool sorted)
int index_end ()
int index_read (uchar *buf, const uchar *key, uint key_len, enum ha_rkey_function find_flag)
int index_read_idx (uchar *buf, uint index, const uchar *key, uint key_len, enum ha_rkey_function find_flag)
int index_read_last (uchar *buf, const uchar *key, uint key_len)
int index_next (uchar *buf)
int index_next_same (uchar *buf, const uchar *key, uint keylen)
int index_prev (uchar *buf)
int index_first (uchar *buf)
int index_last (uchar *buf)
int rnd_init (bool scan)
int rnd_end ()
int rnd_next (uchar *buf)
int rnd_pos (uchar *buf, uchar *pos)
int ft_init ()
void ft_end ()
FT_INFOft_init_ext (uint flags, uint inx, String *key)
int ft_read (uchar *buf)
void position (const uchar *record)
int info (uint)
int analyze (THD *thd, HA_CHECK_OPT *check_opt)
int optimize (THD *thd, HA_CHECK_OPT *check_opt)
int discard_or_import_tablespace (my_bool discard)
int extra (enum ha_extra_function operation)
int reset ()
int external_lock (THD *thd, int lock_type)
int transactional_table_lock (THD *thd, int lock_type)
int start_stmt (THD *thd, thr_lock_type lock_type)
void position (uchar *record)
ha_rows records_in_range (uint inx, key_range *min_key, key_range *max_key)
ha_rows estimate_rows_upper_bound ()
void update_create_info (HA_CREATE_INFO *create_info)
int parse_table_name (const char *name, HA_CREATE_INFO *create_info, ulint flags, ulint flags2, char *norm_name, char *temp_path, char *remote_path)
int create (const char *name, register TABLE *form, HA_CREATE_INFO *create_info)
int truncate ()
int delete_table (const char *name)
int rename_table (const char *from, const char *to)
int check (THD *thd, HA_CHECK_OPT *check_opt)
char * update_table_comment (const char *comment)
char * get_foreign_key_create_info ()
int get_foreign_key_list (THD *thd, List< FOREIGN_KEY_INFO > *f_key_list)
int get_parent_foreign_key_list (THD *thd, List< FOREIGN_KEY_INFO > *f_key_list)
bool can_switch_engines ()
uint referenced_by_foreign_key ()
void free_foreign_key_create_info (char *str)
THR_LOCK_DATA ** store_lock (THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type)
void init_table_handle_for_HANDLER ()
virtual void get_auto_increment (ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, ulonglong *nb_reserved_values)
int reset_auto_increment (ulonglong value)
virtual bool get_error_message (int error, String *buf)
virtual bool get_foreign_dup_key (char *, uint, char *, uint)
uint8 table_cache_type ()
my_bool register_query_cache_table (THD *thd, char *table_key, uint key_length, qc_engine_callback *call_back, ulonglong *engine_data)
 Register a named table with a call back function to the query cache.
bool primary_key_is_clustered ()
int cmp_ref (const uchar *ref1, const uchar *ref2)
bool check_if_incompatible_data (HA_CREATE_INFO *info, uint table_changes)
enum_alter_inplace_result check_if_supported_inplace_alter (TABLE *altered_table, Alter_inplace_info *ha_alter_info)
bool prepare_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info)
bool inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info)
bool commit_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit)
- Public Member Functions inherited from handler
virtual void unbind_psi ()
virtual void rebind_psi ()
 handler (handlerton *ht_arg, TABLE_SHARE *share_arg)
void init ()
int ha_open (TABLE *table, const char *name, int mode, int test_if_locked)
 Open database-handler.
int ha_close (void)
int ha_index_init (uint idx, bool sorted)
int ha_index_end ()
int ha_rnd_init (bool scan)
int ha_rnd_end ()
int ha_rnd_next (uchar *buf)
int ha_rnd_pos (uchar *buf, uchar *pos)
int ha_index_read_map (uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
int ha_index_read_last_map (uchar *buf, const uchar *key, key_part_map keypart_map)
int ha_index_read_idx_map (uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
int ha_index_next (uchar *buf)
int ha_index_prev (uchar *buf)
int ha_index_first (uchar *buf)
int ha_index_last (uchar *buf)
int ha_index_next_same (uchar *buf, const uchar *key, uint keylen)
int ha_index_read (uchar *buf, const uchar *key, uint key_len, enum ha_rkey_function find_flag)
int ha_index_read_last (uchar *buf, const uchar *key, uint key_len)
int ha_reset ()
 Check handler usage and reset state of file to after 'open'.
int ha_index_or_rnd_end ()
Table_flags ha_table_flags () const
int ha_external_lock (THD *thd, int lock_type)
int ha_write_row (uchar *buf)
int ha_update_row (const uchar *old_data, uchar *new_data)
int ha_delete_row (const uchar *buf)
void ha_release_auto_increment ()
int check_collation_compatibility ()
int ha_check_for_upgrade (HA_CHECK_OPT *check_opt)
int ha_check (THD *thd, HA_CHECK_OPT *check_opt)
int ha_repair (THD *thd, HA_CHECK_OPT *check_opt)
void ha_start_bulk_insert (ha_rows rows)
int ha_end_bulk_insert ()
int ha_bulk_update_row (const uchar *old_data, uchar *new_data, uint *dup_key_found)
int ha_delete_all_rows ()
int ha_truncate ()
int ha_reset_auto_increment (ulonglong value)
int ha_optimize (THD *thd, HA_CHECK_OPT *check_opt)
int ha_analyze (THD *thd, HA_CHECK_OPT *check_opt)
bool ha_check_and_repair (THD *thd)
int ha_disable_indexes (uint mode)
int ha_enable_indexes (uint mode)
int ha_discard_or_import_tablespace (my_bool discard)
int ha_rename_table (const char *from, const char *to)
int ha_delete_table (const char *name)
void ha_drop_table (const char *name)
int ha_create (const char *name, TABLE *form, HA_CREATE_INFO *info)
int ha_create_handler_files (const char *name, const char *old_name, int action_flag, HA_CREATE_INFO *info)
int ha_change_partitions (HA_CREATE_INFO *create_info, const char *path, ulonglong *const copied, ulonglong *const deleted, const uchar *pack_frm_data, size_t pack_frm_len)
int ha_drop_partitions (const char *path)
int ha_rename_partitions (const char *path)
void adjust_next_insert_id_after_explicit_value (ulonglong nr)
int update_auto_increment ()
virtual void print_error (int error, myf errflag)
uint get_dup_key (int error)
virtual void change_table_ptr (TABLE *table_arg, TABLE_SHARE *share)
virtual double index_only_read_time (uint keynr, double records)
bool has_transactions ()
virtual uint extra_rec_buf_length () const
virtual bool is_fatal_error (int error, uint flags)
virtual ha_rows records ()
virtual void column_bitmaps_signal ()
 MySQL signal that it changed the column bitmap.
uint get_index (void) const
virtual bool start_bulk_update ()
virtual bool start_bulk_delete ()
virtual int exec_bulk_update (uint *dup_key_found)
virtual void end_bulk_update ()
virtual int end_bulk_delete ()
virtual int read_range_first (const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted)
 Read first row between two ranges. Store ranges for future calls to read_range_next.
virtual int read_range_next ()
 Read next row between two endpoints.
void set_end_range (const key_range *range, enum_range_scan_direction direction)
int compare_key (key_range *range)
int compare_key_icp (const key_range *range) const
virtual int rnd_pos_by_record (uchar *record)
virtual int read_first_row (uchar *buf, uint primary_key)
virtual int restart_rnd_next (uchar *buf, uchar *pos)
virtual int rnd_same (uchar *buf, uint inx)
virtual void get_dynamic_partition_info (PARTITION_STATS *stat_info, uint part_id)
virtual uint32 calculate_key_hash_value (Field **field_array)
virtual int extra_opt (enum ha_extra_function operation, ulong cache_size)
virtual bool start_read_removal (void)
virtual ha_rows end_read_removal (void)
void set_next_insert_id (ulonglong id)
void restore_auto_increment (ulonglong prev_insert_id)
int check_old_types ()
virtual int assign_to_keycache (THD *thd, HA_CHECK_OPT *check_opt)
virtual int preload_keys (THD *thd, HA_CHECK_OPT *check_opt)
virtual int indexes_are_disabled (void)
virtual void append_create_info (String *packet)
virtual bool is_fk_defined_on_table_or_index (uint index)
virtual int get_default_no_partitions (HA_CREATE_INFO *info)
virtual void set_auto_partitions (partition_info *part_info)
virtual bool get_no_parts (const char *name, uint *no_parts)
virtual void set_part_info (partition_info *part_info, bool early)
uint max_record_length () const
uint max_keys () const
uint max_key_parts () const
uint max_key_length () const
uint max_key_part_length () const
virtual uint max_supported_record_length () const
virtual uint max_supported_key_parts () const
virtual uint min_record_length (uint options) const
virtual bool low_byte_first () const
virtual uint checksum () const
virtual bool is_crashed () const
virtual bool auto_repair () const
virtual uint lock_count (void) const
virtual const Itemcond_push (const Item *cond)
virtual void cond_pop ()
virtual void cancel_pushed_idx_cond ()
virtual uint number_of_pushed_joins () const
virtual const TABLEroot_of_pushed_join () const
virtual const TABLEparent_of_pushed_join () const
virtual int index_read_pushed (uchar *buf, const uchar *key, key_part_map keypart_map)
virtual int index_next_pushed (uchar *buf)
bool ha_prepare_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info)
bool ha_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info)
bool ha_commit_inplace_alter_table (TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit)
void ha_notify_table_changed ()
virtual void use_hidden_primary_key ()
virtual uint alter_table_flags (uint flags)
virtual int bulk_update_row (const uchar *old_data, uchar *new_data, uint *dup_key_found)
virtual int delete_all_rows ()
virtual bool check_and_repair (THD *thd)
virtual int disable_indexes (uint mode)
virtual int enable_indexes (uint mode)
virtual void drop_table (const char *name)
virtual int create (const char *name, TABLE *form, HA_CREATE_INFO *info)=0
virtual int create_handler_files (const char *name, const char *old_name, int action_flag, HA_CREATE_INFO *info)
virtual int change_partitions (HA_CREATE_INFO *create_info, const char *path, ulonglong *const copied, ulonglong *const deleted, const uchar *pack_frm_data, size_t pack_frm_len)
virtual int drop_partitions (const char *path)
virtual int rename_partitions (const char *path)
virtual bool set_ha_share_ref (Handler_share **arg_ha_share)
int get_lock_type () const

Static Public Member Functions

static const char * get_mysql_bin_log_name ()
static ulonglong get_mysql_bin_log_pos ()

Multi Range Read interface @{

int multi_range_read_init (RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint mode, HANDLER_BUFFER *buf)
int multi_range_read_next (char **range_info)
ha_rows multi_range_read_info_const (uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, uint *flags, Cost_estimate *cost)
ha_rows multi_range_read_info (uint keyno, uint n_ranges, uint keys, uint *bufsz, uint *flags, Cost_estimate *cost)
class Itemidx_cond_push (uint keyno, class Item *idx_cond)

Additional Inherited Members

- Public Types inherited from handler
enum  enum_range_scan_direction { RANGE_SCAN_ASC, RANGE_SCAN_DESC }
enum  { NONE = 0, INDEX, RND }
typedef ulonglong Table_flags
- Public Attributes inherited from handler
handlertonht
uchar * ref
uchar * dup_ref
ha_statistics stats
range_seq_t mrr_iter
RANGE_SEQ_IF mrr_funcs
HANDLER_BUFFERmulti_range_buffer
uint ranges_in_seq
bool mrr_is_output_sorted
bool mrr_have_range
KEY_MULTI_RANGE mrr_cur_range
key_rangeend_range
uint errkey
uint key_used_on_scan
uint active_index
uint ref_length
FT_INFOft_handler
enum handler:: { ... }  inited
bool implicit_emptied
const Itempushed_cond
Itempushed_idx_cond
uint pushed_idx_cond_keyno
ulonglong next_insert_id
ulonglong insert_id_for_cur_row
Discrete_interval auto_inc_interval_for_cur_row
uint auto_inc_intervals_count
PSI_table * m_psi
- Protected Member Functions inherited from handler
virtual int index_read_map (uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
 Positions an index cursor to the index specified in the handle ('active_index'). 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 (uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
 Positions an index cursor to the index specified in argument. Fetches the row if available. If the key value is null, begin at the first key of the index.
virtual int index_read_last_map (uchar *buf, const uchar *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.
virtual void notify_table_changed ()
void ha_statistic_increment (ulonglong SSV::*offset) const
void ** ha_data (THD *) const
THD * ha_thd (void) const
PSI_table_share * ha_table_share_psi (const TABLE_SHARE *share) const
Handler_shareget_ha_share_ptr ()
void set_ha_share_ptr (Handler_share *arg_ha_share)
void lock_shared_ha_data ()
void unlock_shared_ha_data ()
- Protected Attributes inherited from handler
TABLE_SHAREtable_share
TABLEtable
Table_flags cached_table_flags
ha_rows estimation_rows_to_insert
KEY_PART_INFOrange_key_part
bool eq_range
bool in_range_check_pushed_down

Detailed Description

The class defining a handle to an Innodb table

Definition at line 60 of file ha_innodb.h.

Constructor & Destructor Documentation

UNIV_INTERN ha_innobase::ha_innobase ( handlerton hton,
TABLE_SHARE table_arg 
)

Construct ha_innobase handler.

Definition at line 2188 of file ha_innodb.cc.

UNIV_INTERN ha_innobase::~ha_innobase ( )

Destruct ha_innobase handler.

Definition at line 2210 of file ha_innodb.cc.

Member Function Documentation

UNIV_INTERN const char ** ha_innobase::bas_ext ( void  ) const
virtual

Returns the table file name extension.

Returns
file extension string

Implements handler.

Definition at line 3934 of file ha_innodb.cc.

bool ha_innobase::can_switch_engines ( )
virtual

Used in ALTER TABLE to check if changing storage engine is allowed.

Note
Called without holding thr_lock.c lock.
Return values
trueChanging storage engine is allowed.
falseChanging storage engine not allowed.

Reimplemented from handler.

bool ha_innobase::check_if_incompatible_data ( HA_CREATE_INFO create_info,
uint  table_changes 
)
virtual

Part of old, deprecated in-place ALTER API.

Reimplemented from handler.

UNIV_INTERN enum_alter_inplace_result ha_innobase::check_if_supported_inplace_alter ( TABLE altered_table,
Alter_inplace_info ha_alter_info 
)
virtual

On-line ALTER TABLE interface

See Also
handler0alter.cc Check if InnoDB supports a particular alter table in-place
Parameters
altered_tableTABLE object for new version of table.
ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
Return values
HA_ALTER_INPLACE_NOT_SUPPORTEDNot supported
HA_ALTER_INPLACE_NO_LOCKSupported
HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARESupported, but requires lock during main phase and exclusive lock during prepare phase.
HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARESupported, prepare phase requires exclusive lock.
Check if InnoDB supports a particular alter table in-place
Parameters
altered_tableTABLE object for new version of table.
ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
Return values
HA_ALTER_INPLACE_NOT_SUPPORTEDNot supported
HA_ALTER_INPLACE_NO_LOCKSupported
HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARESupported, but requires lock during main phase and exclusive lock during prepare phase.
HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARESupported, prepare phase requires exclusive lock (any transactions that have accessed the table must commit or roll back first, and no transactions can access the table while prepare_inplace_alter_table() is executing)

Reimplemented from handler.

Definition at line 225 of file handler0alter.cc.

Here is the call graph for this function:

UNIV_INTERN handler * ha_innobase::clone ( const char *  name,
MEM_ROOT mem_root 
)
virtual
Parameters
namein: table name
mem_rootin: memory context

Reimplemented from handler.

Definition at line 5010 of file ha_innodb.cc.

UNIV_INTERN int ha_innobase::close ( void  )
virtual

Closes a handle to an InnoDB table.

Returns
0

Implements handler.

Definition at line 5048 of file ha_innodb.cc.

Here is the call graph for this function:

bool ha_innobase::commit_inplace_alter_table ( TABLE altered_table,
Alter_inplace_info ha_alter_info,
bool  commit 
)
virtual
Commit or rollback the changes made during

prepare_inplace_alter_table() and inplace_alter_table() inside the storage engine. Note that the allowed level of concurrency during this operation will be the same as for inplace_alter_table() and thus might be higher than during prepare_inplace_alter_table(). (E.g concurrent writes were blocked during prepare, but might not be during commit).

Parameters
altered_tableTABLE object for new version of table.
ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
committrue => Commit, false => Rollback.
Return values
trueFailure
falseSuccess

Reimplemented from handler.

UNIV_INTERN int ha_innobase::delete_row ( const uchar *  record)

Deletes a row given as the parameter.

Returns
error number or 0
Parameters
recordin: a row in MySQL format

Definition at line 7116 of file ha_innodb.cc.

Here is the call graph for this function:

int ha_innobase::delete_table ( const char *  name)
virtual

Delete a table in the engine. Called for base as well as temporary tables.

Delete all files with extension from bas_ext().

Parameters
nameBase name of table
Note
We assume that the handler may return more extensions than was actually used for the file.
Return values
0If we successfully deleted at least one file from base_ext and didn't get any other errors than ENOENT
!0Error

Reimplemented from handler.

ha_rows ha_innobase::estimate_rows_upper_bound ( void  )
virtual

Return upper bound of current number of records in the table (max. of how many records one will retrieve when doing a full table scan) If upper bound is not known, HA_POS_ERROR should be returned as a max possible upper bound.

Reimplemented from handler.

UNIV_INTERN int ha_innobase::ft_init ( )
virtual

Initialize FT index scan

Returns
0 or error number

Reimplemented from handler.

Definition at line 7984 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN FT_INFO * ha_innobase::ft_init_ext ( uint  flags,
uint  keynr,
String key 
)
virtual

Initialize FT index scan

Returns
FT_INFO structure if successful or NULL

Reimplemented from handler.

Definition at line 8008 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN int ha_innobase::ft_read ( uchar *  buf)
virtual

Fetch next result from the FT result set

Returns
error code
Parameters
bufin/out: buf contain result row

Reimplemented from handler.

Definition at line 8164 of file ha_innodb.cc.

Here is the call graph for this function:

virtual void ha_innobase::get_auto_increment ( ulonglong  offset,
ulonglong  increment,
ulonglong  nb_desired_values,
ulonglong *  first_value,
ulonglong *  nb_reserved_values 
)
virtual

Reserves an interval of auto_increment values from the handler.

Parameters
offsetoffset (modulus increment)
incrementincrement between calls
nb_desired_valueshow many values we want
[out]first_valuethe first value reserved by the handler
[out]nb_reserved_valueshow many values the handler reserved

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 ULONGLONG_MAX it means an error. If the function sets *nb_reserved_values to ULONGLONG_MAX it means it has reserved to "positive infinite".

Reimplemented from handler.

virtual bool ha_innobase::get_error_message ( int  error,
String buf 
)
virtual

Return an error message specific to this handler.

Parameters
errorerror code previously returned by handler
bufpointer to String where to add error message
Returns
Returns true if this is a temporary error

Reimplemented from handler.

virtual bool ha_innobase::get_foreign_dup_key ( char *  child_table_name,
uint  child_table_name_len,
char *  child_key_name,
uint  child_key_name_len 
)
virtual

Retrieves the names of the table and the key for which there was a duplicate entry in the case of HA_ERR_FOREIGN_DUPLICATE_KEY.

If any of the table or key name is not available this method will return false and will not change any of child_table_name or child_key_name.

Parameters
child_table_name[out]Table name
child_table_name_len[in]Table name buffer size
child_key_name[out]Key name
child_key_name_len[in]Key name buffer size
Return values
truetable and key names were available and were written into the corresponding out parameters.
falsetable and key names were not available, the out parameters were not touched.

Reimplemented from handler.

int ha_innobase::get_foreign_key_list ( THD *  thd,
List< FOREIGN_KEY_INFO > *  f_key_list 
)
virtual

Get the list of foreign keys in this table.

Remarks
Returns the set of foreign keys where this table is the dependent or child table.
Parameters
thdThe thread handle.
f_key_list[out]The list of foreign keys.
Returns
The handler error code or zero for success.

Reimplemented from handler.

longlong ha_innobase::get_memory_buffer_size ( ) const
virtual

Return an estimate on the amount of memory the storage engine will use for caching data in memory. If this is unknown or the storage engine does not cache data in memory -1 is returned.

Reimplemented from handler.

int ha_innobase::get_parent_foreign_key_list ( THD *  thd,
List< FOREIGN_KEY_INFO > *  f_key_list 
)
virtual

Get the list of foreign keys referencing this table.

Remarks
Returns the set of foreign keys where this table is the referenced or parent table.
Parameters
thdThe thread handle.
f_key_list[out]The list of foreign keys.
Returns
The handler error code or zero for success.

Reimplemented from handler.

UNIV_INTERN enum row_type ha_innobase::get_row_type ( ) const
virtual

InnoDB database tables Get the record format from the data dictionary.

Returns
one of ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_COMPRESSED, ROW_TYPE_DYNAMIC

Reimplemented from handler.

Definition at line 3850 of file ha_innodb.cc.

UNIV_INTERN class Item * ha_innobase::idx_cond_push ( uint  keyno,
class Item idx_cond 
)
virtual

Attempt to push down an index condition.

Parameters
[in]keynoMySQL key number
[in]idx_condIndex condition to be checked
Returns
idx_cond if pushed; NULL if not pushed

Attempt to push down an index condition.

Parameters
[in]keynoMySQL key number
[in]idx_condIndex condition to be checked
Returns
Part of idx_cond which the handler will not evaluate

Reimplemented from handler.

Definition at line 16708 of file ha_innodb.cc.

UNIV_INTERN int ha_innobase::index_end ( void  )
virtual

Currently does nothing.

Returns
0

Reimplemented from handler.

Definition at line 7253 of file ha_innodb.cc.

Here is the caller graph for this function:

UNIV_INTERN int ha_innobase::index_first ( uchar *  buf)
virtual

Positions a cursor on the first record in an index and reads the corresponding row to buf.

Returns
0, HA_ERR_END_OF_FILE, or error code
Parameters
bufin/out: buffer for the row

Reimplemented from handler.

Definition at line 7826 of file ha_innodb.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN ulong ha_innobase::index_flags ( uint  key,
uint  part,
bool  all_parts 
) const
virtual

Returns the operations supported for indexes.

Returns
flags of supported operations

Implements handler.

Definition at line 3945 of file ha_innodb.cc.

UNIV_INTERN int ha_innobase::index_init ( uint  keynr,
bool  sorted 
)
virtual

Initializes a handle to use an index.

Returns
0 or error number
Parameters
keynrin: key (index) number
sortedin: 1 if result MUST be sorted according to index

Reimplemented from handler.

Definition at line 7238 of file ha_innodb.cc.

UNIV_INTERN int ha_innobase::index_last ( uchar *  buf)
virtual

Positions a cursor on the last record in an index and reads the corresponding row to buf.

Returns
0, HA_ERR_END_OF_FILE, or error code
Parameters
bufin/out: buffer for the row

Reimplemented from handler.

Definition at line 7852 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN int ha_innobase::index_next ( uchar *  buf)
virtual

Reads the next row from a cursor, which must have previously been positioned using index_read.

Returns
0, HA_ERR_END_OF_FILE, or error number
Parameters
bufin/out: buffer for next row in MySQL format

Reimplemented from handler.

Definition at line 7779 of file ha_innodb.cc.

UNIV_INTERN int ha_innobase::index_next_same ( uchar *  buf,
const uchar *  key,
uint  keylen 
)
virtual

Reads the next row matching to the key value given as the parameter.

Returns
0, HA_ERR_END_OF_FILE, or error number
Parameters
bufin/out: buffer for the row
keyin: key value
keylenin: key value length

Reimplemented from handler.

Definition at line 7794 of file ha_innodb.cc.

UNIV_INTERN int ha_innobase::index_prev ( uchar *  buf)
virtual

Reads the previous row from a cursor, which must have previously been positioned using index_read.

Returns
0, HA_ERR_END_OF_FILE, or error number
Parameters
bufin/out: buffer for previous row in MySQL format

Reimplemented from handler.

Definition at line 7811 of file ha_innodb.cc.

UNIV_INTERN int ha_innobase::index_read ( uchar *  buf,
const uchar *  key_ptr,
uint  key_len,
enum ha_rkey_function  find_flag 
)
virtual

Positions an index cursor to the index specified in the handle. Fetches the row if any.

Returns
0, HA_ERR_KEY_NOT_FOUND, or error number
Parameters
bufin/out: buffer for the returned row
key_ptrin: 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_lenin: key value length
find_flagin: search flags from my_base.h

Reimplemented from handler.

Definition at line 7375 of file ha_innodb.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN int ha_innobase::index_read_idx ( uchar *  buf,
uint  keynr,
const uchar *  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 ???

Returns
error number or 0
Parameters
bufin/out: buffer for the returned row
keynrin: use this index
keyin: key value; if this is NULL we position the cursor at the start or end of index
key_lenin: key value length
find_flagin: search flags from my_base.h

Definition at line 7681 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN int ha_innobase::index_read_last ( uchar *  buf,
const uchar *  key_ptr,
uint  key_len 
)
virtual

The following functions works like index_read, but it find the last row with the current key value or prefix.

Returns
0, HA_ERR_KEY_NOT_FOUND, or an error code
Parameters
bufout: fetched row
key_ptrin: key value, or a prefix of a full key value
key_lenin: length of the key val or prefix in bytes

Reimplemented from handler.

Definition at line 7527 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN const char * ha_innobase::index_type ( uint  keynr)
virtual

Returns the index type.

Returns
index type
Parameters
keynr: index number

Reimplemented from handler.

Definition at line 3916 of file ha_innodb.cc.

UNIV_INTERN void ha_innobase::init_table_handle_for_HANDLER ( void  )
virtual

Call this when you have opened a new table handle in HANDLER, before you call index_read_idx() etc. Actually, we can let the cursor stay open even over a transaction commit! Then you should call this before every operation, fetch next etc. This function inits the necessary things even after a transaction commit.

Reimplemented from handler.

Definition at line 2699 of file ha_innodb.cc.

Here is the call graph for this function:

bool ha_innobase::inplace_alter_table ( TABLE altered_table,
Alter_inplace_info ha_alter_info 
)
virtual
Alter the table structure in-place with operations

specified using HA_ALTER_FLAGS and Alter_inplace_information. The level of concurrency allowed during this operation depends on the return value from check_if_supported_inplace_alter().

Parameters
altered_tableTABLE object for new version of table.
ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
Return values
trueFailure
falseSuccess

Reimplemented from handler.

UNIV_INTERN const key_map * ha_innobase::keys_to_use_for_scanning ( )
virtual

Returns the key map of keys that are usable for scanning.

Returns
key_map_full

Reimplemented from handler.

Definition at line 4004 of file ha_innodb.cc.

UNIV_INTERN uint ha_innobase::max_supported_key_length ( void  ) const
virtual

Returns the maximum key length.

Returns
maximum supported key length, in bytes

Reimplemented from handler.

Definition at line 3974 of file ha_innodb.cc.

UNIV_INTERN uint ha_innobase::max_supported_keys ( void  ) const
virtual

Returns the maximum number of keys.

Returns
MAX_KEY

Reimplemented from handler.

Definition at line 3963 of file ha_innodb.cc.

ha_rows ha_innobase::multi_range_read_info ( uint  keyno,
uint  n_ranges,
uint  keys,
uint *  bufsz,
uint *  flags,
Cost_estimate cost 
)
virtual

Initialize multi range read and get information.

See Also
DsMrr_impl::dsmrr_info
Parameters
keyno
seq
seq_init_param
n_ranges
bufsz
flags
cost

Reimplemented from handler.

Definition at line 16659 of file ha_innodb.cc.

ha_rows ha_innobase::multi_range_read_info_const ( uint  keyno,
RANGE_SEQ_IF seq,
void *  seq_init_param,
uint  n_ranges,
uint *  bufsz,
uint *  flags,
Cost_estimate cost 
)
virtual

Initialize multi range read and get information.

See Also
ha_myisam::multi_range_read_info_const
DsMrr_impl::dsmrr_info_const
Parameters
keyno
seq
seq_init_param
n_ranges
bufsz
flags
cost

Reimplemented from handler.

Definition at line 16643 of file ha_innodb.cc.

int ha_innobase::multi_range_read_init ( RANGE_SEQ_IF seq,
void *  seq_init_param,
uint  n_ranges,
uint  mode,
HANDLER_BUFFER buf 
)
virtual

Initialize multi range read

See Also
DsMrr_impl::dsmrr_init
Parameters
seq
seq_init_param
n_ranges
mode
bufMulti Range Read interface, DS-MRR calls

Reimplemented from handler.

Definition at line 16624 of file ha_innodb.cc.

Here is the call graph for this function:

int ha_innobase::multi_range_read_next ( char **  range_info)
virtual

Process next multi range read

See Also
DsMrr_impl::dsmrr_next
Parameters
range_info

Reimplemented from handler.

Definition at line 16636 of file ha_innodb.cc.

UNIV_INTERN int ha_innobase::open ( const char *  name,
int  mode,
uint  test_if_locked 
)
virtual

Creates and opens a handle to a table which already exists in an InnoDB database.

Returns
1 if error, 0 if success
Parameters
namein: table name
modein: not used
test_if_lockedin: not used

Implements handler.

Definition at line 4627 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN void ha_innobase::position ( const uchar *  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.

Parameters
recordin: row in MySQL format

Implements handler.

Definition at line 8318 of file ha_innodb.cc.

bool ha_innobase::prepare_inplace_alter_table ( TABLE altered_table,
Alter_inplace_info ha_alter_info 
)
virtual
Allows InnoDB to update internal structures with concurrent

writes blocked (provided that check_if_supported_inplace_alter() did not return HA_ALTER_INPLACE_NO_LOCK). This will be invoked before inplace_alter_table().

Parameters
altered_tableTABLE object for new version of table.
ha_alter_infoStructure describing changes to be done by ALTER TABLE and holding data used during in-place alter.
Return values
trueFailure
falseSuccess

Reimplemented from handler.

UNIV_INTERN bool ha_innobase::primary_key_is_clustered ( )
virtual

Determines if the primary key is clustered index.

Returns
true

Reimplemented from handler.

Definition at line 4026 of file ha_innodb.cc.

double ha_innobase::read_time ( uint  index,
uint  ranges,
ha_rows  rows 
)
virtual

The cost of reading a set of ranges from the table using an index to access it.

Parameters
indexThe index number.
rangesThe number of ranges to be read.
rowsTotal number of rows to be read.

This method can be used to calculate the total cost of scanning a table using an index by calling it using read_time(index, 1, table_size).

Reimplemented from handler.

my_bool ha_innobase::register_query_cache_table ( THD *  thd,
char *  table_key,
uint  key_length,
qc_engine_callback *  engine_callback,
ulonglong *  engine_data 
)
virtual

Register a named table with a call back function to the query cache.

Parameters
thdThe thread handle
table_keyA pointer to the table name in the table cache
key_lengthThe length of the table name
[out]engine_callbackThe pointer to the storage engine call back function
[out]engine_dataStorage engine specific data which could be anything

This method offers the storage engine, the possibility to store a reference to a table name which is going to be used with query cache. The method is called each time a statement is written to the cache and can be used to verify if a specific statement is cachable. It also offers the possibility to register a generic (but static) call back function which is called each time a statement is matched against the query cache.

Note
If engine_data supplied with this function is different from engine_data supplied with the callback function, and the callback returns FALSE, a table invalidation on the current table will occur.
Returns
Upon success the engine_callback will point to the storage engine call back function, if any, and engine_data will point to any storage engine data used in the specific implementation.
Return values
TRUESuccess
FALSEThe specified table or current statement should not be cached

Reimplemented from handler.

int ha_innobase::rename_table ( const char *  from,
const char *  to 
)
virtual

Default rename_table() and delete_table() rename/delete files with a given name and extensions from bas_ext().

These methods can be overridden, but their default implementation provide useful functionality.

Reimplemented from handler.

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 handler.

int ha_innobase::reset_auto_increment ( ulonglong  value)
virtual

Reset the auto-increment counter to the given value, i.e. the next row inserted will get the given value. HA_ERR_WRONG_COMMAND is returned by storage engines that don't support this operation.

Reimplemented from handler.

UNIV_INTERN int ha_innobase::rnd_end ( void  )
virtual

Ends a table scan.

Returns
0 or error number

Reimplemented from handler.

Definition at line 7909 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN int ha_innobase::rnd_init ( bool  scan)
virtual

Initialize a table scan.

Returns
0 or error number
Parameters
scanin: TRUE if table/index scan FALSE otherwise

Implements handler.

Definition at line 7877 of file ha_innodb.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN int ha_innobase::rnd_next ( uchar *  buf)
virtual

Reads the next row in a table scan (also used to read the FIRST row in a table scan).

Returns
0, HA_ERR_END_OF_FILE, or error number
Parameters
bufin/out: returns the row in this buffer, in MySQL format

Implements handler.

Definition at line 7921 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN int ha_innobase::rnd_pos ( uchar *  buf,
uchar *  pos 
)
virtual

Fetches a row from the table based on a row reference.

Returns
0, HA_ERR_KEY_NOT_FOUND, or error code
Parameters
bufin/out: buffer for the row
posin: 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 handler.

Definition at line 7951 of file ha_innodb.cc.

Here is the call graph for this function:

THR_LOCK_DATA** ha_innobase::store_lock ( THD *  thd,
THR_LOCK_DATA **  to,
enum thr_lock_type  lock_type 
)
virtual

Is not invoked for non-transactional temporary tables.

Note
store_lock() can return more than one lock if the table is MERGE or partitioned.
that one can NOT rely on table->in_use in store_lock(). It may refer to a different thread if called from mysql_lock_abort_for_thread().
If the table is MERGE, store_lock() can return less locks than lock_count() claimed. This can happen when the MERGE children are not attached when this is called from another thread.

Implements handler.

UNIV_INTERN uint8 ha_innobase::table_cache_type ( void  )
virtual

Determines if table caching is supported.

Returns
HA_CACHE_TBL_ASKTRANSACT

Reimplemented from handler.

Definition at line 4015 of file ha_innodb.cc.

UNIV_INTERN handler::Table_flags ha_innobase::table_flags ( void  ) const
virtual

Get the table flags to use for the statement.

Returns
table flags

Implements handler.

Definition at line 3878 of file ha_innodb.cc.

UNIV_INTERN const char * ha_innobase::table_type ( void  ) const
virtual

Returns the table type (storage engine name).

Returns
table type

Implements handler.

Definition at line 3905 of file ha_innodb.cc.

int ha_innobase::truncate ( )
virtual

Quickly remove all rows from a table.

Remarks
This method is responsible for implementing MySQL's TRUNCATE TABLE statement, which is a DDL operation. As such, a engine can bypass certain integrity checks and in some cases avoid fine-grained locking (e.g. row locks) which would normally be required for a DELETE statement.
Typically, truncate is not used if it can result in integrity violation. For example, truncate is not used when a foreign key references the table, but it might be used if foreign key checks are disabled.
Engine is responsible for resetting the auto-increment counter.
The table is locked in exclusive mode.

Reimplemented from handler.

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 handler.

Definition at line 7214 of file ha_innodb.cc.

Here is the caller graph for this function:

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 handler.

Definition at line 7165 of file ha_innodb.cc.

Here is the call graph for this function:

UNIV_INTERN int ha_innobase::update_row ( const uchar *  old_row,
uchar *  new_row 
)

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!

Returns
error number or 0
Parameters
old_rowin: old row in MySQL format
new_rowin: new row in MySQL format

Definition at line 6982 of file ha_innodb.cc.

Here is the call graph for this function:

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 handler.

Definition at line 7205 of file ha_innodb.cc.

UNIV_INTERN int ha_innobase::write_row ( uchar *  record)

Stores a row in an InnoDB database, to the table specified in this handle.

Returns
error code
Parameters
recordin: a row in MySQL format

Definition at line 6439 of file ha_innodb.cc.

Here is the call graph for this function:


The documentation for this class was generated from the following files: