1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems, Inc.
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.
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.
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
21
#include <drizzled/base.h>
22
#include <drizzled/internal/my_sys.h>
23
#include <plugin/myisam/my_handler.h>
24
#include <drizzled/error.h>
25
#include <drizzled/gettext.h>
27
using namespace drizzled;
1
#include <libdrizzle/gettext.h>
30
4
Errors a handler can give you
34
Register handler error messages for usage with my_error()
37
Calling this method multiple times will emit warnings as the
38
message values are overridden.
40
void my_handler_error_register(void)
7
static const char *handler_error_messages[]=
42
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_KEY_NOT_FOUND, N_("Didn't find key on read or update"));
43
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_FOUND_DUPP_KEY, N_("Duplicate key on write or update"));
44
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_INTERNAL_ERROR, N_("Internal (unspecified) error in handler"));
45
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_RECORD_CHANGED,
46
N_("Someone has changed the row since it was read (while the table "
47
"was locked to prevent it)"));
48
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_WRONG_INDEX, N_("Wrong index given to function"));
49
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_CRASHED, N_("Index file is crashed"));
50
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_WRONG_IN_RECORD, N_("Record file is crashed"));
51
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_OUT_OF_MEM, N_("Out of memory in engine"));
52
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NOT_A_TABLE, N_("Incorrect file format"));
53
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_WRONG_COMMAND, N_("Command not supported by database"));
54
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_OLD_FILE, N_("Old database file"));
55
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NO_ACTIVE_RECORD, N_("No record read before update"));
56
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_RECORD_DELETED, N_("Record was already deleted (or record file crashed)"));
57
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_RECORD_FILE_FULL, N_("No more room in record file"));
58
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_INDEX_FILE_FULL, N_("No more room in index file"));
59
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_END_OF_FILE, N_("No more records (read after end of file)"));
60
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_UNSUPPORTED, N_("Unsupported extension used for table"));
61
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_TO_BIG_ROW, N_("Too big row"));
62
DRIZZLE_ADD_ERROR_MESSAGE(HA_WRONG_CREATE_OPTION, N_("Wrong create options"));
63
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_FOUND_DUPP_UNIQUE, N_("Duplicate unique key or constraint on write or update"));
64
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_UNKNOWN_CHARSET, N_("Unknown character set used in table"));
65
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_WRONG_MRG_TABLE_DEF, N_("Conflicting table definitions in sub-tables of MERGE table"));
66
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_CRASHED_ON_REPAIR, N_("Table is crashed and last repair failed"));
67
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_CRASHED_ON_USAGE, N_("Table was marked as crashed and should be repaired"));
68
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_LOCK_WAIT_TIMEOUT, N_("Lock timed out; Retry transaction"));
69
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_LOCK_TABLE_FULL, N_("Lock table is full; Restart program with a larger locktable"));
70
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_READ_ONLY_TRANSACTION, N_("Updates are not allowed under a read only transactions"));
71
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_LOCK_DEADLOCK, N_("Lock deadlock; Retry transaction"));
72
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_CANNOT_ADD_FOREIGN, N_("Foreign key constraint is incorrectly formed"));
73
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NO_REFERENCED_ROW, N_("Cannot add a child row"));
74
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_ROW_IS_REFERENCED, N_("Cannot delete a parent row"));
75
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NO_SAVEPOINT, N_("No savepoint with that name"));
76
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NON_UNIQUE_BLOCK_SIZE, N_("Non unique key block size"));
77
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NO_SUCH_TABLE, N_("The table does not exist in engine"));
78
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_TABLE_EXIST, N_("The table already existed in storage engine"));
79
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NO_CONNECTION, N_("Could not connect to storage engine"));
80
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NULL_IN_SPATIAL, N_("Unexpected null pointer found when using spatial index"));
81
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_TABLE_DEF_CHANGED, N_("The table changed in storage engine"));
82
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NO_PARTITION_FOUND, N_("There's no partition in table for the given value"));
83
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_RBR_LOGGING_FAILED, N_("Row-based binlogging of row failed"));
84
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_DROP_INDEX_FK, N_("Index needed in foreign key constraint"));
85
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_FOREIGN_DUPLICATE_KEY, N_("Upholding foreign key constraints would lead to a duplicate key error"));
86
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_TABLE_NEEDS_UPGRADE, N_("Table needs to be upgraded before it can be used"));
87
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_TABLE_READONLY, N_("Table is read only"));
88
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_AUTOINC_READ_FAILED, N_("Failed to get next auto increment value"));
89
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_AUTOINC_ERANGE, N_("Failed to set row auto increment value"));
90
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_GENERIC, N_("Unknown (generic) error from engine"));
91
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_RECORD_IS_THE_SAME, N_("Record is the same"));
92
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_LOGGING_IMPOSSIBLE, N_("It is not possible to log this statement"));
93
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_TABLESPACE_EXIST, N_("Tablespace exists"));
94
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_CORRUPT_EVENT, N_("The event was corrupt, leading to illegal data being read"));
95
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NEW_FILE, N_("The table is of a new format not supported by this version"));
96
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_ROWS_EVENT_APPLY, N_("The event could not be processed no other handler error happened"));
97
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_INITIALIZATION, N_("Got a fatal error during initialzation of handler"));
98
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_FILE_TOO_SHORT, N_("File to short; Expected more data in file"));
99
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_WRONG_CRC, N_("Read page with wrong checksum"));
100
/* TODO: get a better message for these */
101
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_LOCK_OR_ACTIVE_TRANSACTION, N_("Lock or active transaction"));
102
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_NO_SUCH_TABLESPACE, N_("No such table space"));
103
DRIZZLE_ADD_ERROR_MESSAGE(HA_ERR_TABLESPACE_NOT_EMPTY, N_("Tablespace not empty"));
9
/* HA_ERR_KEY_NOT_FOUND */
10
N_("Didn't find key on read or update"),
11
/* HA_ERR_FOUND_DUPP_KEY */
12
N_("Duplicate key on write or update"),
13
/* HA_ERR_INTERNAL_ERROR */
14
N_("Internal (unspecified) error in handler"),
15
/* HA_ERR_RECORD_CHANGED */
16
N_("Someone has changed the row since it was read (while the table was locked to prevent it)"),
17
/* HA_ERR_WRONG_INDEX */
18
N_("Wrong index given to function"),
20
N_("Undefined handler error 125"),
22
N_("Index file is crashed"),
23
/* HA_ERR_WRONG_IN_RECORD */
24
N_("Record file is crashed"),
25
/* HA_ERR_OUT_OF_MEM */
26
N_("Out of memory in engine"),
28
N_("Undefined handler error 129"),
29
/* HA_ERR_NOT_A_TABLE */
30
N_("Incorrect file format"),
31
/* HA_ERR_WRONG_COMMAND */
32
N_("Command not supported by database"),
34
N_("Old database file"),
35
/* HA_ERR_NO_ACTIVE_RECORD */
36
N_("No record read before update"),
37
/* HA_ERR_RECORD_DELETED */
38
N_("Record was already deleted (or record file crashed)"),
39
/* HA_ERR_RECORD_FILE_FULL */
40
N_("No more room in record file"),
41
/* HA_ERR_INDEX_FILE_FULL */
42
N_("No more room in index file"),
43
/* HA_ERR_END_OF_FILE */
44
N_("No more records (read after end of file)"),
45
/* HA_ERR_UNSUPPORTED */
46
N_("Unsupported extension used for table"),
47
/* HA_ERR_TO_BIG_ROW */
49
/* HA_WRONG_CREATE_OPTION */
50
N_("Wrong create options"),
51
/* HA_ERR_FOUND_DUPP_UNIQUE */
52
N_("Duplicate unique key or constraint on write or update"),
53
/* HA_ERR_UNKNOWN_CHARSET */
54
N_("Unknown character set used in table"),
55
/* HA_ERR_WRONG_MRG_TABLE_DEF */
56
N_("Conflicting table definitions in sub-tables of MERGE table"),
57
/* HA_ERR_CRASHED_ON_REPAIR */
58
N_("Table is crashed and last repair failed"),
59
/* HA_ERR_CRASHED_ON_USAGE */
60
N_("Table was marked as crashed and should be repaired"),
61
/* HA_ERR_LOCK_WAIT_TIMEOUT */
62
N_("Lock timed out; Retry transaction"),
63
/* HA_ERR_LOCK_TABLE_FULL */
64
N_("Lock table is full; Restart program with a larger locktable"),
65
/* HA_ERR_READ_ONLY_TRANSACTION */
66
N_("Updates are not allowed under a read only transactions"),
67
/* HA_ERR_LOCK_DEADLOCK */
68
N_("Lock deadlock; Retry transaction"),
69
/* HA_ERR_CANNOT_ADD_FOREIGN */
70
N_("Foreign key constraint is incorrectly formed"),
71
/* HA_ERR_NO_REFERENCED_ROW */
72
N_("Cannot add a child row"),
73
/* HA_ERR_ROW_IS_REFERENCED */
74
N_("Cannot delete a parent row"),
75
/* HA_ERR_NO_SAVEPOINT */
76
N_("No savepoint with that name"),
77
/* HA_ERR_NON_UNIQUE_BLOCK_SIZE */
78
N_("Non unique key block size"),
79
/* HA_ERR_NO_SUCH_TABLE */
80
N_("The table does not exist in engine"),
81
/* HA_ERR_TABLE_EXIST */
82
N_("The table already existed in storage engine"),
83
/* HA_ERR_NO_CONNECTION */
84
N_("Could not connect to storage engine"),
85
/* HA_ERR_NULL_IN_SPATIAL */
86
N_("Unexpected null pointer found when using spatial index"),
87
/* HA_ERR_TABLE_DEF_CHANGED */
88
N_("The table changed in storage engine"),
89
/* HA_ERR_NO_PARTITION_FOUND */
90
N_("There's no partition in table for the given value"),
91
/* HA_ERR_RBR_LOGGING_FAILED */
92
N_("Row-based binlogging of row failed"),
93
/* HA_ERR_DROP_INDEX_FK */
94
N_("Index needed in foreign key constraint"),
95
/* HA_ERR_FOREIGN_DUPLICATE_KEY */
96
N_("Upholding foreign key constraints would lead to a duplicate key error"),
97
/* HA_ERR_TABLE_NEEDS_UPGRADE */
98
N_("Table needs to be upgraded before it can be used"),
99
/* HA_ERR_TABLE_READONLY */
100
N_("Table is read only"),
101
/* HA_ERR_AUTOINC_READ_FAILED */
102
N_("Failed to get next auto increment value"),
103
/* HA_ERR_AUTOINC_ERANGE */
104
N_("Failed to set row auto increment value"),
106
N_("Unknown (generic) error from engine"),
107
/* HA_ERR_RECORD_IS_THE_SAME */
108
N_("Record is the same"),
109
/* HA_ERR_LOGGING_IMPOSSIBLE */
110
N_("It is not possible to log this statement"),
111
/* HA_ERR_TABLESPACE_EXIST */
112
N_("Tablespace exists"),
113
/* HA_ERR_CORRUPT_EVENT */
114
N_("The event was corrupt, leading to illegal data being read"),
115
/* HA_ERR_NEW_FILE */
116
N_("The table is of a new format not supported by this version"),
117
/* HA_ERR_ROWS_EVENT_APPLY */
118
N_("The event could not be processed no other hanlder error happened"),
119
/* HA_ERR_INITIALIZATION */
120
N_("Got a fatal error during initialzaction of handler"),
121
/* HA_ERR_FILE_TOO_SHORT */
122
N_("File to short; Expected more data in file"),
123
/* HA_ERR_WRONG_CRC */
124
N_("Read page with wrong checksum"),
125
/* HA_ERR_LOCK_OR_ACTIVE_TRANSACTION */
126
N_("Lock or active transaction"), /* TODO: get a better message */
127
/* HA_ERR_NO_SUCH_TABLESPACE */
128
N_("No such table space"), /* TODO: get a better message */
129
/* HA_ERR_TABLESPACE_NOT_EMPTY */
130
N_("Tablespace not empty") /* TODO: get a better message */