~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/rpl_reporting.cc

  • Committer: Brian Aker
  • Date: 2009-12-29 01:38:38 UTC
  • mfrom: (1251.1.1 drizzle)
  • Revision ID: brian@gaz-20091229013838-03kb2z5xbqw03ddt
Merge of Diego fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <drizzled/server_includes.h>
2
 
#include "rpl_reporting.h"
3
 
 
4
 
void
5
 
Slave_reporting_capability::report(loglevel level, int err_code,
6
 
                                   const char *msg, ...) const
7
 
{
8
 
  void (*report_function)(const char *, ...);
9
 
  char buff[MAX_SLAVE_ERRMSG];
10
 
  char *pbuff= buff;
11
 
  uint pbuffsize= sizeof(buff);
12
 
  va_list args;
13
 
  va_start(args, msg);
14
 
 
15
 
  switch (level)
16
 
  {
17
 
  case ERROR_LEVEL:
18
 
    /*
19
 
      It's an error, it must be reported in Last_error and Last_errno in SHOW
20
 
      SLAVE STATUS.
21
 
    */
22
 
    pbuff= m_last_error.message;
23
 
    pbuffsize= sizeof(m_last_error.message);
24
 
    m_last_error.number = err_code;
25
 
    report_function= sql_print_error;
26
 
    break;
27
 
  case WARNING_LEVEL:
28
 
    report_function= sql_print_warning;
29
 
    break;
30
 
  case INFORMATION_LEVEL:
31
 
    report_function= sql_print_information;
32
 
    break;
33
 
  default:
34
 
    assert(0);                            // should not come here
35
 
    return;          // don't crash production builds, just do nothing
36
 
  }
37
 
 
38
 
  vsnprintf(pbuff, pbuffsize, msg, args);
39
 
 
40
 
  va_end(args);
41
 
 
42
 
  /* If the msg string ends with '.', do not add a ',' it would be ugly */
43
 
  report_function(_("Slave %s: %s%s Error_code: %d"),
44
 
                  m_thread_name, pbuff,
45
 
                  (pbuff[0] && *(strend(pbuff)-1) == '.') ? "" : ",",
46
 
                  err_code);
47
 
}