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"));
426
330
ADD_ERROR_MESSAGE(ER_WRONG_VALUE_COUNT_ON_ROW, N_("Column count doesn't match value count at row %ld"));
427
331
ADD_ERROR_MESSAGE(ER_CANT_REOPEN_TABLE, N_("Can't reopen table: '%-.192s'"));
428
332
ADD_ERROR_MESSAGE(ER_MIX_OF_GROUP_FUNC_AND_FIELDS, N_("Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause"));
333
ADD_ERROR_MESSAGE(ER_NO_SUCH_TABLE, N_("Table '%-.192s.%-.192s' doesn't exist"));
429
334
ADD_ERROR_MESSAGE(ER_SYNTAX_ERROR, N_("You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use"));
430
335
ADD_ERROR_MESSAGE(ER_NET_PACKET_TOO_LARGE, N_("Got a packet bigger than 'max_allowed_packet' bytes"));
431
336
ADD_ERROR_MESSAGE(ER_NET_PACKETS_OUT_OF_ORDER, N_("Got packets out of order"));
599
504
ADD_ERROR_MESSAGE(ER_USE_SQL_BIG_RESULT, N_("Temporary table too large, rerun with SQL_BIG_RESULT."));
600
505
ADD_ERROR_MESSAGE(ER_UNKNOWN_ENGINE_OPTION, N_("Unknown table engine option key/pair %s = %s."));
601
506
ADD_ERROR_MESSAGE(ER_UNKNOWN_SCHEMA_OPTION, N_("Unknown schema engine option key/pair %s = %s."));
602
ADD_ERROR_MESSAGE(ER_CARTESIAN_JOIN_ATTEMPTED, N_("Implicit cartesian join attempted."));
603
508
ADD_ERROR_MESSAGE(ER_ADMIN_ACCESS, N_("Admin access not allowed from this username/IP address."));
605
510
// User lock/barrier error messages
676
581
ADD_ERROR_MESSAGE(ER_CORRUPT_CATALOG_DEFINITION, N_("Corrupt or invalid catalog definition for '%s' : '%s'."));
677
582
ADD_ERROR_MESSAGE(ER_WRONG_NAME_FOR_CATALOG, N_("Invalid catalog name."));
678
583
ADD_ERROR_MESSAGE(ER_USE_DATA_DICTIONARY, N_("Engine status is now stored in the data_dictionary tables, please use these instead."));
679
ADD_ERROR_MESSAGE(ER_TRANSACTION_ALREADY_STARTED, N_("There is already a transaction in progress"));