~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_state.cc

  • Committer: Stewart Smith
  • Date: 2008-11-21 16:06:07 UTC
  • mto: This revision was merged to the branch mainline in revision 593.
  • Revision ID: stewart@flamingspork.com-20081121160607-n6gdlt013spuo54r
remove mysql_frm_type
and fix engines to return correct value from delete_table when table doesn't exist.
(it should be ENOENT).

Also fix up some tests that manipulated frm files by hand. These tests are no longer valid and will need to be rewritten in the not too distant future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
/* Functions to map drizzle errno to sql_state */
22
 
#include "config.h"
 
22
#include <config.h>
23
23
 
 
24
#include CSTDINT_H
24
25
#include <algorithm>
25
26
 
26
27
#include <drizzled/sql_state.h>
28
29
 
29
30
using namespace std;
30
31
 
31
 
namespace drizzled
32
 
{
33
 
 
34
32
typedef struct st_map_errno_to_sqlstate
35
33
{
36
34
  uint32_t drizzle_errno;
95
93
  { ER_FIELD_SPECIFIED_TWICE                ,"42000", "" },
96
94
  { ER_UNSUPPORTED_EXTENSION                ,"42000", "" },
97
95
  { ER_TABLE_MUST_HAVE_COLUMNS              ,"42000", "" },
 
96
  { ER_UNKNOWN_CHARACTER_SET                ,"42000", "" },
98
97
  { ER_TOO_BIG_ROWSIZE                      ,"42000", "" },
99
98
  { ER_WRONG_OUTER_JOIN                     ,"42000", "" },
100
99
  { ER_NULL_COLUMN_IN_INDEX                 ,"42000", "" },
 
100
  { ER_PASSWORD_ANONYMOUS_USER              ,"42000", "" },
 
101
  { ER_PASSWORD_NOT_ALLOWED                 ,"42000", "" },
 
102
  { ER_PASSWORD_NO_MATCH                    ,"42000", "" },
101
103
  { ER_WRONG_VALUE_COUNT_ON_ROW             ,"21S01", "" },
 
104
  { ER_INVALID_USE_OF_NULL                  ,"22004", "" },
 
105
  { ER_REGEXP_ERROR                         ,"42000", "" },
102
106
  { ER_MIX_OF_GROUP_FUNC_AND_FIELDS         ,"42000", "" },
 
107
  { ER_NONEXISTING_GRANT                    ,"42000", "" },
 
108
  { ER_TABLEACCESS_DENIED_ERROR             ,"42000", "" },
 
109
  { ER_COLUMNACCESS_DENIED_ERROR            ,"42000", "" },
 
110
  { ER_ILLEGAL_GRANT_FOR_TABLE              ,"42000", "" },
 
111
  { ER_GRANT_WRONG_HOST_OR_USER             ,"42000", "" },
103
112
  { ER_NO_SUCH_TABLE                        ,"42S02", "" },
 
113
  { ER_NONEXISTING_TABLE_GRANT              ,"42000", "" },
 
114
  { ER_NOT_ALLOWED_COMMAND                  ,"42000", "" },
104
115
  { ER_SYNTAX_ERROR                         ,"42000", "" },
 
116
  { ER_ABORTING_CONNECTION                  ,"08S01", "" },
105
117
  { ER_NET_PACKET_TOO_LARGE                 ,"08S01", "" },
 
118
  { ER_NET_READ_ERROR_FROM_PIPE             ,"08S01", "" },
 
119
  { ER_NET_FCNTL_ERROR                      ,"08S01", "" },
106
120
  { ER_NET_PACKETS_OUT_OF_ORDER             ,"08S01", "" },
 
121
  { ER_NET_UNCOMPRESS_ERROR                 ,"08S01", "" },
 
122
  { ER_NET_READ_ERROR                       ,"08S01", "" },
 
123
  { ER_NET_READ_INTERRUPTED                 ,"08S01", "" },
 
124
  { ER_NET_ERROR_ON_WRITE                   ,"08S01", "" },
 
125
  { ER_NET_WRITE_INTERRUPTED                ,"08S01", "" },
 
126
  { ER_TOO_LONG_STRING                      ,"42000", "" },
107
127
  { ER_TABLE_CANT_HANDLE_BLOB               ,"42000", "" },
108
128
  { ER_TABLE_CANT_HANDLE_AUTO_INCREMENT     ,"42000", "" },
109
129
  { ER_WRONG_COLUMN_NAME                    ,"42000", "" },
116
136
  { ER_KEY_DOES_NOT_EXITS                   ,"42000", "S1009" },
117
137
  { ER_CHECK_NO_SUCH_TABLE                  ,"42000", "" },
118
138
  { ER_CHECK_NOT_IMPLEMENTED                ,"42000", "" },
 
139
  { ER_CANT_DO_THIS_DURING_AN_TRANSACTION   ,"25000", "" },
119
140
  { ER_NEW_ABORTING_CONNECTION              ,"08S01", "" },
 
141
  { ER_MASTER_NET_READ                      ,"08S01", "" },
 
142
  { ER_MASTER_NET_WRITE                     ,"08S01", "" },
 
143
  { ER_TOO_MANY_USER_CONNECTIONS            ,"42000", "" },
120
144
  { ER_READ_ONLY_TRANSACTION                ,"25000", "" },
 
145
  { ER_NO_PERMISSION_TO_CREATE_USER         ,"42000", "" },
121
146
  { ER_LOCK_DEADLOCK                        ,"40001", "" },
122
147
  { ER_NO_REFERENCED_ROW                    ,"23000", "" },
123
148
  { ER_ROW_IS_REFERENCED                    ,"23000", "" },
 
149
  { ER_CONNECT_TO_MASTER                    ,"08S01", "" },
124
150
  { ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT    ,"21000", "" },
 
151
  { ER_USER_LIMIT_REACHED                   ,"42000", "" },
 
152
  { ER_SPECIFIC_ACCESS_DENIED_ERROR         ,"42000", "" },
125
153
  { ER_NO_DEFAULT                           ,"42000", "" },
126
154
  { ER_WRONG_VALUE_FOR_VAR                  ,"42000", "" },
127
155
  { ER_WRONG_TYPE_FOR_VAR                   ,"42000", "" },
134
162
  { ER_DERIVED_MUST_HAVE_ALIAS              ,"42000", "" },
135
163
  { ER_SELECT_REDUCED                       ,"01000", "" },
136
164
  { ER_TABLENAME_NOT_ALLOWED_HERE           ,"42000", "" },
 
165
  { ER_NOT_SUPPORTED_AUTH_MODE              ,"08004", "" },
137
166
  { ER_SPATIAL_CANT_HAVE_NULL               ,"42000", "" },
138
167
  { ER_COLLATION_CHARSET_MISMATCH           ,"42000", "" },
139
168
  { ER_WARN_TOO_FEW_RECORDS                 ,"01000", "" },
145
174
  { ER_WRONG_NAME_FOR_CATALOG               ,"42000", "" },
146
175
  { ER_UNKNOWN_STORAGE_ENGINE               ,"42000", "" },
147
176
  { ER_TRUNCATED_WRONG_VALUE                ,"22007", "" },
 
177
  { ER_SP_NO_RECURSIVE_CREATE               ,"2F003", "" },
 
178
  { ER_SP_ALREADY_EXISTS                    ,"42000", "" },
148
179
  { ER_SP_DOES_NOT_EXIST                    ,"42000", "" },
 
180
  { ER_SP_LILABEL_MISMATCH                  ,"42000", "" },
 
181
  { ER_SP_LABEL_REDEFINE                    ,"42000", "" },
 
182
  { ER_SP_LABEL_MISMATCH                    ,"42000", "" },
 
183
  { ER_SP_UNINIT_VAR                        ,"01000", "" },
 
184
  { ER_SP_BADSELECT                         ,"0A000", "" },
 
185
  { ER_SP_BADRETURN                         ,"42000", "" },
 
186
  { ER_SP_BADSTATEMENT                      ,"0A000", "" },
 
187
  { ER_UPDATE_LOG_DEPRECATED_IGNORED        ,"42000", "" },
 
188
  { ER_UPDATE_LOG_DEPRECATED_TRANSLATED     ,"42000", "" },
149
189
  { ER_QUERY_INTERRUPTED                    ,"70100", "" },
 
190
  { ER_SP_WRONG_NO_OF_ARGS                  ,"42000", "" },
 
191
  { ER_SP_COND_MISMATCH                     ,"42000", "" },
 
192
  { ER_SP_NORETURN                          ,"42000", "" },
 
193
  { ER_SP_NORETURNEND                       ,"2F005", "" },
 
194
  { ER_SP_BAD_CURSOR_QUERY                  ,"42000", "" },
 
195
  { ER_SP_BAD_CURSOR_SELECT                 ,"42000", "" },
 
196
  { ER_SP_CURSOR_MISMATCH                   ,"42000", "" },
 
197
  { ER_SP_CURSOR_ALREADY_OPEN               ,"24000", "" },
 
198
  { ER_SP_CURSOR_NOT_OPEN                   ,"24000", "" },
 
199
  { ER_SP_UNDECLARED_VAR                    ,"42000", "" },
 
200
  { ER_SP_FETCH_NO_DATA                     ,"02000", "" },
 
201
  { ER_SP_DUP_PARAM                         ,"42000", "" },
 
202
  { ER_SP_DUP_VAR                           ,"42000", "" },
 
203
  { ER_SP_DUP_COND                          ,"42000", "" },
 
204
  { ER_SP_DUP_CURS                          ,"42000", "" },
 
205
  { ER_SP_SUBSELECT_NYI                     ,"0A000", "" },
 
206
  { ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG        ,"0A000", "" },
 
207
  { ER_SP_VARCOND_AFTER_CURSHNDLR           ,"42000", "" },
 
208
  { ER_SP_CURSOR_AFTER_HANDLER              ,"42000", "" },
 
209
  { ER_SP_CASE_NOT_FOUND                    ,"20000", "" },
150
210
  { ER_DIVISION_BY_ZERO                     ,"22012", "" },
151
211
  { ER_ILLEGAL_VALUE_FOR_TYPE               ,"22007", "" },
 
212
  { ER_PROCACCESS_DENIED_ERROR              ,"42000", "" },
 
213
  { ER_XAER_NOTA                            ,"XAE04", "" },
 
214
  { ER_XAER_INVAL                           ,"XAE05", "" },
152
215
  { ER_XAER_RMFAIL                          ,"XAE07", "" },
 
216
  { ER_XAER_OUTSIDE                         ,"XAE09", "" },
 
217
  { ER_XAER_RMERR                           ,"XAE03", "" },
 
218
  { ER_XA_RBROLLBACK                        ,"XA100", "" },
 
219
  { ER_NONEXISTING_PROC_GRANT               ,"42000", "" },
153
220
  { ER_DATA_TOO_LONG                        ,"22001", "" },
 
221
  { ER_SP_BAD_SQLSTATE                      ,"42000", "" },
 
222
  { ER_CANT_CREATE_USER_WITH_GRANT          ,"42000", "" },
 
223
  { ER_SP_DUP_HANDLER                       ,"42000", "" },
 
224
  { ER_SP_NOT_VAR_ARG                       ,"42000", "" },
154
225
  { ER_SP_NO_RETSET                         ,"0A000", "" },
155
226
  { ER_CANT_CREATE_GEOMETRY_OBJECT          ,"22003", "" },
156
227
  { ER_TOO_BIG_SCALE                        ,"42000", "S1009" },
157
228
  { ER_TOO_BIG_PRECISION                    ,"42000", "S1009" },
158
229
  { ER_M_BIGGER_THAN_D                      ,"42000", "S1009" },
 
230
  { ER_TOO_LONG_BODY                        ,"42000", "S1009" },
159
231
  { ER_TOO_BIG_DISPLAYWIDTH                 ,"42000", "S1009" },
 
232
  { ER_XAER_DUPID                           ,"XAE08", "" },
160
233
  { ER_DATETIME_FUNCTION_OVERFLOW           ,"22008", "" },
161
234
  { ER_ROW_IS_REFERENCED_2                  ,"23000", "" },
162
235
  { ER_NO_REFERENCED_ROW_2                  ,"23000", "" },
 
236
  { ER_SP_BAD_VAR_SHADOW                    ,"42000", "" },
 
237
  { ER_SP_WRONG_NAME                        ,"42000", "" },
 
238
  { ER_SP_NO_AGGREGATE                      ,"42000", "" },
 
239
  { ER_MAX_PREPARED_STMT_COUNT_REACHED      ,"42000", "" },
163
240
  { ER_NON_GROUPING_FIELD_USED              ,"42000", "" },
164
241
  { ER_FOREIGN_DUPLICATE_KEY                ,"23000", "S1009" },
165
242
  { ER_CANT_CHANGE_TX_ISOLATION             ,"25001", "" },
166
 
  { ER_WRONG_PARAMCOUNT_TO_FUNCTION         ,"42000", "" },
 
243
  { ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT       ,"42000", "" },
167
244
  { ER_WRONG_PARAMETERS_TO_NATIVE_FCT       ,"42000", "" },
 
245
  { ER_WRONG_PARAMETERS_TO_STORED_FCT       ,"42000", "" },
168
246
  { ER_DUP_ENTRY_WITH_KEY_NAME              ,"23000", "S1009" },
169
247
};
170
248
 
171
 
static bool compare_errno_map(errno_sqlstate_map a,
172
 
                              errno_sqlstate_map b)
 
249
bool compare_errno_map(errno_sqlstate_map a,
 
250
                       errno_sqlstate_map b)
173
251
{
174
252
  return (a.drizzle_errno < b.drizzle_errno);
175
253
}
189
267
  return "HY000";
190
268
 
191
269
}
192
 
 
193
 
} /* namespace drizzled */