2311.1.3
by Daniel Nichter
Change to GPLv3 license. |
1 |
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright 2011 Daniel Nichter
|
|
5 |
*
|
|
6 |
* This program is free software: you can redistribute it and/or modify
|
|
2311.1.1
by Daniel Nichter
Add query_log plugin. It's tested and documented. |
7 |
* it under the terms of the GNU General Public License as published by
|
2311.1.3
by Daniel Nichter
Change to GPLv3 license. |
8 |
* the Free Software Foundation, either version 3 of the License, or
|
9 |
* (at your option) any later version.
|
|
2311.1.1
by Daniel Nichter
Add query_log plugin. It's tested and documented. |
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
2311.1.3
by Daniel Nichter
Change to GPLv3 license. |
17 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2311.1.1
by Daniel Nichter
Add query_log plugin. It's tested and documented. |
18 |
*/
|
19 |
||
20 |
#pragma once
|
|
21 |
||
22 |
/**
|
|
23 |
* @file
|
|
24 |
* event.h
|
|
25 |
*
|
|
26 |
* @brief
|
|
27 |
* Defines the event_t struct that encapsulates an event.
|
|
28 |
*
|
|
29 |
* @details
|
|
30 |
* An event (i.e. a query) has the attributes defined in the event_t struct.
|
|
31 |
* The values come from various members of the Session class. This is
|
|
32 |
* a necessary redundancy for two reasons. First, access to this data via
|
|
33 |
* the Session class is not uniform; it requires various calls and
|
|
34 |
* calculations. Look at QueryLog::afterStatement() to see this. Second,
|
|
35 |
* because the QueryLog object controls the logger classes, i.e.
|
|
36 |
* QueryLoggerFile and others in the futre, event creation and filtering
|
|
37 |
* is done in one place (QueryLog::afterStatement()) and then acceptable
|
|
38 |
* events are passed to the logger classes so that all they have to do is log.
|
|
39 |
*
|
|
40 |
* Since this is just a collection of variables, making this a class
|
|
41 |
* with accessor functions is overkill.
|
|
42 |
*/
|
|
43 |
struct event_t { |
|
44 |
// GMT timestamps (2002-01-31T10:00:01.123456)
|
|
45 |
std::string ts; |
|
46 |
||
47 |
// integers
|
|
48 |
uint32_t session_id; |
|
49 |
uint32_t query_id; |
|
50 |
uint32_t rows_examined; |
|
51 |
uint32_t rows_sent; |
|
52 |
uint32_t tmp_tables; |
|
53 |
uint32_t warnings; |
|
54 |
||
55 |
// times (42.123456)
|
|
56 |
double execution_time; |
|
57 |
double lock_time; |
|
58 |
double session_time; |
|
59 |
||
60 |
// bools ("true" or "false")
|
|
61 |
const char *error; |
|
62 |
||
63 |
// strings, not quoted or escaped
|
|
64 |
const char *schema; |
|
65 |
||
66 |
// query, not quoted or escaped
|
|
67 |
const char *query; |
|
68 |
};
|