27
27
#pragma interface /* gcc class implementation */
30
/** InnoDB table share */
30
31
typedef struct st_innobase_share {
32
pthread_mutex_t mutex;
33
const char* table_name;
35
void* table_name_hash;
32
THR_LOCK lock; /*!< MySQL lock protecting
34
const char* table_name; /*!< InnoDB table name */
35
uint use_count; /*!< reference count,
36
incremented in get_share()
37
and decremented in free_share() */
38
void* table_name_hash;/*!< hash table chain node */
42
/** InnoDB B-tree index */
39
43
struct dict_index_struct;
44
/** Prebuilt structures in an Innobase table handle used within MySQL */
40
45
struct row_prebuilt_struct;
47
/** InnoDB B-tree index */
42
48
typedef struct dict_index_struct dict_index_t;
49
/** Prebuilt structures in an Innobase table handle used within MySQL */
43
50
typedef struct row_prebuilt_struct row_prebuilt_t;
45
/* The class defining a handle to an Innodb table */
52
/** The class defining a handle to an Innodb table */
46
53
class ha_innobase: public handler
48
row_prebuilt_t* prebuilt; /* prebuilt struct in InnoDB, used
55
row_prebuilt_t* prebuilt; /*!< prebuilt struct in InnoDB, used
49
56
to save CPU time with prebuilt data
51
THD* user_thd; /* the thread handle of the user
58
THD* user_thd; /*!< the thread handle of the user
52
59
currently using the handle; this is
53
60
set in external_lock function */
54
61
THR_LOCK_DATA lock;
55
INNOBASE_SHARE *share;
62
INNOBASE_SHARE* share; /*!< information for MySQL
57
uchar* upd_buff; /* buffer used in updates */
58
uchar* key_val_buff; /* buffer used in converting
65
uchar* upd_buff; /*!< buffer used in updates */
66
uchar* key_val_buff; /*!< buffer used in converting
59
67
search key values from MySQL format
60
68
to Innodb format */
61
69
ulong upd_and_key_val_buff_len;
64
72
Table_flags int_table_flags;
66
ulong start_of_scan; /* this is set to 1 when we are
74
ulong start_of_scan; /*!< this is set to 1 when we are
67
75
starting a table scan but have not
68
76
yet fetched any row, else 0 */
69
77
uint last_match_mode;/* match mode of the latest search:
70
78
ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX,
72
uint num_write_row; /* number of write_row() calls */
80
uint num_write_row; /*!< number of write_row() calls */
74
82
uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
75
83
const uchar* record);
119
127
void try_semi_consistent_read(bool yes);
120
128
void unlock_row();
122
#ifdef ROW_MERGE_IS_INDEX_USABLE
123
/** Check if an index can be used by this transaction.
124
* @param keynr key number to check
125
* @return true if available, false if the index
126
* does not contain old records that exist
127
* in the read view of this transaction */
128
bool is_index_available(uint keynr);
129
#endif /* ROW_MERGE_IS_INDEX_USABLE */
130
130
int index_init(uint index, bool sorted);
132
132
int index_read(uchar * buf, const uchar * key,
262
262
typedef struct trx_struct trx_t;
263
/************************************************************************
263
/********************************************************************//**
264
@file handler/ha_innodb.h
264
265
Converts an InnoDB error code to a MySQL error code and also tells to MySQL
265
266
about a possible transaction rollback inside InnoDB caused by a lock wait
266
timeout or a deadlock. */
267
timeout or a deadlock.
268
@return MySQL error code */
269
271
convert_error_code_to_mysql(
270
272
/*========================*/
271
/* out: MySQL error code */
272
int error, /* in: InnoDB error code */
273
ulint flags, /* in: InnoDB table flags, or 0 */
274
MYSQL_THD thd); /* in: user thread handle or NULL */
273
int error, /*!< in: InnoDB error code */
274
ulint flags, /*!< in: InnoDB table flags, or 0 */
275
MYSQL_THD thd); /*!< in: user thread handle or NULL */
276
/*************************************************************************
277
Allocates an InnoDB transaction for a MySQL handler object. */
277
/*********************************************************************//**
278
Allocates an InnoDB transaction for a MySQL handler object.
279
@return InnoDB transaction handle */
280
282
innobase_trx_allocate(
281
283
/*==================*/
282
/* out: InnoDB transaction handle */
283
MYSQL_THD thd); /* in: user thread handle */
284
MYSQL_THD thd); /*!< in: user thread handle */