22
22
* Errors a drizzled can give you
26
#include <drizzled/internal/my_sys.h>
27
#include <drizzled/definitions.h>
28
#include <drizzled/error.h>
29
#include <drizzled/gettext.h>
26
#include "drizzled/internal/my_sys.h"
27
#include "drizzled/definitions.h"
28
#include "drizzled/error.h"
29
#include "drizzled/gettext.h"
31
#include <drizzled/identifier.h>
31
#include "drizzled/identifier.h"
33
33
#include <boost/unordered_map.hpp>
34
34
#include <exception>
80
80
error_handler_func error_handler_hook= NULL;
84
void access(drizzled::identifier::User::const_reference user)
86
std::string user_string;
87
user.getSQLPath(user_string);
89
my_error(ER_ACCESS_DENIED_ERROR, MYF(0), user_string.c_str(),
90
user.hasPassword() ? ER(ER_YES) : ER(ER_NO));
93
void access(drizzled::identifier::User::const_reference user, drizzled::identifier::Schema::const_reference schema)
95
std::string user_string;
96
user.getSQLPath(user_string);
98
std::string schema_string;
99
schema.getSQLPath(schema_string);
101
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), user_string.c_str(), schema_string.c_str());
104
void access(drizzled::identifier::User::const_reference user, drizzled::identifier::Table::const_reference table)
106
std::string user_string;
107
user.getSQLPath(user_string);
109
std::string table_string;
110
table.getSQLPath(table_string);
112
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), user_string.c_str(), table_string.c_str());
115
static error::level_t _verbosity= error::ERROR;
116
static std::string _verbosity_strint;
118
const std::string &verbose_string()
124
static std::string _arg= "INSPECT";
129
static std::string _arg= "INFO";
134
static std::string _arg= "WARN";
139
static std::string _arg= "ERROR";
147
error::level_t &verbosity()
152
void check_verbosity(const std::string &arg)
154
if (not arg.compare("INSPECT"))
156
_verbosity= error::INSPECT;
158
else if (not arg.compare("INFO"))
160
_verbosity= error::INFO;
162
else if (not arg.compare("WARN"))
164
_verbosity= error::WARN;
166
else if (not arg.compare("ERROR"))
168
_verbosity= error::ERROR;
176
84
my_error family functions have to be used according following rules:
338
246
ADD_ERROR_MESSAGE(ER_OUT_OF_RESOURCES, N_("Out of memory; check if drizzled or some other process uses all available memory; if not, you may have to use 'ulimit' to allow drizzled to use more memory or you can add more swap space"));
339
247
ADD_ERROR_MESSAGE(ER_BAD_HOST_ERROR, N_("Can't get hostname for your address"));
340
248
ADD_ERROR_MESSAGE(ER_HANDSHAKE_ERROR, N_("Bad handshake"));
342
// Access error messages
343
ADD_ERROR_MESSAGE(ER_DBACCESS_DENIED_ERROR, N_("Access denied for user '%s' to schema '%s'"));
344
ADD_ERROR_MESSAGE(ER_TABLEACCESS_DENIED_ERROR, N_("Access denied for user '%s' to table '%s'"));
345
ADD_ERROR_MESSAGE(ER_ACCESS_DENIED_ERROR, N_("Access denied for user '%s' (using password: %s)"));
249
ADD_ERROR_MESSAGE(ER_DBACCESS_DENIED_ERROR, N_("Access denied for user '%-.48s'@'%-.64s' to schema '%-.192s'"));
250
ADD_ERROR_MESSAGE(ER_ACCESS_DENIED_ERROR, N_("Access denied for user '%-.48s'@'%-.64s' (using password: %s)"));
347
251
ADD_ERROR_MESSAGE(ER_NO_DB_ERROR, N_("No schema selected"));
348
252
ADD_ERROR_MESSAGE(ER_UNKNOWN_COM_ERROR, N_("Unknown command"));
349
253
ADD_ERROR_MESSAGE(ER_BAD_NULL_ERROR, N_("Column '%-.192s' cannot be null"));