Drizzled Public API Documentation

sql_error.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #pragma once
00021 
00022 #include <bitset>
00023 #include <drizzled/error_t.h>
00024 #include <drizzled/lex_string.h>
00025 #include <drizzled/memory/sql_alloc.h>
00026 #include <drizzled/visibility.h>
00027 
00028 namespace drizzled {
00029 
00030 class DRIZZLE_ERROR : public memory::SqlAlloc
00031 {
00032 public:
00033   static const uint32_t NUM_ERRORS= 4;
00034   enum enum_warning_level 
00035   {
00036     WARN_LEVEL_NOTE,
00037     WARN_LEVEL_WARN,
00038     WARN_LEVEL_ERROR,
00039     WARN_LEVEL_END
00040   };
00041 
00042   drizzled::error_t code;
00043   enum_warning_level level;
00044   const char *msg;
00045 
00046   DRIZZLE_ERROR(Session *session, drizzled::error_t code_arg, enum_warning_level level_arg, const char *msg_arg) :
00047     code(code_arg),
00048     level(level_arg)
00049   {
00050     if (msg_arg)
00051       set_msg(session, msg_arg);
00052   }
00053 
00054   void set_msg(Session *session, const char *msg_arg);
00055 };
00056 
00057 DRIZZLED_API DRIZZLE_ERROR *push_warning(Session*, DRIZZLE_ERROR::enum_warning_level level, error_t code, const char *msg);
00058 
00059 DRIZZLED_API void push_warning_printf(Session*, DRIZZLE_ERROR::enum_warning_level level, error_t code, const char *format, ...);
00060 
00061 void drizzle_reset_errors(Session&, bool force);
00062 bool show_warnings(Session *session, std::bitset<DRIZZLE_ERROR::NUM_ERRORS> &levels_to_show);
00063 
00064 extern const lex_string_t warning_level_names[];
00065 
00066 } /* namespace drizzled */
00067