~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/errmsg_print.cc

  • Committer: Monty Taylor
  • Date: 2008-12-30 17:54:25 UTC
  • mto: This revision was merged to the branch mainline in revision 755.
  • Revision ID: mordred@inaugust.com-20081230175425-ub4a4u8lilqdia0p
Msgmerge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Mark Atwood
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
 
20
 
/* This file and these functions are a stopgap until all the
21
 
   sql_print_foo() function calls are replaced with calls to
22
 
   errmsg_printf()
23
 
*/
24
 
 
25
 
#include <drizzled/server_includes.h>
26
 
#include <drizzled/errmsg.h>
27
 
#include <drizzled/errmsg_print.h>
28
 
#include <drizzled/current_session.h>
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
 
}
59
 
 
60
 
void sql_perror(const char *message)
61
 
{
62
 
  // is stderr threadsafe?
63
 
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s", message, strerror(errno));
64
 
}
65
 
 
66
 
 
67
 
bool errmsg_printf (int priority, char const *format, ...)
68
 
{
69
 
  bool rv;
70
 
  va_list args;
71
 
  va_start(args, format);
72
 
  rv= errmsg_vprintf(current_session, priority, format, args);
73
 
  va_end(args);
74
 
  return rv;
75
 
}