MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbError.hpp
1 /*
2  Copyright (C) 2003-2006 MySQL AB, 2009 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef NDB_ERROR_HPP
20 #define NDB_ERROR_HPP
21 
22 #include "ndberror.h"
23 
48 struct NdbError {
53  enum Status {
58  Success = ndberror_st_success,
59 
68  TemporaryError = ndberror_st_temporary,
69 
78  PermanentError = ndberror_st_permanent,
79 
85  UnknownResult = ndberror_st_unknown
86  };
87 
95  NoError = ndberror_cl_none,
96 
100  ApplicationError = ndberror_cl_application,
101 
105  NoDataFound = ndberror_cl_no_data_found,
106 
111  ConstraintViolation = ndberror_cl_constraint_violation,
112 
116  SchemaError = ndberror_cl_schema_error,
117 
121  UserDefinedError = ndberror_cl_user_defined,
122 
126  InsufficientSpace = ndberror_cl_insufficient_space,
127 
131  TemporaryResourceError = ndberror_cl_temporary_resource,
132 
138  NodeRecoveryError = ndberror_cl_node_recovery,
139 
143  OverloadError = ndberror_cl_overload,
144 
148  TimeoutExpired = ndberror_cl_timeout_expired,
149 
153  UnknownResultError = ndberror_cl_unknown_result,
154 
158  InternalError = ndberror_cl_internal_error,
159 
163  FunctionNotImplemented = ndberror_cl_function_not_implemented,
164 
168  UnknownErrorCode = ndberror_cl_unknown_error_code,
169 
173  NodeShutdown = ndberror_cl_node_shutdown,
174 
178  SchemaObjectExists = ndberror_cl_schema_object_already_exists,
179 
183  InternalTemporary = ndberror_cl_internal_temporary
184  };
185 
190 
195 
199  int code;
200 
205 
209  const char * message;
210 
211 #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
212 
218  char * details;
219 #endif
220 
221 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
222  NdbError(){
225  code = 0;
226  mysql_code = 0;
227  message = 0;
228  details = 0;
229  }
230  NdbError(const ndberror_struct & ndberror){
231  status = (NdbError::Status) ndberror.status;
233  code = ndberror.code;
234  mysql_code = ndberror.mysql_code;
235  message = ndberror.message;
236  details = ndberror.details;
237  }
238  operator ndberror_struct() const {
239  ndberror_struct ndberror;
240  ndberror.status = (ndberror_status_enum) status;
241  ndberror.classification = (ndberror_classification_enum) classification;
242  ndberror.code = code;
243  ndberror.mysql_code = mysql_code;
244  ndberror.message = message;
245  ndberror.details = details;
246  return ndberror;
247  }
248 #endif
249 };
250 
251 class NdbOut& operator <<(class NdbOut&, const NdbError &);
252 class NdbOut& operator <<(class NdbOut&, const NdbError::Status&);
253 class NdbOut& operator <<(class NdbOut&, const NdbError::Classification&);
254 #endif