1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
4 |
* Definitions required for EventObserver plugin
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
5 |
*
|
6 |
* Copyright (C) 2010 PrimeBase Technologies GmbH, Germany
|
|
7 |
*
|
|
8 |
* This program is free software; you can redistribute it and/or modify
|
|
9 |
* it under the terms of the GNU General Public License as published by
|
|
10 |
* the Free Software Foundation; version 2 of the License.
|
|
11 |
*
|
|
12 |
* This program is distributed in the hope that it will be useful,
|
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 |
* GNU General Public License for more details.
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License
|
|
18 |
* along with this program; if not, write to the Free Software
|
|
19 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
1502.5.9
by Barry.Leslie at PrimeBase
- Cleaned up some style points. |
20 |
*
|
21 |
* Barry Leslie
|
|
22 |
*
|
|
23 |
* 2010-05-12
|
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
24 |
*/
|
25 |
||
26 |
/*
|
|
27 |
* How to add a new event:
|
|
28 |
*
|
|
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
29 |
* In event_observer.h
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
30 |
* 1: Add your event to EventType.
|
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
31 |
* 2: Add it to EventObserver::eventName().
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
32 |
* 3: Cerate a EventData class for it based on SessionEventData, SchemaEventData,
|
33 |
* or TableEventData depending on the event type class.
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
34 |
* 4: Add a static method to the EventObserver class, similar to beforeInsertRecord() for example,
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
35 |
* that will be called by drizzle.
|
36 |
*
|
|
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
37 |
* In event_observer.cc
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
38 |
* 5: Impliment your static event method, similar to beforeInsertRecord() for example.
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
39 |
* 6: Depending on the event type class add an event vector for it to the SessionEventObservers,
|
40 |
* SchemaEventObservers, or TableEventObservers class.
|
|
41 |
*
|
|
42 |
*/
|
|
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
43 |
#pragma once
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
44 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
45 |
#include <drizzled/plugin/plugin.h> |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
46 |
|
47 |
#include <string> |
|
48 |
||
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
49 |
#include <drizzled/visibility.h> |
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
50 |
|
2252.1.22
by Olaf van der Spek
Common fwd |
51 |
namespace drizzled { |
52 |
namespace plugin { |
|
53 |
||
1836.4.2
by Brian Aker
More testing around events. |
54 |
typedef std::vector<EventObserver *> EventObserverVector; |
55 |
typedef EventObserver* EventObserverPtr; |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
56 |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
57 |
class DRIZZLED_API EventObserver : public Plugin |
1836.4.2
by Brian Aker
More testing around events. |
58 |
{
|
59 |
public: |
|
60 |
explicit EventObserver(std::string name_arg) |
|
61 |
: Plugin(name_arg, "EventObserver") |
|
62 |
{}
|
|
63 |
||
64 |
enum EventType{ |
|
65 |
/* Session events: */
|
|
66 |
BEFORE_CREATE_DATABASE, AFTER_CREATE_DATABASE, |
|
67 |
BEFORE_DROP_DATABASE, AFTER_DROP_DATABASE, |
|
68 |
CONNECT_SESSION, |
|
69 |
DISCONNECT_SESSION, |
|
70 |
AFTER_STATEMENT, |
|
71 |
BEFORE_STATEMENT, |
|
72 |
||
73 |
/* Schema events: */
|
|
74 |
BEFORE_DROP_TABLE, AFTER_DROP_TABLE, |
|
75 |
BEFORE_RENAME_TABLE, AFTER_RENAME_TABLE, |
|
76 |
||
77 |
/* Table events: */
|
|
78 |
BEFORE_INSERT_RECORD, AFTER_INSERT_RECORD, |
|
79 |
BEFORE_UPDATE_RECORD, AFTER_UPDATE_RECORD, |
|
80 |
BEFORE_DELETE_RECORD, AFTER_DELETE_RECORD, |
|
81 |
||
82 |
/* The max event ID marker. */
|
|
83 |
MAX_EVENT_COUNT
|
|
84 |
};
|
|
85 |
||
86 |
static const char *eventName(EventType event) |
|
1593
by Brian Aker
Merge in Barry. |
87 |
{
|
1836.4.2
by Brian Aker
More testing around events. |
88 |
switch(event) |
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
89 |
{
|
1836.4.2
by Brian Aker
More testing around events. |
90 |
case BEFORE_DROP_TABLE: |
91 |
return "BEFORE_DROP_TABLE"; |
|
92 |
||
93 |
case AFTER_DROP_TABLE: |
|
94 |
return "AFTER_DROP_TABLE"; |
|
95 |
||
96 |
case BEFORE_RENAME_TABLE: |
|
97 |
return "BEFORE_RENAME_TABLE"; |
|
98 |
||
99 |
case AFTER_RENAME_TABLE: |
|
100 |
return "AFTER_RENAME_TABLE"; |
|
101 |
||
102 |
case BEFORE_INSERT_RECORD: |
|
103 |
return "BEFORE_INSERT_RECORD"; |
|
104 |
||
105 |
case AFTER_INSERT_RECORD: |
|
106 |
return "AFTER_INSERT_RECORD"; |
|
107 |
||
108 |
case BEFORE_UPDATE_RECORD: |
|
109 |
return "BEFORE_UPDATE_RECORD"; |
|
110 |
||
111 |
case AFTER_UPDATE_RECORD: |
|
112 |
return "AFTER_UPDATE_RECORD"; |
|
113 |
||
114 |
case BEFORE_DELETE_RECORD: |
|
115 |
return "BEFORE_DELETE_RECORD"; |
|
116 |
||
117 |
case AFTER_DELETE_RECORD: |
|
118 |
return "AFTER_DELETE_RECORD"; |
|
119 |
||
120 |
case BEFORE_CREATE_DATABASE: |
|
121 |
return "BEFORE_CREATE_DATABASE"; |
|
122 |
||
123 |
case AFTER_CREATE_DATABASE: |
|
124 |
return "AFTER_CREATE_DATABASE"; |
|
125 |
||
126 |
case BEFORE_DROP_DATABASE: |
|
127 |
return "BEFORE_DROP_DATABASE"; |
|
128 |
||
129 |
case AFTER_DROP_DATABASE: |
|
130 |
return "AFTER_DROP_DATABASE"; |
|
131 |
||
132 |
case CONNECT_SESSION: |
|
133 |
return "CONNECT_SESSION"; |
|
134 |
||
135 |
case DISCONNECT_SESSION: |
|
136 |
return "DISCONNECT_SESSION"; |
|
137 |
||
138 |
case AFTER_STATEMENT: |
|
139 |
return "AFTER_STATEMENT"; |
|
140 |
||
141 |
case BEFORE_STATEMENT: |
|
142 |
return "BEFORE_STATEMENT"; |
|
143 |
||
144 |
case MAX_EVENT_COUNT: |
|
145 |
break; |
|
1593
by Brian Aker
Merge in Barry. |
146 |
}
|
147 |
||
1836.4.2
by Brian Aker
More testing around events. |
148 |
return "Unknown"; |
149 |
}
|
|
150 |
||
151 |
/*==========================================================*/
|
|
152 |
/* registerEvents() must be implemented to allow the plugin to
|
|
153 |
* register which events it is interested in.
|
|
154 |
*/
|
|
155 |
virtual void registerTableEventsDo(TableShare &, EventObserverList &){} |
|
156 |
virtual void registerSchemaEventsDo(const std::string &/*db*/, EventObserverList &) {} |
|
157 |
virtual void registerSessionEventsDo(Session &, EventObserverList &) {} |
|
158 |
||
159 |
virtual bool observeEventDo(EventData &)= 0; |
|
160 |
||
161 |
/*==========================================================*/
|
|
162 |
/* Static access methods called by drizzle: */
|
|
163 |
static bool addPlugin(EventObserver *handler); |
|
164 |
static void removePlugin(EventObserver *handler); |
|
165 |
||
166 |
/*==========================================================*/
|
|
167 |
/* Register an event of interest for this plugin.
|
|
168 |
* This is called from with in the plugin when registering itself.
|
|
169 |
*
|
|
170 |
* The position field is used to indicate the order the event observer is to be
|
|
171 |
* called. If the event observer must be called before any other observer then
|
|
172 |
* the position must be set to 1. If it must be called last then the position must be
|
|
173 |
* set to -1. A position of 0 indicated the position doesn't matter.
|
|
174 |
*
|
|
175 |
* If 2 plugins require the same position then which is called first in not guarenteed.
|
|
176 |
* In this case a warrning will be logged but execution will continue.
|
|
177 |
*
|
|
178 |
* It is good practice that if the event position matters not to hard code the position
|
|
179 |
* but supply a systen variable so that it can be set at runtime so that the user can
|
|
180 |
* decide which event should be called first.
|
|
181 |
*/
|
|
182 |
void registerEvent(EventObserverList &observers, EventType event, int32_t position= 0); |
|
183 |
||
184 |
/*==========================================================*/
|
|
185 |
/* Called from drizzle to register all events for all event plugins
|
|
186 |
* interested in this table.
|
|
187 |
*/
|
|
188 |
static void registerTableEvents(TableShare &table_share); |
|
189 |
static void deregisterTableEvents(TableShare &table_share); |
|
190 |
||
191 |
/*==========================================================*/
|
|
192 |
/* Called from drizzle to register all events for all event plugins
|
|
193 |
* interested in this database.
|
|
194 |
*/
|
|
195 |
static void registerSchemaEvents(Session &session, const std::string &db); |
|
1919.3.5
by Barry.Leslie at PrimeBase
Improved cleanup for session and schema event lists. |
196 |
static void deregisterSchemaEvents(EventObserverList *observers); |
1836.4.2
by Brian Aker
More testing around events. |
197 |
|
198 |
/*==========================================================*/
|
|
199 |
/* Called from drizzle to register all events for all event plugins
|
|
200 |
* interested in this session.
|
|
201 |
*/
|
|
202 |
static void registerSessionEvents(Session &session); |
|
1919.3.5
by Barry.Leslie at PrimeBase
Improved cleanup for session and schema event lists. |
203 |
static void deregisterSessionEvents(EventObserverList *observers); |
1836.4.2
by Brian Aker
More testing around events. |
204 |
|
205 |
||
206 |
/*==========================================================*/
|
|
207 |
/* Static meathods called by drizzle to notify interested plugins
|
|
208 |
* of a schema an event,
|
|
209 |
*/
|
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
210 |
static bool beforeDropTable(Session &session, const drizzled::identifier::Table &table); |
211 |
static bool afterDropTable(Session &session, const drizzled::identifier::Table &table, int err); |
|
212 |
static bool beforeRenameTable(Session &session, const drizzled::identifier::Table &from, const drizzled::identifier::Table &to); |
|
213 |
static bool afterRenameTable(Session &session, const drizzled::identifier::Table &from, const drizzled::identifier::Table &to, int err); |
|
1836.4.2
by Brian Aker
More testing around events. |
214 |
static bool connectSession(Session &session); |
215 |
static bool disconnectSession(Session &session); |
|
216 |
static bool beforeStatement(Session &session); |
|
217 |
static bool afterStatement(Session &session); |
|
218 |
||
219 |
/*==========================================================*/
|
|
220 |
/* Static meathods called by drizzle to notify interested plugins
|
|
221 |
* of a table an event,
|
|
222 |
*/
|
|
223 |
static bool beforeInsertRecord(Table &table, unsigned char *buf); |
|
224 |
static bool afterInsertRecord(Table &table, const unsigned char *buf, int err); |
|
225 |
static bool beforeDeleteRecord(Table &table, const unsigned char *buf); |
|
226 |
static bool afterDeleteRecord(Table &table, const unsigned char *buf, int err); |
|
227 |
static bool beforeUpdateRecord(Table &table, const unsigned char *old_data, unsigned char *new_data); |
|
228 |
static bool afterUpdateRecord(Table &table, const unsigned char *old_data, unsigned char *new_data, int err); |
|
229 |
||
230 |
/*==========================================================*/
|
|
231 |
/* Static meathods called by drizzle to notify interested plugins
|
|
232 |
* of a table an event,
|
|
233 |
*/
|
|
234 |
static bool beforeCreateDatabase(Session &session, const std::string &db); |
|
235 |
static bool afterCreateDatabase(Session &session, const std::string &db, int err); |
|
236 |
static bool beforeDropDatabase(Session &session, const std::string &db); |
|
237 |
static bool afterDropDatabase(Session &session, const std::string &db, int err); |
|
238 |
||
239 |
static const EventObserverVector &getEventObservers(void); |
|
240 |
||
241 |
};
|
|
242 |
||
243 |
||
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
244 |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
245 |
|
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
246 |
/* EventObserver data classes: */
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
247 |
//======================================
|
248 |
class EventData |
|
249 |
{
|
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
250 |
public: |
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
251 |
EventObserver::EventType event; |
1593
by Brian Aker
Merge in Barry. |
252 |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
253 |
EventData(EventObserver::EventType event_arg): |
254 |
event(event_arg), |
|
255 |
observerList(NULL) |
|
1593
by Brian Aker
Merge in Barry. |
256 |
{}
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
257 |
virtual ~EventData(){} |
1593
by Brian Aker
Merge in Barry. |
258 |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
259 |
// Call all the event observers that are registered for this event.
|
260 |
virtual bool callEventObservers(); |
|
1593
by Brian Aker
Merge in Barry. |
261 |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
262 |
protected: |
263 |
EventObserverList *observerList; |
|
1593
by Brian Aker
Merge in Barry. |
264 |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
265 |
};
|
266 |
||
267 |
//-----
|
|
268 |
class SessionEventData: public EventData |
|
269 |
{
|
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
270 |
public: |
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
271 |
Session &session; |
1593
by Brian Aker
Merge in Barry. |
272 |
|
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
273 |
SessionEventData(EventObserver::EventType event_arg, Session &session_arg): |
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
274 |
EventData(event_arg), |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
275 |
session(session_arg) |
1593
by Brian Aker
Merge in Barry. |
276 |
{}
|
277 |
||
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
278 |
// Call all the event observers that are registered for this event.
|
279 |
virtual bool callEventObservers(); |
|
1841.1.2
by Barry.Leslie at PrimeBase
Bug fix for possible crash when a NULL event list is accessed. |
280 |
|
2154.2.17
by Brian Aker
Additional removal of session |
281 |
static bool hasEvents(Session &in_session); |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
282 |
};
|
283 |
||
284 |
//-----
|
|
285 |
class SchemaEventData: public EventData |
|
286 |
{
|
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
287 |
public: |
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
288 |
Session &session; |
289 |
const std::string &db; |
|
1593
by Brian Aker
Merge in Barry. |
290 |
|
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
291 |
SchemaEventData(EventObserver::EventType event_arg, Session &session_arg, const std::string &db_arg): |
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
292 |
EventData(event_arg), |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
293 |
session(session_arg), |
294 |
db(db_arg) |
|
1593
by Brian Aker
Merge in Barry. |
295 |
{}
|
296 |
||
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
297 |
// Call all the event observers that are registered for this event.
|
298 |
virtual bool callEventObservers(); |
|
1841.1.2
by Barry.Leslie at PrimeBase
Bug fix for possible crash when a NULL event list is accessed. |
299 |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
300 |
};
|
301 |
||
302 |
//-----
|
|
303 |
class TableEventData: public EventData |
|
304 |
{
|
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
305 |
public: |
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
306 |
Session &session; |
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
307 |
Table &table; |
1593
by Brian Aker
Merge in Barry. |
308 |
|
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
309 |
TableEventData(EventObserver::EventType event_arg, Session &session_arg, Table &table_arg): |
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
310 |
EventData(event_arg), |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
311 |
session(session_arg), |
312 |
table(table_arg) |
|
1593
by Brian Aker
Merge in Barry. |
313 |
{}
|
314 |
||
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
315 |
// Call all the event observers that are registered for this event.
|
316 |
virtual bool callEventObservers(); |
|
1841.1.2
by Barry.Leslie at PrimeBase
Bug fix for possible crash when a NULL event list is accessed. |
317 |
|
2154.2.17
by Brian Aker
Additional removal of session |
318 |
static bool hasEvents(Table &in_table); |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
319 |
};
|
320 |
||
321 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
322 |
class BeforeCreateDatabaseEventData: public SessionEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
323 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
324 |
public: |
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
325 |
const std::string &db; |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
326 |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
327 |
BeforeCreateDatabaseEventData(Session &session_arg, const std::string &db_arg): |
1593
by Brian Aker
Merge in Barry. |
328 |
SessionEventData(EventObserver::BEFORE_CREATE_DATABASE, session_arg), |
329 |
db(db_arg) |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
330 |
{}
|
331 |
};
|
|
332 |
||
333 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
334 |
class AfterCreateDatabaseEventData: public SessionEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
335 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
336 |
public: |
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
337 |
const std::string &db; |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
338 |
int err; |
339 |
||
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
340 |
AfterCreateDatabaseEventData(Session &session_arg, const std::string &db_arg, int err_arg): |
1593
by Brian Aker
Merge in Barry. |
341 |
SessionEventData(EventObserver::AFTER_CREATE_DATABASE, session_arg), |
342 |
db(db_arg), |
|
343 |
err(err_arg) |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
344 |
{}
|
345 |
};
|
|
346 |
||
347 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
348 |
class BeforeDropDatabaseEventData: public SessionEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
349 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
350 |
public: |
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
351 |
const std::string &db; |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
352 |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
353 |
BeforeDropDatabaseEventData(Session &session_arg, const std::string &db_arg): |
1593
by Brian Aker
Merge in Barry. |
354 |
SessionEventData(EventObserver::BEFORE_DROP_DATABASE, session_arg), |
355 |
db(db_arg) |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
356 |
{}
|
357 |
};
|
|
358 |
||
359 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
360 |
class AfterDropDatabaseEventData: public SessionEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
361 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
362 |
public: |
1502.5.7
by Barry.Leslie at PrimeBase
Renamed the 'Event' plugin to 'EventObserver' plugin along with some internal class renames to make things clearer. |
363 |
const std::string &db; |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
364 |
int err; |
365 |
||
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
366 |
AfterDropDatabaseEventData(Session &session_arg, const std::string &db_arg, int err_arg): |
1593
by Brian Aker
Merge in Barry. |
367 |
SessionEventData(EventObserver::AFTER_DROP_DATABASE, session_arg), |
368 |
db(db_arg), |
|
369 |
err(err_arg) |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
370 |
{}
|
371 |
};
|
|
372 |
||
373 |
//-----
|
|
1836
by Brian Aker
Added support for pre/post triggers (this removes the need for the current |
374 |
class ConnectSessionEventData: public SessionEventData |
375 |
{
|
|
376 |
public: |
|
377 |
||
378 |
ConnectSessionEventData(Session &session_arg): |
|
379 |
SessionEventData(EventObserver::CONNECT_SESSION, session_arg) |
|
380 |
{}
|
|
381 |
};
|
|
382 |
||
383 |
//-----
|
|
384 |
class DisconnectSessionEventData: public SessionEventData |
|
385 |
{
|
|
386 |
public: |
|
387 |
||
388 |
DisconnectSessionEventData(Session &session_arg): |
|
389 |
SessionEventData(EventObserver::DISCONNECT_SESSION, session_arg) |
|
390 |
{}
|
|
391 |
};
|
|
392 |
||
393 |
//-----
|
|
394 |
class BeforeStatementEventData: public SessionEventData |
|
395 |
{
|
|
396 |
public: |
|
397 |
||
398 |
BeforeStatementEventData(Session &session_arg): |
|
399 |
SessionEventData(EventObserver::BEFORE_STATEMENT, session_arg) |
|
400 |
{}
|
|
401 |
};
|
|
402 |
||
403 |
//-----
|
|
404 |
class AfterStatementEventData: public SessionEventData |
|
405 |
{
|
|
406 |
public: |
|
407 |
||
408 |
AfterStatementEventData(Session &session_arg): |
|
409 |
SessionEventData(EventObserver::AFTER_STATEMENT, session_arg) |
|
410 |
{}
|
|
411 |
};
|
|
412 |
||
413 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
414 |
class BeforeDropTableEventData: public SchemaEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
415 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
416 |
public: |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
417 |
const drizzled::identifier::Table &table; |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
418 |
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
419 |
BeforeDropTableEventData(Session &session_arg, const drizzled::identifier::Table &table_arg): |
1593
by Brian Aker
Merge in Barry. |
420 |
SchemaEventData(EventObserver::BEFORE_DROP_TABLE, session_arg, table_arg.getSchemaName()), |
421 |
table(table_arg) |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
422 |
{}
|
423 |
};
|
|
424 |
||
425 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
426 |
class AfterDropTableEventData: public SchemaEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
427 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
428 |
public: |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
429 |
const drizzled::identifier::Table &table; |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
430 |
int err; |
431 |
||
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
432 |
AfterDropTableEventData(Session &session_arg, const drizzled::identifier::Table &table_arg, int err_arg): |
1593
by Brian Aker
Merge in Barry. |
433 |
SchemaEventData(EventObserver::AFTER_DROP_TABLE, session_arg, table_arg.getSchemaName()), |
434 |
table(table_arg), |
|
435 |
err(err_arg) |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
436 |
{}
|
437 |
};
|
|
438 |
||
439 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
440 |
class BeforeRenameTableEventData: public SchemaEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
441 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
442 |
public: |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
443 |
const drizzled::identifier::Table &from; |
444 |
const drizzled::identifier::Table &to; |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
445 |
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
446 |
BeforeRenameTableEventData(Session &session_arg, const drizzled::identifier::Table &from_arg, const drizzled::identifier::Table &to_arg): |
1593
by Brian Aker
Merge in Barry. |
447 |
SchemaEventData(EventObserver::BEFORE_RENAME_TABLE, session_arg, from_arg.getSchemaName()), |
448 |
from(from_arg), |
|
449 |
to(to_arg) |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
450 |
{}
|
451 |
};
|
|
452 |
||
453 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
454 |
class AfterRenameTableEventData: public SchemaEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
455 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
456 |
public: |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
457 |
const drizzled::identifier::Table &from; |
458 |
const drizzled::identifier::Table &to; |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
459 |
int err; |
460 |
||
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
461 |
AfterRenameTableEventData(Session &session_arg, const drizzled::identifier::Table &from_arg, const drizzled::identifier::Table &to_arg, int err_arg): |
1593
by Brian Aker
Merge in Barry. |
462 |
SchemaEventData(EventObserver::AFTER_RENAME_TABLE, session_arg, from_arg.getSchemaName()), |
463 |
from(from_arg), |
|
464 |
to(to_arg), |
|
465 |
err(err_arg) |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
466 |
{}
|
467 |
};
|
|
468 |
||
469 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
470 |
class BeforeInsertRecordEventData: public TableEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
471 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
472 |
public: |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
473 |
unsigned char *row; |
474 |
||
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
475 |
BeforeInsertRecordEventData(Session &session_arg, Table &table_arg, unsigned char *row_arg): |
1593
by Brian Aker
Merge in Barry. |
476 |
TableEventData(EventObserver::BEFORE_INSERT_RECORD, session_arg, table_arg), |
477 |
row(row_arg) |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
478 |
{}
|
479 |
};
|
|
480 |
||
481 |
//-----
|
|
482 |
class AfterInsertRecordEventData: public TableEventData |
|
483 |
{
|
|
484 |
public: |
|
485 |
const unsigned char *row; |
|
486 |
int err; |
|
487 |
||
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
488 |
AfterInsertRecordEventData(Session &session_arg, Table &table_arg, const unsigned char *row_arg, int err_arg): |
1593
by Brian Aker
Merge in Barry. |
489 |
TableEventData(EventObserver::AFTER_INSERT_RECORD, session_arg, table_arg), |
490 |
row(row_arg), |
|
491 |
err(err_arg) |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
492 |
{}
|
493 |
};
|
|
494 |
||
495 |
//-----
|
|
496 |
class BeforeDeleteRecordEventData: public TableEventData |
|
497 |
{
|
|
498 |
public: |
|
499 |
const unsigned char *row; |
|
500 |
||
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
501 |
BeforeDeleteRecordEventData(Session &session_arg, Table &table_arg, const unsigned char *row_arg): |
1593
by Brian Aker
Merge in Barry. |
502 |
TableEventData(EventObserver::BEFORE_DELETE_RECORD, session_arg, table_arg), |
503 |
row(row_arg) |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
504 |
{}
|
505 |
};
|
|
506 |
||
507 |
//-----
|
|
508 |
class AfterDeleteRecordEventData: public TableEventData |
|
509 |
{
|
|
510 |
public: |
|
511 |
const unsigned char *row; |
|
512 |
int err; |
|
513 |
||
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
514 |
AfterDeleteRecordEventData(Session &session_arg, Table &table_arg, const unsigned char *row_arg, int err_arg): |
1593
by Brian Aker
Merge in Barry. |
515 |
TableEventData(EventObserver::AFTER_DELETE_RECORD, session_arg, table_arg), |
516 |
row(row_arg), |
|
517 |
err(err_arg) |
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
518 |
{}
|
519 |
};
|
|
520 |
||
521 |
//-----
|
|
522 |
class BeforeUpdateRecordEventData: public TableEventData |
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
523 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
524 |
public: |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
525 |
const unsigned char *old_row; |
526 |
unsigned char *new_row; |
|
527 |
||
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
528 |
BeforeUpdateRecordEventData(Session &session_arg, Table &table_arg, |
1593
by Brian Aker
Merge in Barry. |
529 |
const unsigned char *old_row_arg, |
530 |
unsigned char *new_row_arg): |
|
531 |
TableEventData(EventObserver::BEFORE_UPDATE_RECORD, session_arg, table_arg), |
|
532 |
old_row(old_row_arg), |
|
533 |
new_row(new_row_arg) |
|
534 |
{}
|
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
535 |
};
|
536 |
||
537 |
//-----
|
|
1502.5.8
by Barry.Leslie at PrimeBase
- Changed names to match the drizzle naming convention. |
538 |
class AfterUpdateRecordEventData: public TableEventData |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
539 |
{
|
1502.5.6
by Barry.Leslie at PrimeBase
Fixed a compiler error due to an uninitialized variavble and cleaned up some coding standard stuff. |
540 |
public: |
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
541 |
const unsigned char *old_row; |
542 |
const unsigned char *new_row; |
|
543 |
int err; |
|
544 |
||
1548.2.4
by Barry.Leslie at PrimeBase
Changed the table event observers to pass the 'Table' not the TableShare' to the observers. |
545 |
AfterUpdateRecordEventData(Session &session_arg, Table &table_arg, |
1593
by Brian Aker
Merge in Barry. |
546 |
const unsigned char *old_row_arg, |
547 |
const unsigned char *new_row_arg, |
|
548 |
int err_arg): |
|
549 |
TableEventData(EventObserver::AFTER_UPDATE_RECORD, session_arg, table_arg), |
|
550 |
old_row(old_row_arg), |
|
551 |
new_row(new_row_arg), |
|
552 |
err(err_arg) |
|
553 |
{}
|
|
1502.5.3
by Barry.Leslie at PrimeBase
Added the source code for the events plugin. |
554 |
};
|
555 |
||
556 |
//=======================================================
|
|
557 |
||
558 |
} /* namespace plugin */ |
|
559 |
} /* namespace drizzled */ |
|
560 |