~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/event_observer.h

  • Committer: Brian Aker
  • Date: 2011-01-12 06:45:23 UTC
  • mto: (2073.1.4 catalogs)
  • mto: This revision was merged to the branch mainline in revision 2080.
  • Revision ID: brian@tangent.org-20110112064523-rqhptaqbph22qmj1
RemoveĀ customĀ error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#ifndef DRIZZLED_PLUGIN_EVENT_OBSERVER_H
44
44
#define DRIZZLED_PLUGIN_EVENT_OBSERVER_H
45
45
 
46
 
#include <drizzled/plugin/plugin.h>
 
46
#include "drizzled/plugin/plugin.h"
 
47
#include "drizzled/session.h"
47
48
 
48
49
#include <string>
49
50
 
50
 
#include <drizzled/visibility.h>
51
 
 
52
51
namespace drizzled
53
52
{
54
53
 
65
64
typedef std::vector<EventObserver *> EventObserverVector;
66
65
typedef EventObserver* EventObserverPtr;
67
66
 
68
 
class DRIZZLED_API EventObserver : public Plugin
 
67
class EventObserver : public Plugin
69
68
{
70
69
  EventObserver();
71
70
  EventObserver(const EventObserver &);
222
221
  /* Static meathods called by drizzle to notify interested plugins 
223
222
   * of a schema an event,
224
223
 */
225
 
  static bool beforeDropTable(Session &session, const drizzled::identifier::Table &table);
226
 
  static bool afterDropTable(Session &session, const drizzled::identifier::Table &table, int err);
227
 
  static bool beforeRenameTable(Session &session, const drizzled::identifier::Table &from, const drizzled::identifier::Table &to);
228
 
  static bool afterRenameTable(Session &session, const drizzled::identifier::Table &from, const drizzled::identifier::Table &to, int err);
 
224
  static bool beforeDropTable(Session &session, const drizzled::TableIdentifier &table);
 
225
  static bool afterDropTable(Session &session, const drizzled::TableIdentifier &table, int err);
 
226
  static bool beforeRenameTable(Session &session, const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to);
 
227
  static bool afterRenameTable(Session &session, const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to, int err);
229
228
  static bool connectSession(Session &session);
230
229
  static bool disconnectSession(Session &session);
231
230
  static bool beforeStatement(Session &session);
295
294
  // Call all the event observers that are registered for this event.
296
295
  virtual bool callEventObservers();
297
296
  
298
 
  static bool hasEvents(Session &in_session);
 
297
  static bool hasEvents(Session &in_session) { return (in_session.getSessionObservers() != NULL);}
299
298
};
300
299
 
301
300
//-----
336
335
  // Call all the event observers that are registered for this event.
337
336
  virtual bool callEventObservers();
338
337
  
339
 
  static bool hasEvents(Table &in_table);
 
338
  static bool hasEvents(Table &in_table) { return (in_table.getMutableShare()->getTableObservers() != NULL);}
340
339
};
341
340
 
342
341
//-----
435
434
class BeforeDropTableEventData: public SchemaEventData
436
435
{
437
436
public:
438
 
  const drizzled::identifier::Table &table;
 
437
  const drizzled::TableIdentifier &table;
439
438
 
440
 
  BeforeDropTableEventData(Session &session_arg, const drizzled::identifier::Table &table_arg): 
 
439
  BeforeDropTableEventData(Session &session_arg, const drizzled::TableIdentifier &table_arg): 
441
440
    SchemaEventData(EventObserver::BEFORE_DROP_TABLE, session_arg, table_arg.getSchemaName()), 
442
441
    table(table_arg)
443
442
  {}  
447
446
class AfterDropTableEventData: public SchemaEventData
448
447
{
449
448
public:
450
 
  const drizzled::identifier::Table &table;
 
449
  const drizzled::TableIdentifier &table;
451
450
  int err;
452
451
 
453
 
  AfterDropTableEventData(Session &session_arg, const drizzled::identifier::Table &table_arg, int err_arg): 
 
452
  AfterDropTableEventData(Session &session_arg, const drizzled::TableIdentifier &table_arg, int err_arg): 
454
453
    SchemaEventData(EventObserver::AFTER_DROP_TABLE, session_arg, table_arg.getSchemaName()), 
455
454
    table(table_arg), 
456
455
    err(err_arg)
461
460
class BeforeRenameTableEventData: public SchemaEventData
462
461
{
463
462
public:
464
 
  const drizzled::identifier::Table &from;
465
 
  const drizzled::identifier::Table &to;
 
463
  const drizzled::TableIdentifier &from;
 
464
  const drizzled::TableIdentifier &to;
466
465
 
467
 
  BeforeRenameTableEventData(Session &session_arg, const drizzled::identifier::Table &from_arg, const drizzled::identifier::Table &to_arg): 
 
466
  BeforeRenameTableEventData(Session &session_arg, const drizzled::TableIdentifier &from_arg, const drizzled::TableIdentifier &to_arg): 
468
467
    SchemaEventData(EventObserver::BEFORE_RENAME_TABLE, session_arg, from_arg.getSchemaName()), 
469
468
    from(from_arg), 
470
469
    to(to_arg)
475
474
class AfterRenameTableEventData: public SchemaEventData
476
475
{
477
476
public:
478
 
  const drizzled::identifier::Table &from;
479
 
  const drizzled::identifier::Table &to;
 
477
  const drizzled::TableIdentifier &from;
 
478
  const drizzled::TableIdentifier &to;
480
479
  int err;
481
480
 
482
 
  AfterRenameTableEventData(Session &session_arg, const drizzled::identifier::Table &from_arg, const drizzled::identifier::Table &to_arg, int err_arg): 
 
481
  AfterRenameTableEventData(Session &session_arg, const drizzled::TableIdentifier &from_arg, const drizzled::TableIdentifier &to_arg, int err_arg): 
483
482
    SchemaEventData(EventObserver::AFTER_RENAME_TABLE, session_arg, from_arg.getSchemaName()), 
484
483
    from(from_arg), 
485
484
    to(to_arg),