~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/event_observer.h

  • Committer: lbieber at stabletransit
  • Date: 2010-10-19 14:03:27 UTC
  • mfrom: (1861.1.2 build)
  • Revision ID: lbieber@drizzle-build-n02.wc1.dfw1.stabletransit.com-20101019140327-2jvt5j2wi4pzhm1z
Merge Brian - Small collection of cleanups/refactor'ing around locks
Merge Monty - fix a few things in the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#define DRIZZLED_PLUGIN_EVENT_OBSERVER_H
45
45
 
46
46
#include "drizzled/plugin/plugin.h"
47
 
#include "drizzled/session.h"
48
47
 
49
48
#include <string>
50
49
 
51
 
#include "drizzled/visibility.h"
52
 
 
53
50
namespace drizzled
54
51
{
55
52
 
56
53
class Table;
57
54
class TableShare;
58
 
class Session;
59
55
 
60
56
namespace plugin
61
57
{
66
62
typedef std::vector<EventObserver *> EventObserverVector;
67
63
typedef EventObserver* EventObserverPtr;
68
64
 
69
 
class DRIZZLED_API EventObserver : public Plugin
 
65
class EventObserver : public Plugin
70
66
{
71
67
  EventObserver();
72
68
  EventObserver(const EventObserver &);
223
219
  /* Static meathods called by drizzle to notify interested plugins 
224
220
   * of a schema an event,
225
221
 */
226
 
  static bool beforeDropTable(Session &session, const drizzled::identifier::Table &table);
227
 
  static bool afterDropTable(Session &session, const drizzled::identifier::Table &table, int err);
228
 
  static bool beforeRenameTable(Session &session, const drizzled::identifier::Table &from, const drizzled::identifier::Table &to);
229
 
  static bool afterRenameTable(Session &session, const drizzled::identifier::Table &from, const drizzled::identifier::Table &to, int err);
 
222
  static bool beforeDropTable(Session &session, const drizzled::TableIdentifier &table);
 
223
  static bool afterDropTable(Session &session, const drizzled::TableIdentifier &table, int err);
 
224
  static bool beforeRenameTable(Session &session, const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to);
 
225
  static bool afterRenameTable(Session &session, const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to, int err);
230
226
  static bool connectSession(Session &session);
231
227
  static bool disconnectSession(Session &session);
232
228
  static bool beforeStatement(Session &session);
295
291
 
296
292
  // Call all the event observers that are registered for this event.
297
293
  virtual bool callEventObservers();
298
 
  
299
 
  static bool hasEvents(Session &in_session) { return (in_session.getSessionObservers() != NULL);}
300
294
};
301
295
 
302
296
//-----
316
310
 
317
311
  // Call all the event observers that are registered for this event.
318
312
  virtual bool callEventObservers();
319
 
  
320
313
};
321
314
 
322
315
//-----
336
329
 
337
330
  // Call all the event observers that are registered for this event.
338
331
  virtual bool callEventObservers();
339
 
  
340
 
  static bool hasEvents(Table &in_table) { return (in_table.getMutableShare()->getTableObservers() != NULL);}
341
332
};
342
333
 
343
334
//-----
436
427
class BeforeDropTableEventData: public SchemaEventData
437
428
{
438
429
public:
439
 
  const drizzled::identifier::Table &table;
 
430
  const drizzled::TableIdentifier &table;
440
431
 
441
 
  BeforeDropTableEventData(Session &session_arg, const drizzled::identifier::Table &table_arg): 
 
432
  BeforeDropTableEventData(Session &session_arg, const drizzled::TableIdentifier &table_arg): 
442
433
    SchemaEventData(EventObserver::BEFORE_DROP_TABLE, session_arg, table_arg.getSchemaName()), 
443
434
    table(table_arg)
444
435
  {}  
448
439
class AfterDropTableEventData: public SchemaEventData
449
440
{
450
441
public:
451
 
  const drizzled::identifier::Table &table;
 
442
  const drizzled::TableIdentifier &table;
452
443
  int err;
453
444
 
454
 
  AfterDropTableEventData(Session &session_arg, const drizzled::identifier::Table &table_arg, int err_arg): 
 
445
  AfterDropTableEventData(Session &session_arg, const drizzled::TableIdentifier &table_arg, int err_arg): 
455
446
    SchemaEventData(EventObserver::AFTER_DROP_TABLE, session_arg, table_arg.getSchemaName()), 
456
447
    table(table_arg), 
457
448
    err(err_arg)
462
453
class BeforeRenameTableEventData: public SchemaEventData
463
454
{
464
455
public:
465
 
  const drizzled::identifier::Table &from;
466
 
  const drizzled::identifier::Table &to;
 
456
  const drizzled::TableIdentifier &from;
 
457
  const drizzled::TableIdentifier &to;
467
458
 
468
 
  BeforeRenameTableEventData(Session &session_arg, const drizzled::identifier::Table &from_arg, const drizzled::identifier::Table &to_arg): 
 
459
  BeforeRenameTableEventData(Session &session_arg, const drizzled::TableIdentifier &from_arg, const drizzled::TableIdentifier &to_arg): 
469
460
    SchemaEventData(EventObserver::BEFORE_RENAME_TABLE, session_arg, from_arg.getSchemaName()), 
470
461
    from(from_arg), 
471
462
    to(to_arg)
476
467
class AfterRenameTableEventData: public SchemaEventData
477
468
{
478
469
public:
479
 
  const drizzled::identifier::Table &from;
480
 
  const drizzled::identifier::Table &to;
 
470
  const drizzled::TableIdentifier &from;
 
471
  const drizzled::TableIdentifier &to;
481
472
  int err;
482
473
 
483
 
  AfterRenameTableEventData(Session &session_arg, const drizzled::identifier::Table &from_arg, const drizzled::identifier::Table &to_arg, int err_arg): 
 
474
  AfterRenameTableEventData(Session &session_arg, const drizzled::TableIdentifier &from_arg, const drizzled::TableIdentifier &to_arg, int err_arg): 
484
475
    SchemaEventData(EventObserver::AFTER_RENAME_TABLE, session_arg, from_arg.getSchemaName()), 
485
476
    from(from_arg), 
486
477
    to(to_arg),