diff options
Diffstat (limited to 'src/base/stats/mysql.hh')
-rw-r--r-- | src/base/stats/mysql.hh | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/base/stats/mysql.hh b/src/base/stats/mysql.hh index a43c74ecc..52f93ac61 100644 --- a/src/base/stats/mysql.hh +++ b/src/base/stats/mysql.hh @@ -62,7 +62,7 @@ struct SetupStat uint16_t size; void init(); - unsigned setup(); + unsigned setup(MySqlRun *run); }; class InsertData @@ -84,13 +84,34 @@ class InsertData int16_t y; public: - InsertData(); + InsertData(MySqlRun *_run); ~InsertData(); void flush(); void insert(); }; +class InsertEvent +{ + private: + char *query; + int size; + bool first; + static const int maxsize = 1024*1024; + + typedef std::map<std::string, uint32_t> event_map_t; + event_map_t events; + + MySqlRun *run; + + public: + InsertEvent(MySqlRun *_run); + ~InsertEvent(); + + void flush(); + void insert(const std::string &stat); +}; + class MySql : public Output { protected: @@ -99,6 +120,7 @@ class MySql : public Output SetupStat stat; InsertData newdata; + InsertEvent newevent; std::list<FormulaData *> formulas; bool configured; @@ -120,7 +142,7 @@ class MySql : public Output } public: - MySql(MySqlRun &_run){} + MySql(); ~MySql(); void connect(const std::string &host, const std::string &user, @@ -142,6 +164,9 @@ class MySql : public Output virtual bool valid() const; virtual void output(); + // Implement Event Output + virtual void event(const std::string &event); + protected: // Output helper void output(const DistDataData &data); |