2
* Copyright (C) 2010 PrimeBase Technologies GmbH, Germany
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 2 of the License.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#ifndef PLUGIN_HELLO_EVENTS_HELLO_EVENTS_H
23
#define PLUGIN_HELLO_EVENTS_HELLO_EVENTS_H
25
#include <drizzled/plugin/event_observer.h>
32
class HelloEvents: public EventObserver
36
HelloEvents(std::string name_arg): EventObserver(name_arg), is_enabled(false), db_list(""), table_list(""){}
39
void registerTableEventsDo(TableShare &table_share, EventObserverList &observers);
40
void registerSchemaEventsDo(const std::string &db, EventObserverList &observers);
41
void registerSessionEventsDo(Session &session, EventObserverList &observers);
43
bool observeEventDo(EventData &);
45
// Some custom things for my plugin:
46
void enable() { is_enabled= true;}
47
void disable() { is_enabled= false;}
48
bool isEnabled() const
56
//----------------------
60
void setDatabasesOfInterest(const char *list)
65
const char *getDatabasesOfInterest()
67
return db_list.c_str();
71
bool isDatabaseInteresting(const std::string &db_name)
73
std::string list(db_list);
76
std::string target(db_name);
79
return (list.find(target) != std::string::npos);
82
//----------------------
83
std::string table_list;
86
void setTablesOfInterest(const char *list)
88
table_list.assign(list);
91
const char *getTablesOfInterest()
93
return table_list.c_str();
97
bool isTableInteresting(const std::string &table_name)
99
std::string list(table_list);
102
std::string target(table_name);
105
return (list.find(target) != std::string::npos);
109
//----------------------
110
bool isSessionInteresting(Session &)
112
/* You could filter sessions of interest based on login
120
} /* namespace plugin */
121
} /* namespace drizzled */
122
#endif /* PLUGIN_HELLO_EVENTS_HELLO_EVENTS_H */