Drizzled Public API Documentation

query_log.h
00001 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright 2011 Daniel Nichter
00005  *
00006  *  This program is free software: you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation, either version 3 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #pragma once
00021 
00022 #include <drizzled/plugin/event_observer.h>
00023 #include "file.h"
00024 #include "event.h"
00025 
00026 namespace drizzled {
00027 namespace plugin {
00028 
00043 class QueryLog : public drizzled::plugin::EventObserver
00044 {
00045 public:
00046   QueryLog(bool enabled, QueryLoggerFile *logger_file);
00047 
00048   void registerSessionEventsDo(Session &session, EventObserverList &observers);
00049   bool observeEventDo(EventData &);
00050   bool afterStatement(AfterStatementEventData &data);
00051 
00056   bool sysvar_enabled;
00057   bool sysvar_file_enabled;
00058   std::string sysvar_file;
00059   uint32_constraint sysvar_threshold_execution_time;
00060   uint32_constraint sysvar_threshold_lock_time;
00061   uint32_constraint sysvar_threshold_rows_examined;
00062   uint32_constraint sysvar_threshold_rows_sent;
00063   uint32_constraint sysvar_threshold_tmp_tables;
00064   uint32_constraint sysvar_threshold_warnings;
00065   uint32_constraint sysvar_threshold_session_time;
00066 
00067 private:
00068   QueryLoggerFile *_logger_file;
00069   event_t _event;
00070 };
00071 
00072 } /* namespace plugin */
00073 } /* namespace drizzled */