~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_query/logging_query.cc

  • Committer: Monty Taylor
  • Date: 2008-11-07 00:15:51 UTC
  • mto: This revision was merged to the branch mainline in revision 579.
  • Revision ID: monty@inaugust.com-20081107001551-8vxb6sf1ti0i5p09
Cleaned up some headers for PCH.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008, 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Mark Atwood
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
#include <drizzled/plugin/logging.h>
 
20
/* need to define DRIZZLE_SERVER to get inside the Session */
 
21
#define DRIZZLE_SERVER 1
 
22
#include <drizzled/server_includes.h>
 
23
#include <drizzled/plugin_logging.h>
22
24
#include <drizzled/gettext.h>
23
 
#include <drizzled/session.h>
24
 
#include PCRE_HEADER
25
 
#include <limits.h>
 
25
 
 
26
/* todo, make this dynamic as needed */
 
27
#define MAX_MSG_LEN (32*1024)
 
28
 
 
29
static char* logging_query_filename= NULL;
 
30
static bool logging_query_enable= true;
 
31
static ulong logging_query_enable_time= 0;
 
32
static ulong logging_query_threshold_big_resultset= 0;
 
33
 
 
34
static int fd= -1;
 
35
 
 
36
// copied from drizzled/sql_parse.cc
 
37
const LEX_STRING command_name[]={
 
38
  { C_STRING_WITH_LEN("Sleep") },
 
39
  { C_STRING_WITH_LEN("Quit") },
 
40
  { C_STRING_WITH_LEN("InitDB") },
 
41
  { C_STRING_WITH_LEN("Query") },
 
42
  { C_STRING_WITH_LEN("FieldList") },
 
43
  { C_STRING_WITH_LEN("CreateDB") },
 
44
  { C_STRING_WITH_LEN("DropDB") },
 
45
  { C_STRING_WITH_LEN("Refresh") },
 
46
  { C_STRING_WITH_LEN("Shutdown") },
 
47
  { C_STRING_WITH_LEN("Processlist") },
 
48
  { C_STRING_WITH_LEN("Connect") },
 
49
  { C_STRING_WITH_LEN("Kill") },
 
50
  { C_STRING_WITH_LEN("Ping") },
 
51
  { C_STRING_WITH_LEN("Time") },
 
52
  { C_STRING_WITH_LEN("ChangeUser") },
 
53
  { C_STRING_WITH_LEN("BinlogDump") },
 
54
  { C_STRING_WITH_LEN("ConnectOut") },
 
55
  { C_STRING_WITH_LEN("RegisterSlave") },
 
56
  { C_STRING_WITH_LEN("SetOption") },
 
57
  { C_STRING_WITH_LEN("Daemon") },
 
58
  { C_STRING_WITH_LEN("Error") }
 
59
};
 
60
 
 
61
 
 
62
/* stolen from mysys/my_getsystime 
 
63
   until the Session has a good utime "now" we can use
 
64
   will have to use this instead */
 
65
 
26
66
#include <sys/time.h>
27
 
#include <sys/types.h>
28
 
#include <sys/stat.h>
29
 
#include <fcntl.h>
30
 
#include <string>
31
 
#include <boost/format.hpp>
32
 
#include <boost/program_options.hpp>
33
 
#include <drizzled/module/option_map.h>
34
 
#include <cstdio>
35
 
#include <cerrno>
36
 
 
37
 
namespace po= boost::program_options;
38
 
using namespace drizzled;
39
 
using namespace std;
40
 
 
41
 
#define ESCAPE_CHAR      '\\'
42
 
#define SEPARATOR_CHAR   ','
43
 
 
44
 
namespace drizzle_plugin
45
 
