~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/logging_gearman/logging_gearman.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <boost/scoped_array.hpp>
23
23
 
 
24
#include <drizzled/plugin.h>
24
25
#include <drizzled/plugin/logging.h>
25
26
#include <drizzled/gettext.h>
26
27
#include <drizzled/session.h>
 
28
#include <drizzled/session/times.h>
27
29
#include <drizzled/sql_parse.h>
28
30
#include <drizzled/errmsg_print.h>
29
31
#include <boost/date_time.hpp>
38
40
#include <cerrno>
39
41
#include <memory>
40
42
 
41
 
 
42
 
namespace drizzle_plugin
43
 
{
 
43
namespace drizzle_plugin {
44
44
 
45
45
namespace po= boost::program_options;
46
46
 
172
172
 
173
173
  LoggingGearman(const std::string &host,
174
174
                 const std::string &function) :
175
 
    drizzled::plugin::Logging("LoggingGearman"),
 
175
    drizzled::plugin::Logging("gearman_query_log"),
176
176
    _host(host),
177
177
    _function(function),
178
178
    _gearman_client_ok(0),
229
229
      inside itself, so be more accurate, and so this doesnt have to
230
230
      keep calling current_utime, which can be slow.
231
231
    */
232
 
    uint64_t t_mark= session->getCurrentTimestamp(false);
 
232
    uint64_t t_mark= session->times.getCurrentTimestamp(false);
233
233
  
234
234
 
235
235
    // buffer to quotify the query
236
236
    unsigned char qs[255];
237
237
  
238
238
    // to avoid trying to printf %s something that is potentially NULL
239
 
    drizzled::util::string::const_shared_ptr dbs(session->schema());
 
239
    drizzled::util::string::ptr dbs(session->schema());
240
240
  
241
241
    msgbuf_len=
242
242
      snprintf(msgbuf.get(), MAX_MSG_LEN,
255
255
               (int)drizzled::getCommandName(session->command).size(),
256
256
               drizzled::getCommandName(session->command).c_str(),
257
257
               // counters are at end, to make it easier to add more
258
 
               (t_mark - session->getConnectMicroseconds()),
259
 
               (session->getElapsedTime()),
260
 
               (t_mark - session->utime_after_lock),
 
258
               (t_mark - session->times.getConnectMicroseconds()),
 
259
               (session->times.getElapsedTime()),
 
260
               (t_mark - session->times.utime_after_lock),
261
261
               session->sent_row_count,
262
262
               session->examined_row_count,
263
263
               session->tmp_table,
309
309
DRIZZLE_DECLARE_PLUGIN
310
310
{
311
311
  DRIZZLE_VERSION_ID,
312
 
    "logging-gearman",
313
 
    "0.1",
314
 
    "Mark Atwood <mark@fallenpegasus.com>",
315
 
    N_("Log queries to a Gearman server"),
316
 
    drizzled::PLUGIN_LICENSE_GPL,
317
 
    drizzle_plugin::logging_gearman_plugin_init,
318
 
    NULL,
319
 
    drizzle_plugin::init_options
 
312
  "logging_gearman",
 
313
  "0.1",
 
314
  "Mark Atwood",
 
315
  N_("Logs queries to a Gearman server"),
 
316
  drizzled::PLUGIN_LICENSE_GPL,
 
317
  drizzle_plugin::logging_gearman_plugin_init,
 
318
  NULL,
 
319
  drizzle_plugin::init_options
320
320
}
321
321
DRIZZLE_DECLARE_PLUGIN_END;