MySQL 8.4.0
Source Code Documentation
trigger.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
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
24#ifndef DD__TRIGGER_INCLUDED
25#define DD__TRIGGER_INCLUDED
26
27#include <time.h>
28
29#ifdef _WIN32
30#include <winsock2.h> // timeval
31#endif
32
33#include "my_inttypes.h"
34#include "my_time_t.h"
35#include "sql/dd/sdi_fwd.h" // dd::Sdi_wcontext
36#include "sql/dd/types/entity_object.h" // dd::Entity_object
37
38struct MDL_key;
39struct CHARSET_INFO;
40
41namespace dd {
42
43///////////////////////////////////////////////////////////////////////////
44
45class Trigger_impl;
46
47namespace tables {
48class Triggers;
49}
50
51///////////////////////////////////////////////////////////////////////////
52
53/// Class representing a Trigger in DD framework.
54class Trigger : virtual public Entity_object {
55 public:
58
59 public:
61
63
64 public:
65 ~Trigger() override = default;
66
67 /////////////////////////////////////////////////////////////////////////
68 // schema.
69 /////////////////////////////////////////////////////////////////////////
70
71 virtual Object_id schema_id() const = 0;
72
73 /////////////////////////////////////////////////////////////////////////
74 // table.
75 /////////////////////////////////////////////////////////////////////////
76
77 virtual Object_id table_id() const = 0;
78
79 /////////////////////////////////////////////////////////////////////////
80 // Trigger type.
81 /////////////////////////////////////////////////////////////////////////
82
83 virtual enum_event_type event_type() const = 0;
85
86 /////////////////////////////////////////////////////////////////////////
87 // action_timing.
88 /////////////////////////////////////////////////////////////////////////
89
90 virtual enum_action_timing action_timing() const = 0;
92
93 /////////////////////////////////////////////////////////////////////////
94 // action_order.
95 /////////////////////////////////////////////////////////////////////////
96
97 virtual uint action_order() const = 0;
98 virtual void set_action_order(uint action_order) = 0;
99
100 /////////////////////////////////////////////////////////////////////////
101 // action_statement
102 /////////////////////////////////////////////////////////////////////////
103
104 virtual const String_type &action_statement() const = 0;
106
107 virtual const String_type &action_statement_utf8() const = 0;
110
111 /////////////////////////////////////////////////////////////////////////
112 // created.
113 /////////////////////////////////////////////////////////////////////////
114
115 virtual my_timeval created() const = 0;
116 virtual void set_created(my_timeval created) = 0;
117
118 /////////////////////////////////////////////////////////////////////////
119 // last altered.
120 /////////////////////////////////////////////////////////////////////////
121
122 virtual my_timeval last_altered() const = 0;
124
125 /////////////////////////////////////////////////////////////////////////
126 // sql_mode
127 /////////////////////////////////////////////////////////////////////////
128
129 virtual ulonglong sql_mode() const = 0;
130 virtual void set_sql_mode(ulonglong sql_mode) = 0;
131
132 /////////////////////////////////////////////////////////////////////////
133 // definer.
134 /////////////////////////////////////////////////////////////////////////
135
136 virtual const String_type &definer_user() const = 0;
137 virtual const String_type &definer_host() const = 0;
138 virtual void set_definer(const String_type &username,
139 const String_type &hostname) = 0;
140
141 /////////////////////////////////////////////////////////////////////////
142 // collations.
143 /////////////////////////////////////////////////////////////////////////
144
145 virtual Object_id client_collation_id() const = 0;
147
151
152 virtual Object_id schema_collation_id() const = 0;
154
155 static void create_mdl_key(const String_type &schema_name,
156 const String_type &name, MDL_key *key);
157 static const CHARSET_INFO *name_collation();
158};
159
160///////////////////////////////////////////////////////////////////////////
161
162} // namespace dd
163
164#endif // DD__TRIGGER_INCLUDED
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:48
virtual const String_type & name() const =0
Definition: trigger_impl.h:54
Class representing a Trigger in DD framework.
Definition: trigger.h:54
virtual uint action_order() const =0
enum_event_type
Definition: trigger.h:60
virtual void set_last_altered(my_timeval last_altered)=0
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_created(my_timeval created)=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:57
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:238
~Trigger() override=default
Trigger_impl Impl
Definition: trigger.h:56
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:261
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 const String_type & definer_host() const =0
virtual Object_id client_collation_id() const =0
virtual void set_client_collation_id(Object_id client_collation_id)=0
virtual my_timeval created() const =0
virtual Object_id schema_id() const =0
virtual ulonglong sql_mode() const =0
virtual enum_action_timing action_timing() const =0
virtual const String_type & action_statement() const =0
virtual const String_type & action_statement_utf8() const =0
virtual my_timeval last_altered() const =0
virtual void set_action_timing(enum_action_timing type)=0
virtual void set_action_statement_utf8(const String_type &action_statement_utf8)=0
enum_action_timing
Definition: trigger.h:62
virtual enum_event_type event_type() const =0
virtual const String_type & definer_user() const =0
virtual Object_id table_id() const =0
Definition: triggers.h:49
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
unsigned long long Object_id
Definition: object_id.h:31
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
required string key
Definition: replication_asynchronous_connection_failover.proto:60
required string type
Definition: replication_group_member_actions.proto:34
This header provides Rapidjson Type Aliases.
Definition: m_ctype.h:423
Metadata lock object key.
Definition: mdl.h:365
Replacement of system's struct timeval to ensure we can carry 64 bit values even on a platform which ...
Definition: my_time_t.h:45
Include file for Sun RPC to compile out of the box.