1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
4
* Copyright (C) 2008 Mark Atwood
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
27
#include <drizzled/definitions.h>
25
#include <drizzled/server_includes.h>
26
#include <drizzled/errmsg.h>
28
27
#include <drizzled/errmsg_print.h>
29
#include <drizzled/plugin/error_message.h>
28
#include <drizzled/current_session.h>
30
// need this for stderr
33
void sql_print_error(const char *format, ...)
36
va_start(args, format);
37
errmsg_vprintf(current_session, ERROR_LEVEL, format, args);
42
void sql_print_warning(const char *format, ...)
45
va_start(args, format);
46
errmsg_vprintf(current_session, WARNING_LEVEL, format, args);
51
void sql_print_information(const char *format, ...)
54
va_start(args, format);
55
errmsg_vprintf(current_session, INFORMATION_LEVEL, format, args);
37
60
void sql_perror(const char *message)
39
char errmsg[STRERROR_MAX];
40
strerror_r(errno, errmsg, sizeof(errmsg));
41
errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s\n", message, errmsg);
62
// is stderr threadsafe?
63
errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s", message, strerror(errno));
44
67
bool errmsg_printf (int priority, char const *format, ...)
48
71
va_start(args, format);
49
rv= plugin::ErrorMessage::vprintf(NULL, priority, format, args);
72
rv= errmsg_vprintf(current_session, priority, format, args);
54
} /* namespace drizzled */