MySQL  8.0.19
Source Code Documentation
dd_trigger.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
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 also distributed 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 included with MySQL.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License, version 2.0, for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23 #ifndef DD_TRIGGER_INCLUDED
24 #define DD_TRIGGER_INCLUDED
25 
26 #include "lex_string.h"
27 #include "sql/trigger_def.h" // enum_trigger_order_type
28 
29 struct MEM_ROOT;
30 class THD;
31 class Trigger;
32 
33 template <class T>
34 class List;
35 
36 namespace dd {
37 class Table;
38 
39 /**
40  Create new trigger in the data dictionary.
41 
42  @param [in] thd thread handle
43  @param [in] new_trigger Trigger object from sql-layer that describes
44  a trigger to add in the Data Dictionary
45  @param [in] ordering_clause Ordering property for trigger being created
46  @param [in] referenced_trigger_name Information about trigger referenced by
47  ordering_clause if any.
48 
49 
50  @return Operation status
51  @retval true Failure
52  @retval false Success
53 */
54 
55 bool create_trigger(THD *thd, const ::Trigger *new_trigger,
56  enum_trigger_order_type ordering_clause,
57  const LEX_CSTRING &referenced_trigger_name);
58 
59 /**
60  Load table triggers from the data dictionary.
61 
62  @param [in] thd thread handle
63  @param [in] mem_root MEM_ROOT for memory allocation
64  @param [in] schema_name name of schema
65  @param [in] table_name subject table name
66  @param [in] table table object
67  @param [out] triggers pointer to the list where new Trigger
68  objects will be inserted
69 
70  @return Operation status
71  @retval true Failure
72  @retval false Success
73 */
74 
75 bool load_triggers(THD *thd, MEM_ROOT *mem_root, const char *schema_name,
76  const char *table_name, const dd::Table &table,
77  List<::Trigger> *triggers);
78 
79 /**
80  Check in the data dictionary if there is any trigger associated with a table.
81 
82  @param [in] thd thread handle
83  @param [in] schema_name name of schema
84  @param [in] table_name subject table name
85  @param [out] table_has_trigger true in case there is trigger(s) for a table,
86  else false
87 
88  @return Operation status
89  @retval true Failure
90  @retval false Success
91 
92 */
93 
94 bool table_has_triggers(THD *thd, const char *schema_name,
95  const char *table_name, bool *table_has_trigger);
96 
97 } // namespace dd
98 
99 #endif /* DD_TRIGGER_INCLUDED */
MYSQL_LEX_CSTRING
Definition: mysql_lex_string.h:39
THD
Definition: sql_class.h:764
trigger_def.h
This file defines all base public constants related to triggers in MySQL.
rules_table_service::table_name
const char * table_name
Definition: rules_table_service.cc:55
dd::create_trigger
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:177
mem_root
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
dd
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
Table
Definition: test_sql_stmt.cc:150
dd::load_triggers
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:280
MEM_ROOT
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
lex_string.h
enum_trigger_order_type
enum_trigger_order_type
Possible trigger ordering clause values:
Definition: trigger_def.h:63
Trigger
This class represents a trigger object.
Definition: trigger.h:73
dd::Table
Definition: table.h:45
List
Definition: aggregate_check.h:523
dd::table_has_triggers
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:356