Drizzled Public API Documentation

sql_error.h
1 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2008 Sun Microsystems, Inc.
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 #pragma once
21 
22 #include <bitset>
23 #include <drizzled/error_t.h>
24 #include <drizzled/lex_string.h>
25 #include <drizzled/memory/sql_alloc.h>
26 #include <drizzled/visibility.h>
27 
28 namespace drizzled {
29 
31 {
32 public:
33  static const uint32_t NUM_ERRORS= 4;
34  enum enum_warning_level
35  {
36  WARN_LEVEL_NOTE,
37  WARN_LEVEL_WARN,
38  WARN_LEVEL_ERROR,
39  WARN_LEVEL_END
40  };
41 
42  drizzled::error_t code;
43  enum_warning_level level;
44  const char *msg;
45 
46  DRIZZLE_ERROR(Session *session, drizzled::error_t code_arg, enum_warning_level level_arg, const char *msg_arg) :
47  code(code_arg),
48  level(level_arg)
49  {
50  if (msg_arg)
51  set_msg(session, msg_arg);
52  }
53 
54  void set_msg(Session *session, const char *msg_arg);
55 };
56 
57 DRIZZLED_API DRIZZLE_ERROR *push_warning(Session*, DRIZZLE_ERROR::enum_warning_level level, error_t code, const char *msg);
58 
59 DRIZZLED_API void push_warning_printf(Session*, DRIZZLE_ERROR::enum_warning_level level, error_t code, const char *format, ...);
60 
61 void drizzle_reset_errors(Session&, bool force);
62 bool show_warnings(Session *session, std::bitset<DRIZZLE_ERROR::NUM_ERRORS> &levels_to_show);
63 
64 extern const lex_string_t warning_level_names[];
65 
66 } /* namespace drizzled */
67