List of all members.
Public Member Functions |
bool | open_table (THD *thd, const LEX_STRING dbstr, const LEX_STRING tbstr, uint max_num_field, enum thr_lock_type lock_type, TABLE **table, Open_tables_backup *backup) |
bool | close_table (THD *thd, TABLE *table, Open_tables_backup *backup, bool error) |
enum enum_return_id | find_info (Rpl_info_values *field_values, TABLE *table) |
enum enum_return_id | scan_info (TABLE *table, uint instance) |
bool | count_info (TABLE *table, uint *counter) |
bool | load_info_values (uint max_num_field, Field **fields, Rpl_info_values *field_values) |
bool | store_info_values (uint max_num_field, Field **fields, Rpl_info_values *field_values) |
THD * | create_thd () |
bool | drop_thd (THD *thd) |
Member Function Documentation
Commits the changes, unlocks the table and closes it. This method needs to be called even if the open_table fails, in order to ensure the lock info is properly restored.
- Parameters:
-
[in] | thd | Thread requesting to close the table |
[in] | table | Table to be closed |
[in] | backup | Restore the lock info from here |
[in] | error | If there was an error while updating the table |
If there is an error, rolls back the current statement. Otherwise, commits it. However, if a new thread was created and there is an error, the transaction must be rolled back. Otherwise, it must be committed. In this case, the changes were not done on behalf of any user transaction and if not finished, there would be pending changes.
- Returns:
- Return values:
-
FALSE | No error |
TRUE | Failure |
Returns the number of entries in table.
The code built on top of this function needs to ensure there is no concurrent threads trying to update the table. So if an error different from HA_ERR_END_OF_FILE is returned, we abort with an error because this implies that someone has manualy and concurrently changed something.
- Parameters:
-
[in] | table | Table |
[out] | counter | Registers the number of entries. |
- Returns:
- Return values:
-
false | No error |
true | Failure |
Creates a new thread if necessary. In the bootstrap process or in the mysqld startup, a thread is created in order to be able to access a table. Otherwise, the current thread is used.
- Returns:
- Return values:
-
THD* | Pointer to thread structure |
Destroys the created thread if necessary and restores the system_thread information.
- Parameters:
-
[in] | thd | Thread requesting to be destroyed |
- Returns:
- Return values:
-
FALSE | No error |
TRUE | Failure |
Positions the internal pointer of `table` according to the primary key.
If the search succeeds, the table cursor points to the found row.
- Parameters:
-
[in,out] | field_values | The sequence of values |
[in,out] | table | Table |
- Returns:
- Return values:
-
FOUND | The row was found. |
NOT_FOUND | The row was not found. |
ERROR | There was a failure. |
Reads information from a sequence of fields into a set of LEX_STRING structures, where the sequence of values is specified through the object Rpl_info_values.
- Parameters:
-
[in] | max_num_field | Maximum number of fields |
[in] | fields | The sequence of fields |
[in] | field_values | The sequence of values |
- Returns:
- Return values:
-
FALSE | No error |
TRUE | Failure |
bool Rpl_info_table_access::open_table |
( |
THD * |
thd, |
|
|
const LEX_STRING |
dbstr, |
|
|
const LEX_STRING |
tbstr, |
|
|
uint |
max_num_field, |
|
|
enum thr_lock_type |
lock_type, |
|
|
TABLE ** |
table, |
|
|
Open_tables_backup * |
backup |
|
) |
| |
Opens and locks a table.
It's assumed that the caller knows what they are doing:
- whether it was necessary to reset-and-backup the open tables state
- whether the requested lock does not lead to a deadlock
- whether this open mode would work under LOCK TABLES, or inside a stored function or trigger.
Note that if the table can't be locked successfully this operation will close it. Therefore it provides guarantee that it either opens and locks table or fails without leaving any tables open.
- Parameters:
-
[in] | thd | Thread requesting to open the table |
[in] | dbstr | Database where the table resides |
[in] | tbstr | Table to be openned |
[in] | max_num_field | Maximum number of fields |
[in] | lock_type | How to lock the table |
[out] | table | We will store the open table here |
[out] | backup | Save the lock info. here |
- Returns:
- Return values:
-
TRUE | open and lock failed - an error message is pushed into the stack |
FALSE | success |
Positions the internal pointer of `table` to the n-instance row.
- Parameters:
-
[in] | table | Reference to a table object. |
[in] | instance | n-instance row. |
The code built on top of this function needs to ensure there is no concurrent threads trying to update the table. So if an error different from HA_ERR_END_OF_FILE is returned, we abort with an error because this implies that someone has manualy and concurrently changed something.
- Returns:
- Return values:
-
FOUND | The row was found. |
NOT_FOUND | The row was not found. |
ERROR | There was a failure. |
Stores information from a sequence of fields into a set of LEX_STRING structures, where the sequence of values is specified through the object Rpl_info_values.
- Parameters:
-
[in] | max_num_field | Maximum number of fields |
[in] | fields | The sequence of fields |
[in] | field_values | The sequence of values |
- Returns:
- Return values:
-
FALSE | No error |
TRUE | Failure |
The documentation for this class was generated from the following files: