Drizzled Public API Documentation

ha_innobase Class Reference

#include <ha_innodb.h>

Inheritance diagram for ha_innobase:
drizzled::Cursor

List of all members.

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 () const
uint64_t getAutoIncrement () const
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 *)
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 *)
int ha_disable_indexes (uint32_t mode)
int ha_enable_indexes (uint32_t mode)
int ha_discard_or_import_tablespace (bool discard)
void closeMarkForDelete ()
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_tinnobase_get_index (uint keynr)

Private Attributes

row_prebuilt_tprebuilt
Sessionuser_session
THR_LOCK_DATA lock
INNOBASE_SHAREshare
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

Detailed Description

The class defining a handle to an Innodb table

Definition at line 80 of file ha_innodb.h.


Constructor & Destructor Documentation

UNIV_INTERN ha_innobase::ha_innobase ( plugin::StorageEngine &  engine_arg,
Table table_arg 
)

Construct ha_innobase Cursor.

Definition at line 1655 of file ha_innodb.cc.

UNIV_INTERN ha_innobase::~ha_innobase ( )

Destruct ha_innobase Cursor.

Definition at line 1669 of file ha_innodb.cc.


Member Function Documentation

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.

Returns:
returns always 0 (success)
Parameters:
sessionin: connection thread handle

Reimplemented from drizzled::Cursor.

Definition at line 7536 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).

Returns:
TRUE if can switch engines

Reimplemented from drizzled::Cursor.

Definition at line 7945 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
UNIV_INTERN int ha_innobase::check ( Session session)
virtual
UNIV_INTERN int ha_innobase::close ( void  )
virtual

Closes a handle to an InnoDB table.

Returns:
0

Implements drizzled::Cursor.

Definition at line 3744 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 ( )
inherited

Drop table in the engine: public interface.

See also:
Cursor::drop_table()

Definition at line 735 of file cursor.cc.

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.

Returns:
< 0 if ref1 < ref2, 0 if equal, else > 0
Parameters:
ref1in: an (internal) primary key value in the MySQL key value format
ref2in: an (internal) primary key value in the MySQL key value format

Reimplemented from drizzled::Cursor.

Definition at line 8886 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.

Parameters:
rangerange to compare to row. May be 0 for no range

key.cc::key_cmp()

Returns:
The return value is SIGN(key_in_row - range_key):
  • 0 : Key is equal to range or 'range' == 0 (no range)
  • -1 : Key is less than range
  • 1 : Key is larger than range

Definition at line 1191 of file cursor.cc.

References drizzled::key_cmp().

UNIV_INTERN int ha_innobase::delete_all_rows ( void  )
virtual

Deletes all rows of an InnoDB table.

Returns:
error number

Reimplemented from drizzled::Cursor.

Definition at line 6591 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
UNIV_INTERN int ha_innobase::doDeleteRecord ( const unsigned char *  record)
virtual
UNIV_INTERN int ha_innobase::doEndIndexScan ( void  )
virtual

Currently does nothing.

Returns:
0

Reimplemented from drizzled::Cursor.

Definition at line 5173 of file ha_innodb.cc.

Referenced by doEndTableScan().

UNIV_INTERN int ha_innobase::doEndTableScan ( void  )
virtual

Ends a table scan.

Returns:
0 or error number

Reimplemented from drizzled::Cursor.

Definition at line 5755 of file ha_innodb.cc.

References doEndIndexScan().

UNIV_INTERN int ha_innobase::doStartIndexScan ( uint  keynr,
bool  sorted 
)

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

Definition at line 5160 of file ha_innodb.cc.

References change_active_index().

UNIV_INTERN int ha_innobase::doStartTableScan ( bool  scan)
virtual

Initialize a table scan.

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

Implements drizzled::Cursor.

Definition at line 5723 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!

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

Reimplemented from drizzled::Cursor.

Definition at line 4915 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.

