~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/logging_gearman/logging_gearman.cc

  • Committer: Brian Aker
  • Date: 2009-12-03 01:17:53 UTC
  • mto: (1237.3.2 push)
  • mto: This revision was merged to the branch mainline in revision 1238.
  • Revision ID: brian@gaz-20091203011753-159h2no5m5c5dt9b
Small cleanups, did in MERGE table only engine flag.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <drizzled/server_includes.h>
21
21
#include <drizzled/plugin/logging.h>
22
22
#include <drizzled/gettext.h>
23
23
#include <drizzled/session.h>
24
24
 
25
25
#include <libgearman/gearman.h>
26
 
#include <limits.h>
27
 
#include <sys/time.h>
28
 
#include <sys/types.h>
29
 
#include <sys/stat.h>
30
 
#include <fcntl.h>
31
 
 
32
 
 
33
 
using namespace drizzled;
34
26
 
35
27
 
36
28
/* TODO make this dynamic as needed */
45
37
   until the Session has a good utime "now" we can use
46
38
   will have to use this instead */
47
39
 
 
40
#include <sys/time.h>
48
41
static uint64_t get_microtime()
49
42
{
50
43
#if defined(HAVE_GETHRTIME)
169
162
  return dst;
170
163
}
171
164
 
172
 
class LoggingGearman : public plugin::Logging
 
165
class LoggingGearman : public drizzled::plugin::Logging
173
166
{
174
167
 
175
168
  int gearman_client_ok;
178
171
public:
179
172
 
180
173
  LoggingGearman()
181
 
    : plugin::Logging("LoggingGearman"),
 
174
    : drizzled::plugin::Logging("LoggingGearman"),
182
175
      gearman_client_ok(0)
183
176
  {
184
177
    gearman_return_t ret;
257
250
               // dont need to quote the db name, always CSV safe
258
251
               (int)session->db.length(), dbs,
259
252
               // do need to quote the query
260
 
               quotify((const unsigned char *)session->getQueryString().c_str(),
 
253
               quotify((unsigned char *)session->getQueryString(),
261
254
                       session->getQueryLength(), qs, sizeof(qs)),
262
255
               // command_name is defined in drizzled/sql_parse.cc
263
256
               // dont need to quote the command name, always CSV safe
290
283
 
291
284
static LoggingGearman *handler= NULL;
292
285
 
293
 
static int logging_gearman_plugin_init(plugin::Context &context)
 
286
static int logging_gearman_plugin_init(drizzled::plugin::Registry &registry)
294
287
{
295
288
  handler= new LoggingGearman();
296
 
  context.add(handler);
 
289
  registry.add(handler);
 
290
 
 
291
  return 0;
 
292
}
 
293
 
 
294
static int logging_gearman_plugin_deinit(drizzled::plugin::Registry &registry)
 
295
{
 
296
  registry.remove(handler);
 
297
  delete handler;
297
298
 
298
299
  return 0;
299
300
}
325
326
                          NULL, /* update func*/
326
327
                          "drizzlelog" /* default */);
327
328
 
328
 
static drizzle_sys_var* logging_gearman_system_variables[]= {
 
329
static struct st_mysql_sys_var* logging_gearman_system_variables[]= {
329
330
  DRIZZLE_SYSVAR(enable),
330
331
  DRIZZLE_SYSVAR(host),
331
332
  DRIZZLE_SYSVAR(function),
332
333
  NULL
333
334
};
334
335
 
335
 
DRIZZLE_DECLARE_PLUGIN
 
336
drizzle_declare_plugin
336
337
{
337
 
  DRIZZLE_VERSION_ID,
338
338
    "logging_gearman",
339
339
    "0.1",
340
340
    "Mark Atwood <mark@fallenpegasus.com>",
341
341
    N_("Log queries to a Gearman server"),
342
342
    PLUGIN_LICENSE_GPL,
343
343
    logging_gearman_plugin_init,
 
344
    logging_gearman_plugin_deinit,
 
345
    NULL,   /* status variables */
344
346
    logging_gearman_system_variables,
345
347
    NULL
346
348
}
347
 
DRIZZLE_DECLARE_PLUGIN_END;
 
349
drizzle_declare_plugin_end;