47
47
/*============================*/
48
// Basic plugin registration stuff.
49
static vector<EventObserver *> all_event_plugins;
52
bool EventObserver::addPlugin(EventObserver *handler)
55
all_event_plugins.push_back(handler);
60
void EventObserver::removePlugin(EventObserver *handler)
63
all_event_plugins.erase(find(all_event_plugins.begin(), all_event_plugins.end(), handler));
68
* The Event Observer list class in which plugins register which events they
71
* Each table share for example, will have one of these hung on it to store
72
* a list off all event observers interested in it and which events they are
48
// Basic plugin registration stuff.
49
static vector<EventObserver *> all_event_plugins;
52
bool EventObserver::addPlugin(EventObserver *handler)
55
all_event_plugins.push_back(handler);
60
void EventObserver::removePlugin(EventObserver *handler)
63
all_event_plugins.erase(find(all_event_plugins.begin(), all_event_plugins.end(), handler));
68
* The Event Observer list class in which plugins register which events they
71
* Each table share for example, will have one of these hung on it to store
72
* a list off all event observers interested in it and which events they are
75
class EventObserverList
79
typedef multimap<uint32_t, EventObserver *> ObserverMap;
82
/* A list of lists indexed by event type. */
83
vector<ObserverMap *> event_observer_lists;
75
class EventObserverList
91
event_observer_lists.reserve(EventObserver::MAX_EVENT_COUNT);
92
for (i=0; i < EventObserver::MAX_EVENT_COUNT; i++)
79
typedef multimap<uint32_t, EventObserver *> ObserverMap;
82
/* A list of lists indexed by event type. */
83
vector<ObserverMap *> event_observer_lists;
91
event_observer_lists.reserve(EventObserver::MAX_EVENT_COUNT);
92
for (i=0; i < EventObserver::MAX_EVENT_COUNT; i++)
94
94
event_observer_lists[i]= NULL;
103
/* Add the observer to the observer list for the even, positioning it if required.
105
* Note: Event observers are storted in a multimap object so that the order in which
106
* they are called can be sorted based on the requested position. Lookups are never done
107
* on the multimap, once filled it is used as a vector.
109
void addObserver(EventObserver *eventObserver, enum EventObserver::EventType event, int32_t position)
112
ObserverMap *observers;
114
observers= event_observer_lists[event];
103
/* Add the observer to the observer list for the even, positioning it if required.
105
* Note: Event observers are storted in a multimap object so that the order in which
106
* they are called can be sorted based on the requested position. Lookups are never done
107
* on the multimap, once filled it is used as a vector.
109
void addObserver(EventObserver *eventObserver, enum EventObserver::EventType event, int32_t position)
112
ObserverMap *observers;
114
observers= event_observer_lists[event];
115
if (observers == NULL)
117
observers= new ObserverMap();
118
event_observer_lists[event]= observers;
122
event_pos= INT32_MAX; // Set the event position to be in the middle.
124
event_pos= (uint32_t) position;
126
/* If positioned then check if the position is already taken. */
129
if (observers->find(event_pos) != observers->end())
131
errmsg_printf(ERRMSG_LVL_WARN,
132
_("EventObserverList::addEventObserver() Duplicate event position %d for event '%s' from EventObserver plugin '%s'"),
134
EventObserver::eventName(event),
135
eventObserver->getName().c_str());
139
observers->insert(pair<uint32_t, EventObserver *>(event_pos, eventObserver) );
142
/* Remove all observer from all lists. */
143
void clearAllObservers()
145
for_each(event_observer_lists.begin(),
146
event_observer_lists.end(),
148
event_observer_lists.clear();
152
/* Get the observer list for an event type. Will return NULL if no observer exists.*/
153
ObserverMap *getObservers(enum EventObserver::EventType event)
155
return event_observer_lists[event];
161
/* registerEvent() is called from the event observer plugins to add themselves to
162
* the event observer list to be notified when the specified event takes place.
164
void EventObserver::registerEvent(EventObserverList &observers, EventType event, int32_t position)
166
observers.addObserver(this, event, position);
169
/*========================================================*/
170
/* Table Event Observer handling: */
171
/*========================================================*/
174
/* For each EventObserver plugin call its registerTableEventsDo() meathod so that it can
175
* register what events, if any, it is interested in on this table.
177
class RegisterTableEventsIterate : public unary_function<EventObserver *, void>
179
TableShare &table_share;
180
EventObserverList &observers;
183
RegisterTableEventsIterate(TableShare &table_share_arg, EventObserverList &observers_arg):
184
table_share(table_share_arg), observers(observers_arg) {}
185
inline result_type operator() (argument_type eventObserver)
187
eventObserver->registerTableEventsDo(table_share, observers);
193
* registerTableEvents() is called by drizzle to register all plugins that
194
* may be interested in table events on the newly created TableShare object.
196
void EventObserver::registerTableEvents(TableShare &table_share)
198
if (all_event_plugins.empty())
201
EventObserverList *observers;
203
observers= table_share.getTableObservers();
115
205
if (observers == NULL)
117
observers= new ObserverMap();
118
event_observer_lists[event]= observers;
122
event_pos= INT32_MAX; // Set the event position to be in the middle.
124
event_pos= (uint32_t) position;
126
/* If positioned then check if the position is already taken. */
207
observers= new EventObserverList();
208
table_share.setTableObservers(observers);
129
if (observers->find(event_pos) != observers->end())
131
errmsg_printf(ERRMSG_LVL_WARN,
132
_("EventObserverList::addEventObserver() Duplicate event position %d for event '%s' from EventObserver plugin '%s'"),
134
EventObserver::eventName(event),
135
eventObserver->getName().c_str());
139
observers->insert(pair<uint32_t, EventObserver *>(event_pos, eventObserver) );
142
/* Remove all observer from all lists. */
143
void clearAllObservers()
145
for_each(event_observer_lists.begin(),
146
event_observer_lists.end(),
148
event_observer_lists.clear();
152
/* Get the observer list for an event type. Will return NULL if no observer exists.*/
153
ObserverMap *getObservers(enum EventObserver::EventType event)
155
return event_observer_lists[event];
161
/* registerEvent() is called from the event observer plugins to add themselves to
162
* the event observer list to be notified when the specified event takes place.
164
void EventObserver::registerEvent(EventObserverList &observers, EventType event, int32_t position)
166
observers.addObserver(this, event, position);
169
/*========================================================*/
170
/* Table Event Observer handling: */
171
/*========================================================*/
174
/* For each EventObserver plugin call its registerTableEventsDo() meathod so that it can
175
* register what events, if any, it is interested in on this table.
177
class RegisterTableEventsIterate : public unary_function<EventObserver *, void>
179
TableShare &table_share;
180
EventObserverList &observers;
183
RegisterTableEventsIterate(TableShare &table_share_arg, EventObserverList &observers_arg):
184
table_share(table_share_arg), observers(observers_arg) {}
185
inline result_type operator() (argument_type eventObserver)
187
eventObserver->registerTableEventsDo(table_share, observers);
193
* registerTableEvents() is called by drizzle to register all plugins that
194
* may be interested in table events on the newly created TableShare object.
196
void EventObserver::registerTableEvents(TableShare &table_share)
198
if (all_event_plugins.empty())
201
EventObserverList *observers;
203
observers= table_share.getTableObservers();
205
if (observers == NULL)
207
observers= new EventObserverList();
208
table_share.setTableObservers(observers);
212
/* Calling registerTableEvents() for a table that already has
213
* events registered on it is probably a programming error.
212
/* Calling registerTableEvents() for a table that already has
213
* events registered on it is probably a programming error.
215
observers->clearAllObservers();
219
for_each(all_event_plugins.begin(), all_event_plugins.end(),
220
RegisterTableEventsIterate(table_share, *observers));
225
/* Cleanup before freeing the TableShare object. */
226
void EventObserver::deregisterTableEvents(TableShare &table_share)
228
if (all_event_plugins.empty())
231
EventObserverList *observers;
233
observers= table_share.getTableObservers();
237
table_share.setTableObservers(NULL);
238
observers->clearAllObservers();
244
/*========================================================*/
245
/* Schema Event Observer handling: */
246
/*========================================================*/
249
/* For each EventObserver plugin call its registerSchemaEventsDo() meathod so that it can
250
* register what events, if any, it is interested in on the schema.
252
class RegisterSchemaEventsIterate : public unary_function<EventObserver *, void>
254
const std::string &db;
255
EventObserverList &observers;
257
RegisterSchemaEventsIterate(const std::string &db_arg, EventObserverList &observers_arg) :
259
observers(observers_arg){}
261
inline result_type operator() (argument_type eventObserver)
263
eventObserver->registerSchemaEventsDo(db, observers);
269
* registerSchemaEvents() is called by drizzle to register all plugins that
270
* may be interested in schema events on the database.
272
void EventObserver::registerSchemaEvents(Session &session, const std::string &db)
274
if (all_event_plugins.empty())
277
EventObserverList *observers;
279
observers= session.getSchemaObservers(db);
281
if (observers == NULL)
283
observers= new EventObserverList();
284
session.setSchemaObservers(db, observers);
287
for_each(all_event_plugins.begin(), all_event_plugins.end(),
288
RegisterSchemaEventsIterate(db, *observers));
293
/* Cleanup before freeing the Session object. */
294
void EventObserver::deregisterSchemaEvents(Session &session, const std::string &db)
296
if (all_event_plugins.empty())
299
EventObserverList *observers;
301
observers= session.getSchemaObservers(db);
305
session.setSchemaObservers(db, NULL);
306
observers->clearAllObservers();
311
/*========================================================*/
312
/* Session Event Observer handling: */
313
/*========================================================*/
316
/* For each EventObserver plugin call its registerSessionEventsDo() meathod so that it can
317
* register what events, if any, it is interested in on this session.
319
class RegisterSessionEventsIterate : public unary_function<EventObserver *, void>
322
EventObserverList &observers;
324
RegisterSessionEventsIterate(Session &session_arg, EventObserverList &observers_arg) :
325
session(session_arg), observers(observers_arg) {}
326
inline result_type operator() (argument_type eventObserver)
328
eventObserver->registerSessionEventsDo(session, observers);
334
* registerSessionEvents() is called by drizzle to register all plugins that
335
* may be interested in session events on the newly created session.
337
void EventObserver::registerSessionEvents(Session &session)
339
if (all_event_plugins.empty())
342
EventObserverList *observers;
344
observers= session.getSessionObservers();
346
if (observers == NULL)
348
observers= new EventObserverList();
349
session.setSessionObservers(observers);
352
observers->clearAllObservers();
354
for_each(all_event_plugins.begin(), all_event_plugins.end(),
355
RegisterSessionEventsIterate(session, *observers));
360
/* Cleanup before freeing the session object. */
361
void EventObserver::deregisterSessionEvents(Session &session)
363
if (all_event_plugins.empty())
366
EventObserverList *observers;
368
observers= session.getSessionObservers();
372
session.setSessionObservers(NULL);
373
observers->clearAllObservers();
379
/* Event observer list iterator: */
381
class EventIterate : public unary_function<pair<uint32_t, EventObserver *>, bool>
386
EventIterate(EventData &data_arg) :
387
unary_function<pair<uint32_t, EventObserver *>, bool>(),
215
observers->clearAllObservers();
219
for_each(all_event_plugins.begin(), all_event_plugins.end(),
220
RegisterTableEventsIterate(table_share, *observers));
225
/* Cleanup before freeing the TableShare object. */
226
void EventObserver::deregisterTableEvents(TableShare &table_share)
228
if (all_event_plugins.empty())
231
EventObserverList *observers;
233
observers= table_share.getTableObservers();
237
table_share.setTableObservers(NULL);
238
observers->clearAllObservers();
244
/*========================================================*/
245
/* Schema Event Observer handling: */
246
/*========================================================*/
249
/* For each EventObserver plugin call its registerSchemaEventsDo() meathod so that it can
250
* register what events, if any, it is interested in on the schema.
252
class RegisterSchemaEventsIterate : public unary_function<EventObserver *, void>
254
const std::string &db;
255
EventObserverList &observers;
257
RegisterSchemaEventsIterate(const std::string &db_arg, EventObserverList &observers_arg) :
259
observers(observers_arg){}
261
inline result_type operator() (argument_type eventObserver)
263
eventObserver->registerSchemaEventsDo(db, observers);
269
* registerSchemaEvents() is called by drizzle to register all plugins that
270
* may be interested in schema events on the database.
272
void EventObserver::registerSchemaEvents(Session &session, const std::string &db)
274
if (all_event_plugins.empty())
277
EventObserverList *observers;
279
observers= session.getSchemaObservers(db);
281
if (observers == NULL)
283
observers= new EventObserverList();
284
session.setSchemaObservers(db, observers);
287
for_each(all_event_plugins.begin(), all_event_plugins.end(),
288
RegisterSchemaEventsIterate(db, *observers));
293
/* Cleanup before freeing the Session object. */
294
void EventObserver::deregisterSchemaEvents(Session &session, const std::string &db)
296
if (all_event_plugins.empty())
299
EventObserverList *observers;
301
observers= session.getSchemaObservers(db);
305
session.setSchemaObservers(db, NULL);
306
observers->clearAllObservers();
311
/*========================================================*/
312
/* Session Event Observer handling: */
313
/*========================================================*/
316
/* For each EventObserver plugin call its registerSessionEventsDo() meathod so that it can
317
* register what events, if any, it is interested in on this session.
319
class RegisterSessionEventsIterate : public unary_function<EventObserver *, void>
322
EventObserverList &observers;
324
RegisterSessionEventsIterate(Session &session_arg, EventObserverList &observers_arg) :
325
session(session_arg), observers(observers_arg) {}
326
inline result_type operator() (argument_type eventObserver)
328
eventObserver->registerSessionEventsDo(session, observers);
334
* registerSessionEvents() is called by drizzle to register all plugins that
335
* may be interested in session events on the newly created session.
337
void EventObserver::registerSessionEvents(Session &session)
339
if (all_event_plugins.empty())
342
EventObserverList *observers;
344
observers= session.getSessionObservers();
346
if (observers == NULL)
348
observers= new EventObserverList();
349
session.setSessionObservers(observers);
352
observers->clearAllObservers();
354
for_each(all_event_plugins.begin(), all_event_plugins.end(),
355
RegisterSessionEventsIterate(session, *observers));
360
/* Cleanup before freeing the session object. */
361
void EventObserver::deregisterSessionEvents(Session &session)
363
if (all_event_plugins.empty())
366
EventObserverList *observers;
368
observers= session.getSessionObservers();
372
session.setSessionObservers(NULL);
373
observers->clearAllObservers();
379
/* Event observer list iterator: */
381
class EventIterate : public unary_function<pair<uint32_t, EventObserver *>, bool>
386
EventIterate(EventData &data_arg) :
387
unary_function<pair<uint32_t, EventObserver *>, bool>(),
391
inline result_type operator()(argument_type handler)
393
bool result= handler.second->observeEventDo(data);
391
inline result_type operator()(argument_type handler)
396
/* TRANSLATORS: The leading word "EventObserver" is the name
397
of the plugin api, and so should not be translated. */
398
errmsg_printf(ERRMSG_LVL_ERROR,
399
_("EventIterate event handler '%s' failed for event '%s'"),
400
handler.second->getName().c_str(), handler.second->eventName(data.event));
393
bool result= handler.second->observeEventDo(data);
396
/* TRANSLATORS: The leading word "EventObserver" is the name
397
of the plugin api, and so should not be translated. */
398
errmsg_printf(ERRMSG_LVL_ERROR,
399
_("EventIterate event handler '%s' failed for event '%s'"),
400
handler.second->getName().c_str(), handler.second->eventName(data.event));
408
/*==========================================================*/
409
/* Generic meathods called by drizzle to notify all interested
410
* plugins of an event,
408
/*==========================================================*/
409
/* Generic meathods called by drizzle to notify all interested
410
* plugins of an event,
413
// Call all event observers interested in the event.
414
bool EventData::callEventObservers()
416
EventObserverList::ObserverMap *eventObservers;
418
eventObservers = observerList->getObservers(event);
420
if (eventObservers == NULL)
421
return false; // Nobody was interested in the event. :(
423
/* Use find_if instead of foreach so that we can collect return codes */
424
EventObserverList::ObserverMap::iterator iter=
425
find_if(eventObservers->begin(), eventObservers->end(),
426
EventIterate(*this));
427
/* If iter is == end() here, that means that all of the plugins returned
428
* false, which in this case means they all succeeded. Since we want to
429
* return false on success, we return the value of the two being !=.
413
// Call all event observers interested in the event.
414
bool EventData::callEventObservers()
416
EventObserverList::ObserverMap *eventObservers;
418
eventObservers = observerList->getObservers(event);
420
if (eventObservers == NULL)
421
return false; // Nobody was interested in the event. :(
423
/* Use find_if instead of foreach so that we can collect return codes */
424
EventObserverList::ObserverMap::iterator iter=
425
find_if(eventObservers->begin(), eventObservers->end(),
426
EventIterate(*this));
427
/* If iter is == end() here, that means that all of the plugins returned
428
* false, which in this case means they all succeeded. Since we want to
429
* return false on success, we return the value of the two being !=.
431
return iter != eventObservers->end();
435
bool SessionEventData::callEventObservers()
437
observerList= session.getSessionObservers();
439
return EventData::callEventObservers();
443
bool SchemaEventData::callEventObservers()
445
observerList= session.getSchemaObservers(db);
448
EventObserver::registerSchemaEvents(session, db);
431
return iter != eventObservers->end();
435
bool SessionEventData::callEventObservers()
437
observerList= session.getSessionObservers();
439
return EventData::callEventObservers();
443
bool SchemaEventData::callEventObservers()
449
445
observerList= session.getSchemaObservers(db);
452
return EventData::callEventObservers();
456
bool TableEventData::callEventObservers()
458
observerList= table.getTableObservers();
460
return EventData::callEventObservers();
463
/*==========================================================*/
464
/* Static meathods called by drizzle to notify interested plugins
467
bool EventObserver::beforeDropTable(Session &session, TableIdentifier &table)
469
if (all_event_plugins.empty())
472
BeforeDropTableEventData eventData(session, table);
473
return eventData.callEventObservers();
476
bool EventObserver::afterDropTable(Session &session, TableIdentifier &table, int err)
478
if (all_event_plugins.empty())
481
AfterDropTableEventData eventData(session, table, err);
482
return eventData.callEventObservers();
485
bool EventObserver::beforeRenameTable(Session &session, TableIdentifier &from, TableIdentifier &to)
487
if (all_event_plugins.empty())
490
BeforeRenameTableEventData eventData(session, from, to);
491
return eventData.callEventObservers();
494
bool EventObserver::afterRenameTable(Session &session, TableIdentifier &from, TableIdentifier &to, int err)
496
if (all_event_plugins.empty())
499
AfterRenameTableEventData eventData(session, from, to, err);
500
return eventData.callEventObservers();
503
/*==========================================================*/
504
/* Static meathods called by drizzle to notify interested plugins
507
bool EventObserver::beforeInsertRecord(Session &session, TableShare &table_share, unsigned char *buf)
509
if (all_event_plugins.empty())
512
BeforeInsertRecordEventData eventData(session, table_share, buf);
513
return eventData.callEventObservers();
516
bool EventObserver::afterInsertRecord(Session &session, TableShare &table_share, const unsigned char *buf, int err)
518
if (all_event_plugins.empty())
521
AfterInsertRecordEventData eventData(session, table_share, buf, err);
522
return eventData.callEventObservers();
525
bool EventObserver::beforeDeleteRecord(Session &session, TableShare &table_share, const unsigned char *buf)
527
if (all_event_plugins.empty())
530
BeforeDeleteRecordEventData eventData(session, table_share, buf);
531
return eventData.callEventObservers();
534
bool EventObserver::afterDeleteRecord(Session &session, TableShare &table_share, const unsigned char *buf, int err)
536
if (all_event_plugins.empty())
539
AfterDeleteRecordEventData eventData(session, table_share, buf, err);
540
return eventData.callEventObservers();
543
bool EventObserver::beforeUpdateRecord(Session &session, TableShare &table_share, const unsigned char *old_data, unsigned char *new_data)
545
if (all_event_plugins.empty())
548
BeforeUpdateRecordEventData eventData(session, table_share, old_data, new_data);
549
return eventData.callEventObservers();
552
bool EventObserver::afterUpdateRecord(Session &session, TableShare &table_share, const unsigned char *old_data, unsigned char *new_data, int err)
554
if (all_event_plugins.empty())
557
AfterUpdateRecordEventData eventData(session, table_share, old_data, new_data, err);
558
return eventData.callEventObservers();
561
/*==========================================================*/
562
/* Static meathods called by drizzle to notify interested plugins
563
* of a session event,
565
bool EventObserver::beforeCreateDatabase(Session &session, const std::string &db)
567
if (all_event_plugins.empty())
570
BeforeCreateDatabaseEventData eventData(session, db);
571
return eventData.callEventObservers();
574
bool EventObserver::afterCreateDatabase(Session &session, const std::string &db, int err)
576
if (all_event_plugins.empty())
579
AfterCreateDatabaseEventData eventData(session, db, err);
580
return eventData.callEventObservers();
583
bool EventObserver::beforeDropDatabase(Session &session, const std::string &db)
585
if (all_event_plugins.empty())
588
BeforeDropDatabaseEventData eventData(session, db);
589
return eventData.callEventObservers();
592
bool EventObserver::afterDropDatabase(Session &session, const std::string &db, int err)
594
if (all_event_plugins.empty())
597
AfterDropDatabaseEventData eventData(session, db, err);
598
return eventData.callEventObservers();
448
EventObserver::registerSchemaEvents(session, db);
449
observerList= session.getSchemaObservers(db);
452
return EventData::callEventObservers();
456
bool TableEventData::callEventObservers()
458
observerList= table.s->getTableObservers();
460
return EventData::callEventObservers();
463
/*==========================================================*/
464
/* Static meathods called by drizzle to notify interested plugins
467
bool EventObserver::beforeDropTable(Session &session, TableIdentifier &table)
469
if (all_event_plugins.empty())
472
BeforeDropTableEventData eventData(session, table);
473
return eventData.callEventObservers();
476
bool EventObserver::afterDropTable(Session &session, TableIdentifier &table, int err)
478
if (all_event_plugins.empty())
481
AfterDropTableEventData eventData(session, table, err);
482
return eventData.callEventObservers();
485
bool EventObserver::beforeRenameTable(Session &session, TableIdentifier &from, TableIdentifier &to)
487
if (all_event_plugins.empty())
490
BeforeRenameTableEventData eventData(session, from, to);
491
return eventData.callEventObservers();
494
bool EventObserver::afterRenameTable(Session &session, TableIdentifier &from, TableIdentifier &to, int err)
496
if (all_event_plugins.empty())
499
AfterRenameTableEventData eventData(session, from, to, err);
500
return eventData.callEventObservers();
503
/*==========================================================*/
504
/* Static meathods called by drizzle to notify interested plugins
507
bool EventObserver::beforeInsertRecord(Table &table, unsigned char *buf)
509
if (all_event_plugins.empty())
512
BeforeInsertRecordEventData eventData(*(table.in_use), table, buf);
513
return eventData.callEventObservers();
516
bool EventObserver::afterInsertRecord(Table &table, const unsigned char *buf, int err)
518
if (all_event_plugins.empty())
521
AfterInsertRecordEventData eventData(*(table.in_use), table, buf, err);
522
return eventData.callEventObservers();
525
bool EventObserver::beforeDeleteRecord(Table &table, const unsigned char *buf)
527
if (all_event_plugins.empty())
530
BeforeDeleteRecordEventData eventData(*(table.in_use), table, buf);
531
return eventData.callEventObservers();
534
bool EventObserver::afterDeleteRecord(Table &table, const unsigned char *buf, int err)
536
if (all_event_plugins.empty())
539
AfterDeleteRecordEventData eventData(*(table.in_use), table, buf, err);
540
return eventData.callEventObservers();
543
bool EventObserver::beforeUpdateRecord(Table &table, const unsigned char *old_data, unsigned char *new_data)
545
if (all_event_plugins.empty())
548
BeforeUpdateRecordEventData eventData(*(table.in_use), table, old_data, new_data);
549
return eventData.callEventObservers();
552
bool EventObserver::afterUpdateRecord(Table &table, const unsigned char *old_data, unsigned char *new_data, int err)
554
if (all_event_plugins.empty())
557
AfterUpdateRecordEventData eventData(*(table.in_use), table, old_data, new_data, err);
558
return eventData.callEventObservers();
561
/*==========================================================*/
562
/* Static meathods called by drizzle to notify interested plugins
563
* of a session event,
565
bool EventObserver::beforeCreateDatabase(Session &session, const std::string &db)
567
if (all_event_plugins.empty())
570
BeforeCreateDatabaseEventData eventData(session, db);
571
return eventData.callEventObservers();
574
bool EventObserver::afterCreateDatabase(Session &session, const std::string &db, int err)
576
if (all_event_plugins.empty())
579
AfterCreateDatabaseEventData eventData(session, db, err);
580
return eventData.callEventObservers();
583
bool EventObserver::beforeDropDatabase(Session &session, const std::string &db)
585
if (all_event_plugins.empty())
588
BeforeDropDatabaseEventData eventData(session, db);
589
return eventData.callEventObservers();
592
bool EventObserver::afterDropDatabase(Session &session, const std::string &db, int err)
594
if (all_event_plugins.empty())
597
AfterDropDatabaseEventData eventData(session, db, err);
598
return eventData.callEventObservers();
602
602
} /* namespace plugin */