{
46
 
 
47
 
static bool sysvar_logging_query_enable= false;
48
 
/* TODO fix these to not be unsigned long once we have sensible sys_var system */
49
 
static uint32_constraint sysvar_logging_query_threshold_slow;
50
 
static uint32_constraint sysvar_logging_query_threshold_big_resultset;
51
 
static uint32_constraint sysvar_logging_query_threshold_big_examined;
52
 
 
53
 
/* quote a string to be safe to include in a CSV line
54
 
   that means backslash quoting all commas, doublequotes, backslashes,
55
 
   and all the ASCII unprintable characters
56
 
   as long as we pass the high-bit bytes unchanged
57
 
   this is safe to do to a UTF8 string
58
 
   we dont allow overrunning the targetbuffer
59
 
   to avoid having a very long query overwrite memory
60
 
 
61
 
   TODO consider remapping the unprintables instead to "Printable
62
 
   Representation", the Unicode characters from the area U+2400 to
63
 
   U+2421 reserved for representing control characters when it is
64
 
   necessary to print or display them rather than have them perform
65
 
   their intended function.
66
 
 
67
 
*/
68
 
 
69
 
static void quotify(const string &src, string &dst)
70
 
{
71
 
  static const char hexit[]= { '0', '1', '2', '3', '4', '5', '6', '7',
72
 
                          '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
73
 
  string::const_iterator src_iter;
74
 
  
75
 
  for (src_iter= src.begin(); src_iter < src.end(); ++src_iter)
76
 
  {
77
 
    if (static_cast<unsigned char>(*src_iter) > 0x7f)
78
 
    {
79
 
      dst.push_back(*src_iter);
80
 
    }
81
 
    else if (*src_iter == 0x00)  // null
82
 
    {
83
 
      dst.push_back(ESCAPE_CHAR); dst.push_back('0');
84
 
    }
85
 
    else if (*src_iter == 0x07)  // bell
86
 
    {
87
 
      dst.push_back(ESCAPE_CHAR); dst.push_back('a');
88
 
    }
89
 
    else if (*src_iter == 0x08)  // backspace
90
 
    {
91
 
      dst.push_back(ESCAPE_CHAR); dst.push_back('b');
92
 
    }
93
 
    else if (*src_iter == 0x09)  // horiz tab
94
 
    {
95
 
      dst.push_back(ESCAPE_CHAR); dst.push_back('t');
96
 
    }
97
 
    else if (*src_iter == 0x0a)  // line feed
98
 
    {
99
 
      dst.push_back(ESCAPE_CHAR); dst.push_back('n');
100
 
    }
101
 
    else if (*src_iter == 0x0b)  // vert tab
102
 
    {
103
 
      dst.push_back(ESCAPE_CHAR); dst.push_back('v');
104
 
    }
105
 
    else if (*src_iter == 0x0c)  // formfeed
106
 
    {
107
 
      dst.push_back(ESCAPE_CHAR); dst.push_back('f');
108
 
    }
109
 
    else if (*src_iter == 0x0d)  // carrage return
110
 
    {
111
 
      dst.push_back(ESCAPE_CHAR); dst.push_back('r');
112
 
    }
113
 
    else if (*src_iter == 0x1b)  // escape
114
 
    {
115
 
      dst.push_back(ESCAPE_CHAR); dst.push_back('e');
116
 
    }
117
 
    else if (*src_iter == 0x22)  // quotation mark
118
 
    {
119
 
      dst.push_back(ESCAPE_CHAR); dst.push_back(0x22);
120
 
    }
121
 
    else if (*src_iter == SEPARATOR_CHAR)
122
 
    {
123
 
      dst.push_back(ESCAPE_CHAR); dst.push_back(SEPARATOR_CHAR);
124
 
    }
125
 
    else if (*src_iter == ESCAPE_CHAR)
126
 
    {
127
 
      dst.push_back(ESCAPE_CHAR); dst.push_back(ESCAPE_CHAR);
128
 
    }
129
 
    else if ((*src_iter < 0x20) || (*src_iter == 0x7F))  // other unprintable ASCII
130
 
    {
131
 
      dst.push_back(ESCAPE_CHAR);
132
 
      dst.push_back('x');
133
 
      dst.push_back(hexit[(*src_iter >> 4) & 0x0f]);
134
 
      dst.push_back(hexit[*src_iter & 0x0f]);
135
 
    }
136
 
    else  // everything else
137
 
    {
138
 
      dst.push_back(*src_iter);
139
 
    }
140
 
  }
141
 
}
142
 
 
143
 
 
144
 
class Logging_query: public drizzled::plugin::Logging
145
 
{
146
 
  const std::string _filename;
147
 
  const std::string _query_pcre;
148
 
  int fd;
149
 
  pcre *re;
150
 
  pcre_extra *pe;
151
 
 
152
 
  /** Format of the output string */
153
 
  boost::format formatter;
154
 
 
155
 
public:
156
 
 
157
 
  Logging_query(const std::string &filename,
158
 
                const std::string &query_pcre) :
159
 
    drizzled::plugin::Logging("Logging_query"),
160
 
    _filename(filename),
161
 
    _query_pcre(query_pcre),
162
 
    fd(-1), re(NULL), pe(NULL),
163
 
    formatter("%1%,%2%,%3%,\"%4%\",\"%5%\",\"%6%\",%7%,%8%,"
164
 
              "%9%,%10%,%11%,%12%,%13%,%14%,\"%15%\"\n")
165
 
  {
166
 
 
167
 
    /* if there is no destination filename, dont bother doing anything */
168
 
    if (_filename.empty())
169
 
      return;
170
 
 
171
 
    fd= open(_filename.c_str(),
172
 
             O_WRONLY | O_APPEND | O_CREAT,
173
 
             S_IRUSR|S_IWUSR);
174
 
 
175
 
    if (fd < 0)
176
 
    {
177
 
      sql_perror( _("fail open()"), _filename);
178
 
      return;
179
 
    }
180
 
 
181
 
    if (not _query_pcre.empty())
182
 
    {
183
 
      const char *this_pcre_error;
184
 
      int this_pcre_erroffset;
185
 
      re= pcre_compile(_query_pcre.c_str(), 0, &this_pcre_error,
186
 
                       &this_pcre_erroffset, NULL);
187
 
      pe= pcre_study(re, 0, &this_pcre_error);
188
 
      /* TODO emit error messages if there is a problem */
189
 
    }
190
 
  }
191
 
 
192
 
  ~Logging_query()
193
 
  {
194
 
    if (fd >= 0)
195
 
    {
196
 
      close(fd);
197
 
    }
198
 
 
199
 
    if (pe != NULL)
200
 
    {
201
 
      pcre_free(pe);
202
 
    }
203
 
 
204
 
    if (re != NULL)
205
 
    {
206
 
      pcre_free(re);
207
 
    }
208
 
  }
209
 
 
210
 
  virtual bool post (Session *session)
211
 
  {
212
 
    size_t wrv;
213
 
 
214
 
    assert(session != NULL);
215
 
 
216
 
    if (fd < 0)
217
 
      return false;
218
 
 
219
 
    /* Yes, we know that checking sysvar_logging_query_enable,
220
 
       sysvar_logging_query_threshold_big_resultset, and
221
 
       sysvar_logging_query_threshold_big_examined is not threadsafe,
222
 
       because some other thread might change these sysvars.  But we
223
 
       don't care.  We might start logging a little late as it spreads
224
 
       to other threads.  Big deal. */
225
 
 
226
 
    // return if not enabled or query was too fast or resultset was too small
227
 
    if (sysvar_logging_query_enable == false)
228
 
      return false;
229
 
    if (session->sent_row_count < sysvar_logging_query_threshold_big_resultset.get())
230
 
      return false;
231
 
    if (session->examined_row_count < sysvar_logging_query_threshold_big_examined.get())
232
 
      return false;
233
 
 
234
 
    /*
235
 
      TODO, the session object should have a "utime command completed"
236
 
      inside itself, so be more accurate, and so this doesnt have to
237
 
      keep calling current_utime, which can be slow.
238
 
    */
239
 
    uint64_t t_mark= session->getCurrentTimestamp(false);
240
 
 
241
 
    if (session->getElapsedTime() < (sysvar_logging_query_threshold_slow.get()))
242
 
      return false;
243
 
 
244
 
    Session::QueryString query_string(session->getQueryString());
245
 
    if (re)
246
 
    {
247
 
      int this_pcre_rc;
248
 
      this_pcre_rc= pcre_exec(re, pe, query_string->c_str(), query_string->length(), 0, 0, NULL, 0);
249
 
      if (this_pcre_rc < 0)
250
 
        return false;
251
 
    }
252
 
 
253
 
    // buffer to quotify the query
254
 
    string qs;
255
 
    
256
 
    // Since quotify() builds the quoted string incrementally, we can
257
 
    // avoid some reallocating if we reserve some space up front.
258
 
    qs.reserve(query_string->length());
259
 
    
260
 
    quotify(*query_string, qs);
261
 
    
262
 
    // to avoid trying to printf %s something that is potentially NULL
263
 
    util::string::const_shared_ptr schema(session->schema());
264
 
    const char *dbs= (schema and not schema->empty()) ? schema->c_str() : "";
265
 
 
266
 
    formatter % t_mark
267
 
              % session->thread_id
268
 
              % session->getQueryId()
269
 
              % dbs
270
 
              % qs
271
 
              % getCommandName(session->command)
272
 
              % (t_mark - session->getConnectMicroseconds())
273
 
              % session->getElapsedTime()
274
 
              % (t_mark - session->utime_after_lock)
275
 
              % session->sent_row_count
276
 
              % session->examined_row_count
277
 
              % session->tmp_table
278
 
              % session->total_warn_count
279
 
              % session->getServerId()
280
 
              % glob_hostname;
281
 
 
282
 
    string msgbuf= formatter.str();
283
 
 
284
 
    // a single write has a kernel thread lock, thus no need mutex guard this
285
 
    wrv= write(fd, msgbuf.c_str(), msgbuf.length());
286
 
    assert(wrv == msgbuf.length());
287
 
 
288
 
    return false;
289
 
  }
 
67
static uint64_t get_microtime()
 
68
{
 
69
#if defined(HAVE_GETHRTIME)
 
70
  return gethrtime()/1000;
 
71
#else
 
72
  uint64_t newtime;
 
73
  struct timeval t;
 
74
  /*
 
75
    The following loop is here because gettimeofday may fail on some systems
 
76
  */
 
77
  while (gettimeofday(&t, NULL) != 0) {}
 
78
  newtime= (uint64_t)t.tv_sec * 1000000 + t.tv_usec;
 
79
  return newtime;
 
80
#endif  /* defined(HAVE_GETHRTIME) */
 
81
}
 
82
 
 
83
/* we could just not have a pre entrypoint at all,
 
84
   and have logging_pre == NULL
 
85
   but we have this here for the sake of being an example */
 
86
bool logging_query_func_pre (Session *session __attribute__((unused)))
 
87
{
 
88
  return false;
 
89
}
 
90
 
 
91
bool logging_query_func_post (Session *session)
 
92
{
 
93
  char msgbuf[MAX_MSG_LEN];
 
94
  int msgbuf_len= 0;
 
95
  int wrv;
 
96
 
 
97
  if (fd < 0) return false;
 
98
 
 
99
  assert(session != NULL);
 
100
 
 
101
  /*
 
102
    here is some time stuff from class Session
 
103
      uint64_t connect_utime;
 
104
        todo, looks like this isnt being set
 
105
        we could store the time this plugin was loaded
 
106
        but that would just be a dumb workaround
 
107
      uint64_t start_utime;
 
108
      uint64_t utime_after_lock;
 
109
      uint64_t current_utime();
 
110
        todo, cant get to because of namemangling
 
111
  */
 
112
 
 
113
  /* todo, the Session should have a "utime command completed" inside
 
114
     itself, so be more accurate, and so plugins dont have to keep
 
115
     calling current_utime, which can be slow */
 
116
  uint64_t t_mark= get_microtime();
 
117
 
 
118
  msgbuf_len=
 
119
    snprintf(msgbuf, MAX_MSG_LEN,
 
120
             _("thread_id=%ld query_id=%ld"
 
121
               " t_connect=%lld t_start=%lld t_lock=%lld"
 
122
               " command=%.*s"
 
123
               " rows_sent=%ld rows_examined=%u\n"
 
124
               " db=\"%.*s\" query=\"%.*s\"\n"),
 
125
             (unsigned long) session->thread_id, 
 
126
             (unsigned long) session->query_id,
 
127
             (unsigned long long)(t_mark - session->connect_utime),
 
128
             (unsigned long long)(t_mark - session->start_utime),
 
129
             (unsigned long long)(t_mark - session->utime_after_lock),
 
130
             (uint32_t)command_name[session->command].length,
 
131
             command_name[session->command].str,
 
132
             (unsigned long) session->sent_row_count,
 
133
             (uint32_t) session->examined_row_count,
 
134
             session->db_length, session->db,
 
135
             session->query_length, session->query);
 
136
  /* a single write has a OS level thread lock
 
137
     so there is no need to have mutexes guarding this write,
 
138
  */
 
139
  wrv= write(fd, msgbuf, msgbuf_len);
 
140
  assert(wrv == msgbuf_len);
 
141
 
 
142
  return false;
 
143
}
 
144
 
 
145
static int logging_query_plugin_init(void *p)
 
146
{
 
147
  logging_t *l= (logging_t *) p;
 
148
 
 
149
  if (logging_query_filename == NULL)
 
150
  {
 
151
    /* no destination filename was specified via system variables
 
152
       return now, dont set the callback pointers 
 
153
    */
 
154
    return 0;
 
155
  }
 
156
 
 
157
  fd= open(logging_query_filename, O_WRONLY | O_APPEND | O_CREAT,
 
158
           S_IRUSR|S_IWUSR);
 
159
  if (fd < 0) 
 
160
  {
 
161
    sql_print_error(_("fail open() fn=%s er=%s\n"),
 
162
                    logging_query_filename,
 
163
                    strerror(errno));
 
164
 
 
165
    /* todo
 
166
       we should return an error here, so the plugin doesnt load
 
167
       but this causes Drizzle to crash
 
168
       so until that is fixed,
 
169
       just return a success,
 
170
       but leave the function pointers as NULL and the fd as -1
 
171
    */
 
172
    return 0;
 
173
  }
 
174
 
 
175
  l->logging_pre= logging_query_func_pre;
 
176
  l->logging_post= logging_query_func_post;
 
177
 
 
178
  return 0;
 
179
}
 
180
 
 
181
static int logging_query_plugin_deinit(void *p)
 
182
{
 
183
  logging_st *l= (logging_st *) p;
 
184
 
 
185
  if (fd >= 0) 
 
186
  {
 
187
    close(fd);
 
188
    fd= -1;
 
189
  }
 
190
 
 
191
  l->logging_pre= NULL;
 
192
  l->logging_post= NULL;
 
193
 
 
194
  return 0;
 
195
}
 
196
 
 
197
static DRIZZLE_SYSVAR_STR(
 
198
  filename,
 
199
  logging_query_filename,
 
200
  PLUGIN_VAR_READONLY,
 
201
  N_("File to log to"),
 
202
  NULL, /* check func */
 
203
  NULL, /* update func*/
 
204
  NULL /* default */);
 
205
 
 
206
static DRIZZLE_SYSVAR_BOOL(
 
207
  enable,
 
208
  logging_query_enable,
 
209
  PLUGIN_VAR_NOCMDARG,
 
210
  N_("Enable logging"),
 
211
  NULL, /* check func */
 
212
  NULL, /* update func */
 
213
  true /* default */);
 
214
 
 
215
static DRIZZLE_SYSVAR_ULONG(
 
216
  enable_time,
 
217
  logging_query_enable_time,
 
218
  PLUGIN_VAR_OPCMDARG,
 
219
  N_("Disable after this many seconds. Zero for forever"),
 
220
  NULL, /* check func */
 
221
  NULL, /* update func */
 
222
  0, /* default */
 
223
  0, /* min */
 
224
  ULONG_MAX, /* max */
 
225
  0 /* blksiz */);
 
226
 
 
227
#ifdef NOT_YET
 
228
static DRIZZLE_SYSVAR_ULONG(
 
229
  threshhold_slow,
 
230
  logging_query_threshold_slow,
 
231
  PLUGIN_VAR_OPCMDARG,
 
232
  N_("Threshold for logging slow queries, in microseconds"),
 
233
  NULL, /* check func */
 
234
  NULL, /* update func */
 
235
  0, /* default */
 
236
  0, /* min */
 
237
  ULONG_MAX, /* max */
 
238
  0 /* blksiz */);
 
239
#endif
 
240
 
 
241
static DRIZZLE_SYSVAR_ULONG(
 
242
  threshold_big_resultset,
 
243
  logging_query_threshold_big_resultset,
 
244
  PLUGIN_VAR_OPCMDARG,
 
245
  N_("Threshold for logging big queries, for rows returned"),
 
246
  NULL, /* check func */
 
247
  NULL, /* update func */
 
248
  0, /* default */
 
249
  0, /* min */
 
250
  ULONG_MAX, /* max */
 
251
  0 /* blksiz */);
 
252
 
 
253
#ifdef NOT_YET
 
254
static DRIZZLE_SYSVAR_ULONG(
 
255
  threshhold_big_examined,
 
256
  logging_query_threshold_big_examined,
 
257
  PLUGIN_VAR_OPCMDARG,
 
258
  N_("Threshold for logging big queries, for rows examined"),
 
259
  NULL, /* check func */
 
260
  NULL, /* update func */
 
261
  0, /* default */
 
262
  0, /* min */
 
263
  ULONG_MAX, /* max */
 
264
  0 /* blksiz */);
 
265
#endif
 
266
 
 
267
static struct st_mysql_sys_var* logging_query_system_variables[]= {
 
268
  DRIZZLE_SYSVAR(filename),
 
269
  DRIZZLE_SYSVAR(enable),
 
270
  DRIZZLE_SYSVAR(enable_time),
 
271
  DRIZZLE_SYSVAR(threshold_big_resultset),
 
272
  NULL
290
273
};
291
274
 
292
 
static int logging_query_plugin_init(drizzled::module::Context &context)
293
 
{
294
 
 
295
 
  const module::option_map &vm= context.getOptions();
296
 
 
297
 
  if (vm.count("filename") > 0)
298
 
  {
299
 
    context.add(new Logging_query(vm["filename"].as<string>(),
300
 
                                  vm["pcre"].as<string>()));
301
 
    context.registerVariable(new sys_var_bool_ptr("enable", &sysvar_logging_query_enable));
302
 
    context.registerVariable(new sys_var_const_string_val("filename", vm["filename"].as<string>()));
303
 
    context.registerVariable(new sys_var_const_string_val("pcre", vm["pcre"].as<string>()));
304
 
    context.registerVariable(new sys_var_constrained_value<uint32_t>("threshold_slow", sysvar_logging_query_threshold_slow));
305
 
    context.registerVariable(new sys_var_constrained_value<uint32_t>("threshold_big_resultset", sysvar_logging_query_threshold_big_resultset));
306
 
    context.registerVariable(new sys_var_constrained_value<uint32_t>("threshold_big_examined", sysvar_logging_query_threshold_big_examined));
307
 
  }
308
 
 
309
 
  return 0;
310
 
}
311
 
 
312
 
static void init_options(drizzled::module::option_context &context)
313
 
{
314
 
  context("enable",
315
 
          po::value<bool>(&sysvar_logging_query_enable)->default_value(false)->zero_tokens(),
316
 
          _("Enable logging to CSV file"));
317
 
  context("filename",
318
 
          po::value<string>(),
319
 
          _("File to log to"));
320
 
  context("pcre",
321
 
          po::value<string>()->default_value(""),
322
 
          _("PCRE to match the query against"));
323
 
  context("threshold-slow",
324
 
          po::value<uint32_constraint>(&sysvar_logging_query_threshold_slow)->default_value(0),
325
 
          _("Threshold for logging slow queries, in microseconds"));
326
 
  context("threshold-big-resultset",
327
 
          po::value<uint32_constraint>(&sysvar_logging_query_threshold_big_resultset)->default_value(0),
328
 
          _("Threshold for logging big queries, for rows returned"));
329
 
  context("threshold-big-examined",
330
 
          po::value<uint32_constraint>(&sysvar_logging_query_threshold_big_examined)->default_value(0),
331
 
          _("Threshold for logging big queries, for rows examined"));
332
 
}
333
 
 
334
 
} /* namespace drizzle_plugin */
335
 
 
336
 
DRIZZLE_DECLARE_PLUGIN
337
 
{
338
 
  DRIZZLE_VERSION_ID,
339
 
  "logging-query",
340
 
  "0.2",
 
275
mysql_declare_plugin(logging_query)
 
276
{
 
277
  DRIZZLE_LOGGER_PLUGIN,
 
278
  "logging_query",
 
279
  "0.1",
341
280
  "Mark Atwood <mark@fallenpegasus.com>",
342
 
  N_("Log queries to a CSV file"),
 
281
  N_("Log queries to a file"),
343
282
  PLUGIN_LICENSE_GPL,
344
 
  drizzle_plugin::logging_query_plugin_init,
345
 
  NULL,
346
 
  drizzle_plugin::init_options
 
283
  logging_query_plugin_init,
 
284
  logging_query_plugin_deinit,
 
285
  NULL,   /* status variables */
 
286
  logging_query_system_variables,
 
287
  NULL
347
288
}
348
 
DRIZZLE_DECLARE_PLUGIN_END;
 
289
mysql_declare_plugin_end;