Returns:
upper bound of rows

Reimplemented from drizzled::Cursor.

Definition at line 7048 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.

Returns:
0
Parameters:
sessionin: handle to the user thread
lock_typein: lock type

Reimplemented from drizzled::Cursor.

Definition at line 8099 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.

Returns:
0 or error number
Parameters:
operationin: HA_EXTRA_FLUSH or some other flag

Reimplemented from drizzled::Cursor.

Definition at line 8001 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.

Parameters:
strin, own: create info string to free

Reimplemented from drizzled::Cursor.

Definition at line 7989 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.

Returns:
0, HA_ERR_END_OF_FILE, or error number

Definition at line 5578 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)

Parameters:
offsetin: table autoinc offset
incrementin: table autoinc increment
nb_desired_valuesin: number of values reqd
first_valueout: the autoinc value
nb_reserved_valuesout: count of reserved values

Implements drizzled::Cursor.

Definition at line 8731 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.

Returns:
own: character string in the form which can be inserted to the CREATE TABLE statement, MUST be freed with ha_innobase::free_foreign_key_create_info

Reimplemented from drizzled::Cursor.

Definition at line 7793 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.

uint64_t drizzled::Cursor::getAutoIncrement ( ) const
inlineinherited

Used by SHOW TABLE STATUS to get the current auto_inc from the engine

Definition at line 181 of file cursor.h.

UNIV_INTERN plugin::TransactionalStorageEngine* ha_innobase::getTransactionalEngine ( )
inline

Returns the plugin::TransactionStorageEngine pointer of the cursor's underlying engine.

Todo:

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)
inherited

Analyze table: public interface.

See also:
Cursor::analyze()

Definition at line 680 of file cursor.cc.

int drizzled::Cursor::ha_delete_all_rows ( )
inherited

Delete all rows: public interface.

See also:
Cursor::delete_all_rows()
Note:

This is now equalivalent to TRUNCATE TABLE.

Trigger post-truncate notification to plugins...

Todo:
Make TransactionServices generic to AfterTriggerServices or similar...

Definition at line 636 of file cursor.cc.

Referenced by drizzled::select_union::cleanup(), and drizzled::delete_query().

int drizzled::Cursor::ha_disable_indexes ( uint32_t  mode)
inherited

Disable indexes: public interface.

See also:
Cursor::disable_indexes()

Definition at line 694 of file cursor.cc.

Referenced by drizzled::alter_table_manage_keys().

int drizzled::Cursor::ha_discard_or_import_tablespace ( bool  discard)
inherited

Discard or import tablespace: public interface.

See also:
Cursor::discard_or_import_tablespace()

Definition at line 723 of file cursor.cc.

int drizzled::Cursor::ha_enable_indexes ( uint32_t  mode)
inherited

Enable indexes: public interface.

See also:
Cursor::enable_indexes()

Definition at line 709 of file cursor.cc.

Referenced by drizzled::alter_table_manage_keys().

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 1314 of file cursor.cc.

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 216 of file cursor.cc.

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

Parameters:
offset
increment
nb_desired_valueshow 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 576 of file cursor.cc.

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 1376 of file cursor.cc.

Referenced by drizzled::Open_tables_state::free_cached_table().

int drizzled::Cursor::ha_reset_auto_increment ( uint64_t  value)
inherited

Reset auto increment: public interface.

See also:
Cursor::reset_auto_increment()

Definition at line 665 of file cursor.cc.

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.

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

Reimplemented from drizzled::Cursor.

Definition at line 5674 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.

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

Reimplemented from drizzled::Cursor.

Definition at line 5699 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.

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

Reimplemented from drizzled::Cursor.

Definition at line 5627 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.

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

Definition at line 5642 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 
)
virtualinherited

Calculate cost of 'index only' scan for given index and number of records

