MySQL  8.0.24
Source Code Documentation
Trigger_chain Class Reference

#include <trigger_chain.h>

Public Member Functions

 Trigger_chain ()
 
 ~Trigger_chain ()
 
List< Trigger > & get_trigger_list ()
 
bool add_trigger (MEM_ROOT *mem_root, Trigger *new_trigger, enum_trigger_order_type ordering_clause, const LEX_CSTRING &referenced_trigger_name)
 Add a new trigger into the list of triggers with the same ACTION/TIMING value combination. More...
 
bool add_trigger (MEM_ROOT *mem_root, Trigger *new_trigger)
 Add a new trigger into the list of triggers with the same ACTION/TIMING value combination. More...
 
bool execute_triggers (THD *thd)
 Run every trigger in the list of triggers. More...
 
void add_tables_and_routines (THD *thd, Query_tables_list *prelocking_ctx, TABLE_LIST *table_list)
 Iterate over the list of triggers and add tables and routines used by trigger to the set of elements used by statement. More...
 
void mark_fields (TABLE *subject_table)
 Iterate over the list of triggers and mark fields of subject table which we read/set in every trigger. More...
 
bool has_updated_trigger_fields (const MY_BITMAP *used_fields)
 Iterate over the list of triggers and check whether some table's fields are used in any trigger. More...
 

Private Attributes

List< Triggerm_triggers
 List of triggers of this chain. More...
 

Constructor & Destructor Documentation

◆ Trigger_chain()

Trigger_chain::Trigger_chain ( )
inline

◆ ~Trigger_chain()

Trigger_chain::~Trigger_chain ( )

Member Function Documentation

◆ add_tables_and_routines()

void Trigger_chain::add_tables_and_routines ( THD thd,
Query_tables_list prelocking_ctx,
TABLE_LIST table_list 
)

Iterate over the list of triggers and add tables and routines used by trigger to the set of elements used by statement.

Parameters
[in]thdthread context
[in,out]prelocking_ctxprelocking context of the statement
[in]table_listTABLE_LIST for the table

◆ add_trigger() [1/2]

bool Trigger_chain::add_trigger ( MEM_ROOT mem_root,
Trigger new_trigger 
)

Add a new trigger into the list of triggers with the same ACTION/TIMING value combination.

This method is called when a trigger is loaded from Data Dictionary.

Parameters
mem_rootmemory root for allocations
new_triggerpointer to the Trigger to add into the list
Returns
Operation status.
Return values
falseSuccess.
trueFailure.

◆ add_trigger() [2/2]

bool Trigger_chain::add_trigger ( MEM_ROOT mem_root,
Trigger new_trigger,
enum_trigger_order_type  ordering_clause,
const LEX_CSTRING referenced_trigger_name 
)

Add a new trigger into the list of triggers with the same ACTION/TIMING value combination.

This method is called during handling of statement CREATE TRIGGER.

Parameters
mem_rootmemory root for allocations
new_triggerpointer to the Trigger to add into the list
ordering_clausetrigger ordering clause (FOLLOWS/PRECEDES)
referenced_trigger_nametrigger name referenced by clause FOLLOWS/PRECEDES in the CREATE TRIGGER statement
Returns
Operation status.
Return values
falseSuccess.
trueFailure: either trigger not found or OOM. Set error in Diagnostic_area in case when trigger not found.

◆ execute_triggers()

bool Trigger_chain::execute_triggers ( THD thd)

Run every trigger in the list of triggers.

Parameters
thdThread context
Returns
Result of trigger execution
Return values
falseall triggers in the list were executed successfully.
truesome trigger was failed. We stop triggers execution on the first failed trigger and don't attempt to finish the rest of triggers located after the failed one.

◆ get_trigger_list()

List<Trigger>& Trigger_chain::get_trigger_list ( )
inline
Returns
a reference to the list of triggers with the same EVENT/ACTION_TIME assigned to the table.

◆ has_updated_trigger_fields()

bool Trigger_chain::has_updated_trigger_fields ( const MY_BITMAP used_fields)

Iterate over the list of triggers and check whether some table's fields are used in any trigger.

Parameters
[in]used_fieldsbitmap of fields to check
Returns
Check result
Return values
trueSome table fields are used in trigger
falseNone of table fields are used in trigger

◆ mark_fields()

void Trigger_chain::mark_fields ( TABLE subject_table)

Iterate over the list of triggers and mark fields of subject table which we read/set in every trigger.

Parameters
[in]subject_tabletrigger subject table

Member Data Documentation

◆ m_triggers

List<Trigger> Trigger_chain::m_triggers
private

List of triggers of this chain.


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