~drizzle-trunk/drizzle/development

1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 Sun Microsystems
5
 *
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.
9
 *
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.
14
 *
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
18
 */
19
20
#ifndef DRIZZLED_MY_ERROR_H
21
#define DRIZZLED_MY_ERROR_H
22
23
#include "drizzled/definitions.h"
24
25
/* Max width of screen (for error messages) */
26
#define SC_MAXWIDTH 256
27
#define ERRMSGSIZE	(SC_MAXWIDTH)	/* Max length of a error message */
28
#define NRERRBUFFS	(2)	/* Buffers for parameters */
29
#define MY_FILE_ERROR	((size_t) -1)
30
#define ME_FATALERROR   1024    /* Fatal statement error */
31
32
typedef void (*error_handler_func)(uint32_t my_err, const char *str,myf MyFlags);
33
extern error_handler_func error_handler_hook;
34
35
/*
36
  Do not add error numbers before EE_ERROR_FIRST.
37
  If necessary to add lower numbers, change EE_ERROR_FIRST accordingly.
38
39
  We start with error 1 to not confuse peoples with 'error 0'
40
*/
41
42
#define EE_ERROR_FIRST          1 /*Copy first error nr.*/
43
#define EE_CANTCREATEFILE	1
44
#define EE_READ			2
45
#define EE_WRITE		3
46
#define EE_BADCLOSE		4
47
#define EE_OUTOFMEMORY		5
48
#define EE_DELETE		6
49
#define EE_LINK			7
50
#define EE_EOFERR		9
51
#define EE_CANTLOCK		10
52
#define EE_CANTUNLOCK		11
53
#define EE_DIR			12
54
#define EE_STAT			13
55
#define EE_CANT_CHSIZE		14
56
#define EE_CANT_OPEN_STREAM	15
57
#define EE_GETWD		16
58
#define EE_SETWD		17
59
#define EE_LINK_WARNING		18
60
#define EE_OPEN_WARNING		19
61
#define EE_DISK_FULL		20
62
#define EE_CANT_MKDIR		21
63
#define EE_UNKNOWN_CHARSET	22
64
#define EE_OUT_OF_FILERESOURCES	23
65
#define EE_CANT_READLINK	24
66
#define EE_CANT_SYMLINK		25
67
#define EE_REALPATH		26
68
#define EE_SYNC			27
69
#define EE_UNKNOWN_COLLATION	28
70
#define EE_FILENOTFOUND		29
71
#define EE_FILE_NOT_CLOSED	30
72
#define EE_ERROR_LAST           30 /* Copy last error nr */
73
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
74
75
  /* exit codes for all MySQL programs */
76
77
#define EXIT_UNSPECIFIED_ERROR		1
78
#define EXIT_UNKNOWN_OPTION		2
79
#define EXIT_AMBIGUOUS_OPTION		3
80
#define EXIT_NO_ARGUMENT_ALLOWED	4
81
#define EXIT_ARGUMENT_REQUIRED		5
82
#define EXIT_VAR_PREFIX_NOT_UNIQUE	6
83
#define EXIT_UNKNOWN_VARIABLE		7
84
#define EXIT_OUT_OF_MEMORY		8
85
#define EXIT_UNKNOWN_SUFFIX		9
86
#define EXIT_NO_PTR_TO_VARIABLE		10
87
#define EXIT_CANNOT_CONNECT_TO_SERVICE	11
88
#define EXIT_OPTION_DISABLED            12
89
#define EXIT_ARGUMENT_INVALID           13
90
91
#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */
92
#define EE(X)    (globerrs[(X) - EE_ERROR_FIRST])
93
94
#ifdef __cplusplus
95
extern "C" {
96
#endif
97
98
/* Error message numbers in global map */
99
extern const char * globerrs[GLOBERRS];
100
101
void init_glob_errs(void);
102
void my_error(int nr,myf MyFlags, ...);
103
void my_printf_error(uint32_t my_err, const char *format,
104
                     myf MyFlags, ...)
105
                     __attribute__((format(printf, 2, 4)));
106
int my_error_register(const char **errmsgs, int first, int last);
107
void my_error_unregister_all(void);
108
const char **my_error_unregister(int first, int last);
109
void my_message(uint32_t my_err, const char *str,myf MyFlags);
110
void my_message_no_curses(uint32_t my_err, const char *str,myf MyFlags);
111
112
#ifdef __cplusplus
113
}
114
#endif
115
116
#endif /* DRIZZLED_MY_ERROR_H */
117
118