Parameters:
keynrIndex number
recordsEstimated number of records to be retrieved
Note:
It is assumed that we will read trough the whole key range and that all key blocks are half full (normally things are much better). It is also assumed that each time we read the next key from the index, the Cursor performs a random seek, thus the cost is proportional to the number of blocks read.
Todo:
Consider joining this function and Cursor::read_time() into one Cursor::read_time(keynr, records, ranges, bool index_only) function.
Returns:
Estimated cost of 'index only' scan

Definition at line 817 of file cursor.cc.

Referenced by drizzled::best_access_path().

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.

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

Reimplemented from drizzled::Cursor.

Definition at line 5659 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.

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

Definition at line 5301 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 ???

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

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

Definition at line 5424 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.

Parameters:
key_numberout: index type

Definition at line 3042 of file ha_innodb.cc.

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.

Returns:
DB_SUCCESS or error code
Parameters:
valueout: autoinc value

Definition at line 8671 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.

Returns:
NULL or index instance.
Parameters:
keynrin: use this index; MAX_KEY means always clustered index, even if it was internally generated by InnoDB

Definition at line 5440 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_index_struct::name, dict_table_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
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.

Returns:
DB_SUCCESS if all OK else error code

Definition at line 4474 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.

Returns:
the autoinc value

Definition at line 8697 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.

Returns:
DB_SUCCESS if all went well else error code
Parameters:
autoincin: value to store

Definition at line 4489 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.

Returns:
DB_SUCCESS if all went well else error code
Parameters:
auto_incin: value to store

Definition at line 4506 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 
)
virtualinherited

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

Returns:
key_map_full

Reimplemented from drizzled::Cursor.

Definition at line 3082 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 
)
virtualinherited

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.

Parameters:
keynoIndex number
n_rangesEstimated number of ranges (i.e. intervals) in the range sequence.
n_rowsEstimated total number of records contained within all of the ranges
bufszINOUT 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.
flagsINOUT A combination of HA_MRR_* flags
costOUT Estimated cost of MRR access
Return values:
0OK, *cost contains cost of the scan, *bufsz and *flags contain scan parameters.
otherError or can't perform the requested scan

Definition at line 949 of file cursor.cc.

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 
)
virtualinherited

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.

Parameters:
keynoIndex number
seqRange sequence to be traversed
seq_init_paramFirst parameter for seq->init()
n_ranges_argNumber of ranges in the sequence, or 0 if the caller can't efficiently determine it
bufszINOUT 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.
flagsINOUT A combination of HA_MRR_* flags
costOUT Estimated cost of MRR access
Note:
This method (or an overriding one in a derived class) must check for session->getKilled() and return HA_POS_ERROR if it is not zero. This is required for a user to be able to interrupt the calculation by killing the connection/query.
Return values:
HA_POS_ERRORError or the engine is unable to perform the requested scan. Values of OUT parameters are undefined.
otherOK, *cost contains cost of the scan, *bufsz and *flags contain scan parameters.

Definition at line 862 of file cursor.cc.

References 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 
)
virtualinherited

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

Parameters:
seqRange sequence to be traversed
seq_init_paramFirst parameter for seq->init()
n_rangesNumber of ranges in the sequence
modeFlags, see the description section for the details
bufINOUT: memory buffer to be used
Note:
One must have called doStartIndexScan() before calling this function. Several multi_range_read_init() calls may be made in course of one query.

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.

Return values:
0OK
1Error

Definition at line 1010 of file cursor.cc.

int drizzled::Cursor::multi_range_read_next ( char **  range_info)
virtualinherited

Get next record in MRR scan

Default MRR implementation: read the next record

Parameters:
range_infoOUT Undefined if HA_MRR_NO_ASSOCIATION flag is in effect Otherwise, the opaque value associated with the range that contains the returned record.
Return values:
0OK
otherError code

Definition at line 1035 of file cursor.cc.

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.

Parameters:
recordin: row in MySQL format

Implements drizzled::Cursor.

