390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
212.5.42
by Monty Taylor
Ding dong include is dead. |
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
212.5.42
by Monty Taylor
Ding dong include is dead. |
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
|
|
390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
8 |
* the Free Software Foundation; version 2 of the License.
|
212.5.42
by Monty Taylor
Ding dong include is dead. |
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 |
||
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
20 |
|
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
21 |
#pragma once
|
212.5.42
by Monty Taylor
Ding dong include is dead. |
22 |
|
1271.7.9
by Tim Penhey
Almost there. |
23 |
#include <string> |
1996.3.2
by Monty Taylor
Add API for getting at ErrorMap information. |
24 |
#include <boost/unordered_map.hpp> |
25 |
||
2252.1.1
by Olaf van der Spek
Common fwd |
26 |
#include <drizzled/common_fwd.h> |
2187.2.3
by Brian Aker
This cleans up the the error message system by providing for the ability to |
27 |
#include <drizzled/definitions.h> |
28 |
#include <drizzled/error/level_t.h> |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
29 |
#include <drizzled/error_t.h> |
30 |
#include <drizzled/identifier.h> |
|
31 |
#include <drizzled/visibility.h> |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
32 |
|
2241.3.15
by Olaf van der Spek
Refactor |
33 |
namespace drizzled { |
34 |
||
1271.5.1
by Tim Penhey
Move the bits from my_error.h and my_error.cc into error.h and error.cc. |
35 |
/* Max width of screen (for error messages) */
|
36 |
#define SC_MAXWIDTH 256
|
|
37 |
#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */ |
|
38 |
#define MY_FILE_ERROR ((size_t) -1)
|
|
39 |
#define ME_FATALERROR 1024 /* Fatal statement error */ |
|
40 |
||
1996.3.2
by Monty Taylor
Add API for getting at ErrorMap information. |
41 |
/*
|
42 |
* Provides a mapping from the error enum values to std::strings.
|
|
43 |
*/
|
|
44 |
class ErrorMap |
|
45 |
{
|
|
46 |
public: |
|
47 |
typedef std::pair<std::string, std::string> value_type; |
|
2241.3.15
by Olaf van der Spek
Refactor |
48 |
typedef boost::unordered_map<error_t, value_type> ErrorMessageMap; |
1996.3.2
by Monty Taylor
Add API for getting at ErrorMap information. |
49 |
|
50 |
ErrorMap(); |
|
51 |
||
52 |
// Insert the message for the error. If the error already has an existing
|
|
53 |
// mapping, an error is logged, but the function continues.
|
|
2241.3.15
by Olaf van der Spek
Refactor |
54 |
void add(error_t error_num, const std::string &error_name, const std::string &message); |
1996.3.2
by Monty Taylor
Add API for getting at ErrorMap information. |
55 |
|
2246.4.2
by Olaf van der Spek
Refactor Identifier::getSQLPath() |
56 |
const std::string* find(error_t error_num) const; |
1996.3.2
by Monty Taylor
Add API for getting at ErrorMap information. |
57 |
|
58 |
static const ErrorMessageMap& get_error_message_map(); |
|
59 |
private: |
|
60 |
// Disable copy and assignment.
|
|
61 |
ErrorMap(const ErrorMap &e); |
|
62 |
ErrorMap& operator=(const ErrorMap &e); |
|
63 |
||
64 |
ErrorMessageMap mapping_; |
|
65 |
};
|
|
66 |
||
2241.3.15
by Olaf van der Spek
Refactor |
67 |
typedef void (*error_handler_func)(error_t my_err, |
1271.5.7
by Monty Taylor
Merged up with trunk. |
68 |
const char *str, |
69 |
myf MyFlags); |
|
1271.5.1
by Tim Penhey
Move the bits from my_error.h and my_error.cc into error.h and error.cc. |
70 |
extern error_handler_func error_handler_hook; |
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
71 |
|
1271.7.9
by Tim Penhey
Almost there. |
72 |
// TODO: kill this method. Too much to do with this branch.
|
73 |
// This is called through the ER(x) macro.
|
|
2241.3.15
by Olaf van der Spek
Refactor |
74 |
DRIZZLED_API const char * error_message(error_t err_index); |
202.3.6
by Monty Taylor
First pass at gettexizing the error messages. |
75 |
|
1271.7.9
by Tim Penhey
Almost there. |
76 |
// Adds the message to the global error dictionary.
|
2241.3.15
by Olaf van der Spek
Refactor |
77 |
void add_error_message(error_t error_code, const std::string &error_name, |
1996.3.1
by Monty Taylor
Add error code name into ErrorMap. |
78 |
const std::string& message); |
79 |
#define DRIZZLE_ADD_ERROR_MESSAGE(code, msg) add_error_message(code, STRINGIFY_ARG(code), msg)
|
|
1271.5.1
by Tim Penhey
Move the bits from my_error.h and my_error.cc into error.h and error.cc. |
80 |
|
2159.2.8
by Brian Aker
Merge in fixes for error messages with privs. |
81 |
namespace error { |
82 |
||
2241.3.15
by Olaf van der Spek
Refactor |
83 |
void access(const identifier::User&); |
84 |
void access(const identifier::User&, const identifier::Schema&); |
|
85 |
void access(const identifier::User&, const identifier::Table&); |
|
2159.2.8
by Brian Aker
Merge in fixes for error messages with privs. |
86 |
|
2187.2.3
by Brian Aker
This cleans up the the error message system by providing for the ability to |
87 |
const std::string &verbose_string(); |
88 |
error::level_t &verbosity(); |
|
89 |
void check_verbosity(const std::string &arg); |
|
90 |
||
2159.2.8
by Brian Aker
Merge in fixes for error messages with privs. |
91 |
} // namespace error |
92 |
||
93 |
||
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
94 |
DRIZZLED_API void my_error(const std::string &ref, error_t nr, myf MyFlags= MYF(0)); |
2241.3.15
by Olaf van der Spek
Refactor |
95 |
DRIZZLED_API void my_error(error_t nr, const Identifier&, myf MyFlags= MYF(0)); |
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
96 |
DRIZZLED_API void my_error(error_t nr); |
97 |
DRIZZLED_API void my_error(error_t nr, myf MyFlags, ...); |
|
2241.3.15
by Olaf van der Spek
Refactor |
98 |
void my_message(error_t my_err, const char *str, myf MyFlags); |
99 |
void my_printf_error(error_t my_err, const char *format, |
|
1271.5.1
by Tim Penhey
Move the bits from my_error.h and my_error.cc into error.h and error.cc. |
100 |
myf MyFlags, ...) |
101 |
__attribute__((format(printf, 2, 4))); |
|
102 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
103 |
} /* namespace drizzled */ |
1271.7.4
by Tim Penhey
Another incremental commit. |
104 |