1
/* Copyright (C) 2000-2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
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
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
16
20
#ifndef ERROR_INJECT_SUPPORT
43
47
char total_str[200];
44
48
if (_db_strict_keyword_ (dbug_str))
46
strxmov(total_str, extra_str, dbug_str, NullS);
50
strxmov(total_str, extra_str, dbug_str, NULL);
54
58
check_and_unset_inject_value(int value)
56
THD *thd= current_thd;
57
if (thd->error_inject_value == (uint)value)
60
Session *session= current_session;
61
if (session->error_inject_value == (uint)value)
59
thd->error_inject_value= 0;
63
session->error_inject_value= 0;
92
96
Sometimes it is necessary to perform error inject actions as a serie
93
of events. In this case one can use one variable on the THD object.
97
of events. In this case one can use one variable on the Session object.
94
98
Thus one sets this value by using e.g. SET_ERROR_INJECT_VALUE(100).
95
99
Then one can later test for it by using ERROR_INJECT_CRASH_VALUE,
96
100
ERROR_INJECT_ACTION_VALUE and ERROR_INJECT_VALUE. This have the same
98
102
error inject value instead of a code used by debug macros.
100
104
#define SET_ERROR_INJECT_VALUE(x) \
101
current_thd->error_inject_value= (x)
105
current_session->error_inject_value= (x)
102
106
#define ERROR_INJECT_ACTION(code, action) \
103
107
(check_and_unset_keyword(code) ? ((action), 0) : 0)
104
108
#define ERROR_INJECT(code) \