MySQL  8.0.27
Source Code Documentation
trigger.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 2021, Oracle and/or its affiliates.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef DD__TRIGGER_INCLUDED
24 #define DD__TRIGGER_INCLUDED
25 
26 #include <time.h>
27 
28 #ifdef _WIN32
29 #include <winsock2.h> // timeval
30 #endif
31 
32 #include "my_inttypes.h"
33 #include "sql/dd/sdi_fwd.h" // dd::Sdi_wcontext
34 #include "sql/dd/types/entity_object.h" // dd::Entity_object
35 
36 struct MDL_key;
37 struct CHARSET_INFO;
38 
39 namespace dd {
40 
41 ///////////////////////////////////////////////////////////////////////////
42 
43 class Trigger_impl;
44 
45 namespace tables {
46 class Triggers;
47 }
48 
49 ///////////////////////////////////////////////////////////////////////////
50 
51 /// Class representing a Trigger in DD framework.
52 class Trigger : virtual public Entity_object {
53  public:
54  typedef Trigger_impl Impl;
56 
57  public:
59 
60  enum class enum_action_timing { AT_BEFORE = 1, AT_AFTER };
61 
62  public:
63  ~Trigger() override = default;
64 
65  /////////////////////////////////////////////////////////////////////////
66  // schema.
67  /////////////////////////////////////////////////////////////////////////
68 
69  virtual Object_id schema_id() const = 0;
70 
71  /////////////////////////////////////////////////////////////////////////
72  // table.
73  /////////////////////////////////////////////////////////////////////////
74 
75  virtual Object_id table_id() const = 0;
76 
77  /////////////////////////////////////////////////////////////////////////
78  // Trigger type.
79  /////////////////////////////////////////////////////////////////////////
80 
81  virtual enum_event_type event_type() const = 0;
83 
84  /////////////////////////////////////////////////////////////////////////
85  // action_timing.
86  /////////////////////////////////////////////////////////////////////////
87 
88  virtual enum_action_timing action_timing() const = 0;
90 
91  /////////////////////////////////////////////////////////////////////////
92  // action_order.
93  /////////////////////////////////////////////////////////////////////////
94 
95  virtual uint action_order() const = 0;
96  virtual void set_action_order(uint action_order) = 0;
97 
98  /////////////////////////////////////////////////////////////////////////
99  // action_statement
100  /////////////////////////////////////////////////////////////////////////
101 
102  virtual const String_type &action_statement() const = 0;
104 
105  virtual const String_type &action_statement_utf8() const = 0;
108 
109  /////////////////////////////////////////////////////////////////////////
110  // created.
111  /////////////////////////////////////////////////////////////////////////
112 
113  virtual timeval created() const = 0;
114  virtual void set_created(timeval created) = 0;
115 
116  /////////////////////////////////////////////////////////////////////////
117  // last altered.
118  /////////////////////////////////////////////////////////////////////////
119 
120  virtual timeval last_altered() const = 0;
121  virtual void set_last_altered(timeval last_altered) = 0;
122 
123  /////////////////////////////////////////////////////////////////////////
124  // sql_mode
125  /////////////////////////////////////////////////////////////////////////
126 
127  virtual ulonglong sql_mode() const = 0;
128  virtual void set_sql_mode(ulonglong sql_mode) = 0;
129 
130  /////////////////////////////////////////////////////////////////////////
131  // definer.
132  /////////////////////////////////////////////////////////////////////////
133 
134  virtual const String_type &definer_user() const = 0;
135  virtual const String_type &definer_host() const = 0;
136  virtual void set_definer(const String_type &username,
137  const String_type &hostname) = 0;
138 
139  /////////////////////////////////////////////////////////////////////////
140  // collations.
141  /////////////////////////////////////////////////////////////////////////
142 
143  virtual Object_id client_collation_id() const = 0;
145 
146  virtual Object_id connection_collation_id() const = 0;
149 
150  virtual Object_id schema_collation_id() const = 0;
152 
153  static void create_mdl_key(const String_type &schema_name,
154  const String_type &name, MDL_key *key);
155  static const CHARSET_INFO *name_collation();
156 };
157 
158 ///////////////////////////////////////////////////////////////////////////
159 
160 } // namespace dd
161 
162 #endif // DD__TRIGGER_INCLUDED
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:47
virtual const String_type & name() const =0
Definition: trigger_impl.h:53
Class representing a Trigger in DD framework.
Definition: trigger.h:52
virtual uint action_order() const =0
enum_event_type
Definition: trigger.h:58
virtual void set_action_statement(const String_type &action_statement)=0
virtual void set_schema_collation_id(Object_id schema_collation_id)=0
virtual void set_action_order(uint action_order)=0
virtual Object_id schema_collation_id() const =0
tables::Triggers DD_table
Definition: trigger.h:55
virtual const String_type & definer_host() const =0
virtual void set_connection_collation_id(Object_id connection_collation_id)=0
static void create_mdl_key(const String_type &schema_name, const String_type &name, MDL_key *key)
Definition: trigger_impl.cc:239
virtual const String_type & action_statement() const =0
~Trigger() override=default
virtual void set_created(timeval created)=0
Trigger_impl Impl
Definition: trigger.h:54
virtual Object_id connection_collation_id() const =0
virtual void set_sql_mode(ulonglong sql_mode)=0
static const CHARSET_INFO * name_collation()
Definition: trigger_impl.cc:262
virtual void set_event_type(enum_event_type event_type)=0
virtual void set_definer(const String_type &username, const String_type &hostname)=0
virtual Object_id client_collation_id() const =0
virtual void set_client_collation_id(Object_id client_collation_id)=0
virtual Object_id schema_id() const =0
virtual ulonglong sql_mode() const =0
virtual enum_action_timing action_timing() const =0
virtual void set_action_timing(enum_action_timing type)=0
virtual const String_type & action_statement_utf8() const =0
virtual const String_type & definer_user() const =0
virtual void set_action_statement_utf8(const String_type &action_statement_utf8)=0
enum_action_timing
Definition: trigger.h:60
virtual enum_event_type event_type() const =0
virtual timeval created() const =0
virtual Object_id table_id() const =0
virtual timeval last_altered() const =0
virtual void set_last_altered(timeval last_altered)=0
Definition: triggers.h:46
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
unsigned long long Object_id
Definition: object_id.h:30
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
required string key
Definition: replication_asynchronous_connection_failover.proto:59
required string type
Definition: replication_group_member_actions.proto:33
This header provides Rapidjson Type Aliases.
Definition: m_ctype.h:354
Metadata lock object key.
Definition: mdl.h:364
Include file for Sun RPC to compile out of the box.
unsigned int uint
Definition: uca-dump.cc:29