~drizzle-trunk/drizzle/development

243.1.17 by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.)
1
#include <drizzled/server_includes.h>
1 by brian
clean slate
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;
482 by Brian Aker
Remove uint.
11
  uint32_t pbuffsize= sizeof(buff);
1 by brian
clean slate
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:
51.1.41 by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE
34
    assert(0);                            // should not come here
1 by brian
clean slate
35
    return;          // don't crash production builds, just do nothing
36
  }
37
77.1.18 by Monty Taylor
Removed my_vsnprintf and my_snprintf.
38
  vsnprintf(pbuff, pbuffsize, msg, args);
1 by brian
clean slate
39
40
  va_end(args);
41
42
  /* If the msg string ends with '.', do not add a ',' it would be ugly */
261.3.4 by Monty Taylor
Added three more files worth of stuff.
43
  report_function(_("Slave %s: %s%s Error_code: %d"),
1 by brian
clean slate
44
                  m_thread_name, pbuff,
376 by Brian Aker
strend remove
45
                  (pbuff[0] && *(strchr(pbuff, '\0')-1) == '.') ? "" : ",",
1 by brian
clean slate
46
                  err_code);
47
}