MySQL 8.0.29
Source Code Documentation
dd_trigger.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2016, 2021, 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 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
29struct MEM_ROOT;
30class THD;
31class Trigger;
32
33template <class T>
34class List;
35
36namespace dd {
37class 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
55bool 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
75bool 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
94bool 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 */
Definition: sql_list.h:433
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:945
This class represents a trigger object.
Definition: trigger.h:73
Definition: table.h:46
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
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
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:357
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
const char * table_name
Definition: rules_table_service.cc:55
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: mysql_lex_string.h:39
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:63