MySQL 8.4.0
Source Code Documentation
dd_trigger.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2016, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
24#ifndef DD_TRIGGER_INCLUDED
25#define DD_TRIGGER_INCLUDED
26
27#include "lex_string.h"
28#include "sql/trigger_def.h" // enum_trigger_order_type
29
30struct MEM_ROOT;
31class THD;
32class Trigger;
33
34template <class T>
35class List;
36
37namespace dd {
38class Table;
39
40/**
41 Create new trigger in the data dictionary.
42
43 @param [in] thd thread handle
44 @param [in] new_trigger Trigger object from sql-layer that describes
45 a trigger to add in the Data Dictionary
46 @param [in] ordering_clause Ordering property for trigger being created
47 @param [in] referenced_trigger_name Information about trigger referenced by
48 ordering_clause if any.
49
50
51 @return Operation status
52 @retval true Failure
53 @retval false Success
54*/
55
56bool create_trigger(THD *thd, const ::Trigger *new_trigger,
57 enum_trigger_order_type ordering_clause,
58 const LEX_CSTRING &referenced_trigger_name);
59
60/**
61 Load table triggers from the data dictionary.
62
63 @param [in] thd thread handle
64 @param [in] mem_root MEM_ROOT for memory allocation
65 @param [in] schema_name name of schema
66 @param [in] table_name subject table name
67 @param [in] table table object
68 @param [out] triggers pointer to the list where new Trigger
69 objects will be inserted
70
71 @return Operation status
72 @retval true Failure
73 @retval false Success
74*/
75
76bool load_triggers(THD *thd, MEM_ROOT *mem_root, const char *schema_name,
77 const char *table_name, const dd::Table &table,
78 List<::Trigger> *triggers);
79
80/**
81 Check in the data dictionary if there is any trigger associated with a table.
82
83 @param [in] thd thread handle
84 @param [in] schema_name name of schema
85 @param [in] table_name subject table name
86 @param [out] table_has_trigger true in case there is trigger(s) for a table,
87 else false
88
89 @return Operation status
90 @retval true Failure
91 @retval false Success
92
93*/
94
95bool table_has_triggers(THD *thd, const char *schema_name,
96 const char *table_name, bool *table_has_trigger);
97
98} // namespace dd
99
100#endif /* DD_TRIGGER_INCLUDED */
Definition: sql_list.h:467
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
This class represents a trigger object.
Definition: trigger.h:75
Definition: table.h:47
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
bool create_trigger(THD *thd, const ::Trigger *new_trigger, enum_trigger_order_type ordering_clause, const LEX_CSTRING &referenced_trigger_name)
Create new trigger in the data dictionary.
Definition: dd_trigger.cc:183
bool table_has_triggers(THD *thd, const char *schema_name, const char *table_name, bool *table_has_trigger)
Check in the data dictionary if there is any trigger associated with a table.
Definition: dd_trigger.cc:363
bool load_triggers(THD *thd, MEM_ROOT *mem_root, const char *schema_name, const char *table_name, const dd::Table &table, List<::Trigger > *triggers)
Load table triggers from the data dictionary.
Definition: dd_trigger.cc:286
const char * table_name
Definition: rules_table_service.cc:56
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: mysql_lex_string.h:40
This file defines all base public constants related to triggers in MySQL.
enum_trigger_order_type
Possible trigger ordering clause values:
Definition: trigger_def.h:64