~drizzle-trunk/drizzle/development

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