~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/errmsg_print.cc

  • Committer: Eric Day
  • Date: 2009-11-10 21:50:22 UTC
  • mto: This revision was merged to the branch mainline in revision 1218.
  • Revision ID: eday@oddments.org-20091110215022-0b2nqmurv7b2l6wo
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
   errmsg_printf()
23
23
*/
24
24
 
25
 
#include "config.h"
26
 
 
27
 
#include <drizzled/definitions.h>
 
25
#include <drizzled/server_includes.h>
 
26
#include <drizzled/plugin/registry.h>
28
27
#include <drizzled/errmsg_print.h>
 
28
#include <drizzled/current_session.h>
29
29
#include <drizzled/plugin/error_message.h>
30
30
 
31
 
#include <cerrno>
32
 
#include <cstring>
 
31
// need this for stderr
 
32
#include <string.h>
33
33
 
34
 
namespace drizzled
35
 
{
 
34
using namespace drizzled;
36
35
 
37
36
void sql_perror(const char *message)
38
37
{
39
 
  char errmsg[STRERROR_MAX];
40
 
  strerror_r(errno, errmsg, sizeof(errmsg));
41
 
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s\n", message, errmsg);
 
38
  // is stderr threadsafe?
 
39
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s", message, strerror(errno));
42
40
}
43
41
 
44
42
bool errmsg_printf (int priority, char const *format, ...)
46
44
  bool rv;
47
45
  va_list args;
48
46
  va_start(args, format);
49
 
  rv= plugin::ErrorMessage::vprintf(NULL, priority, format, args);
 
47
  rv= plugin::ErrorMessage::vprintf(current_session, priority, format, args);
50
48
  va_end(args);
51
49
  return rv;
52
50
}
53
 
 
54
 
} /* namespace drizzled */