Definition at line 5849 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.

Returns:
true

Reimplemented from drizzled::Cursor.

Definition at line 3093 of file ha_innodb.cc.

int drizzled::Cursor::read_first_row ( unsigned char *  buf,
uint32_t  primary_key 
)
virtualinherited

Read first row (only) from a table.

This is never called for InnoDB tables, as these table types has the HA_STATS_RECORDS_IS_EXACT set.

Definition at line 255 of file cursor.cc.

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)

See also:
handler0alter.cc

Reimplemented from drizzled::Cursor.

Definition at line 9488 of file ha_innodb.cc.

int ha_innobase::read_range_next ( )
virtual

Read next row between two endpoints.

Note:
Record is read into table->getInsertRecord()
Return values:
0Found row
HA_ERR_END_OF_FILENo rows in range
\::Error code

Reimplemented from drizzled::Cursor.

Definition at line 9503 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.

Returns:
estimated time measured in disk seeks
Parameters:
indexin: key number
rangesin: how many ranges
rowsin: estimated number of rows in the ranges

Definition at line 7117 of file ha_innodb.cc.

References estimate_rows_upper_bound(), and scan_time().

ha_rows drizzled::Cursor::records ( )
virtualinherited

Number of rows in table. It will only be called if (table_flags() & (HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT)) != 0

Definition at line 201 of file cursor.cc.

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.

Returns:
estimated number of rows
Parameters:
keynrin: index number
min_keyin: start key value of the range, may also be 0
max_keyin: range end key val, may also be 0

Definition at line 6931 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.

Returns:
> 0 if referenced by a FOREIGN KEY

Reimplemented from drizzled::Cursor.

Definition at line 7973 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 8057 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.

Returns:
0 or error code
Parameters:
valuein: new value for table autoinc

Reimplemented from drizzled::Cursor.

Definition at line 8838 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).

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

Implements drizzled::Cursor.

Definition at line 5767 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.

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 drizzled::Cursor.

Definition at line 5796 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.

Returns:
estimated time measured in disk seeks

Reimplemented from drizzled::Cursor.

Definition at line 7100 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.

Returns:
key value length as stored in buff
Parameters:
keynrin: key number
buffin/out: buffer for the key value (in MySQL format)
buff_lenin: buffer length
recordin: row in MySQL format

Definition at line 4029 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.

Returns:
pointer to the next element in the 'to' array
Parameters:
sessionin: user thread handle
toin: pointer to an array of pointers to lock structs; pointer to the 'lock' field of current handle is stored next to this array
lock_typein: lock type to store in 'lock'; this may also be TL_IGNORE

Reimplemented from drizzled::Cursor.

Definition at line 8530 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 5136 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 5095 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)
inlineprivate

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.

Parameters:
sessionin: thd to use the handle

Definition at line 1679 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.

Returns:
table comment + InnoDB free space + info on foreign keys
Parameters:
commentin: table comment defined by user

Definition at line 7718 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 5127 of file ha_innodb.cc.

References prebuilt, and row_prebuilt_struct::row_read_type.


Member Data Documentation

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 197 of file cursor.h.

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 192 of file cursor.h.

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 148 of file cursor.h.

bool drizzled::Cursor::mrr_have_range
inherited

true <=> we're currently traversing a range in mrr_cur_range.

Definition at line 143 of file cursor.h.

range_seq_t drizzled::Cursor::mrr_iter
inherited

MultiRangeRead-related members:

Definition at line 135 of file cursor.h.

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 172 of file cursor.h.

uint ha_innobase::num_write_row
private

number of doInsertRecord() calls

Definition at line 106 of file ha_innodb.h.

Referenced by doInsertRecord().

uint32_t drizzled::Cursor::ref_length
inherited

Length of ref (1-8 or the clustered key length)

Definition at line 159 of file cursor.h.

Referenced by doOpen(), 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 151 of file cursor.h.

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().


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