~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/errmsg_print.cc

  • Committer: Monty Taylor
  • Date: 2010-03-23 08:23:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1398.
  • Revision ID: mordred@inaugust.com-20100323082332-r8tktlbu82wlamzv
Set the default plugin version for plugins not specifying a version to be
tied to the actual server version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
*/
24
24
 
25
25
#include "config.h"
26
 
 
27
 
#include <drizzled/definitions.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
31
#include <cerrno>
36
36
 
37
37
void sql_perror(const char *message)
38
38
{
39
 
  char errmsg[STRERROR_MAX];
40
 
  strerror_r(errno, errmsg, sizeof(errmsg));
41
 
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s\n", message, errmsg);
 
39
  // is stderr threadsafe?
 
40
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s", message, strerror(errno));
42
41
}
43
42
 
44
43
bool errmsg_printf (int priority, char const *format, ...)
46
45
  bool rv;
47
46
  va_list args;
48
47
  va_start(args, format);
49
 
  rv= plugin::ErrorMessage::vprintf(NULL, priority, format, args);
 
48
  rv= plugin::ErrorMessage::vprintf(current_session, priority, format, args);
50
49
  va_end(args);
51
50
  return rv;
52
51
}