~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/errmsg_print.cc

  • Committer: Monty Taylor
  • Date: 2009-04-25 20:45:19 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 1003.
  • Revision ID: mordred@inaugust.com-20090425204519-lgrl7mz2r66v0jby
Blackhole.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Mark Atwood
5
5
 *
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
22
22
   errmsg_printf()
23
23
*/
24
24
 
25
 
#include "config.h"
26
 
#include <drizzled/plugin/registry.h>
 
25
#include <drizzled/server_includes.h>
 
26
#include <drizzled/errmsg.h>
27
27
#include <drizzled/errmsg_print.h>
28
28
#include <drizzled/current_session.h>
29
 
#include <drizzled/plugin/error_message.h>
30
 
 
31
 
#include <cerrno>
32
 
#include <cstring>
33
 
 
34
 
namespace drizzled
35
 
{
 
29
 
 
30
// need this for stderr
 
31
#include <string.h>
 
32
 
 
33
void sql_print_error(const char *format, ...)
 
34
{
 
35
  va_list args;
 
36
  va_start(args, format);
 
37
  errmsg_vprintf(current_session, ERROR_LEVEL, format, args);
 
38
  va_end(args);
 
39
  return;
 
40
}
 
41
 
 
42
void sql_print_warning(const char *format, ...)
 
43
{
 
44
  va_list args;
 
45
  va_start(args, format);
 
46
  errmsg_vprintf(current_session, WARNING_LEVEL, format, args);
 
47
  va_end(args);
 
48
  return;
 
49
}
 
50
 
 
51
void sql_print_information(const char *format, ...)
 
52
{
 
53
  va_list args;
 
54
  va_start(args, format);
 
55
  errmsg_vprintf(current_session, INFORMATION_LEVEL, format, args);
 
56
  va_end(args);
 
57
  return;
 
58
}
36
59
 
37
60
void sql_perror(const char *message)
38
61
{
40
63
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s", message, strerror(errno));
41
64
}
42
65
 
 
66
 
43
67
bool errmsg_printf (int priority, char const *format, ...)
44
68
{
45
69
  bool rv;
46
70
  va_list args;
47
71
  va_start(args, format);
48
 
  rv= plugin::ErrorMessage::vprintf(current_session, priority, format, args);
 
72
  rv= errmsg_vprintf(current_session, priority, format, args);
49
73
  va_end(args);
50
74
  return rv;
51
75
}
52
 
 
53
 
} /* namespace drizzled */