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
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 */
20
16
#ifndef ERROR_INJECT_SUPPORT
47
43
char total_str[200];
48
44
if (_db_strict_keyword_ (dbug_str))
50
strxmov(total_str, extra_str, dbug_str, NULL);
46
strxmov(total_str, extra_str, dbug_str, NullS);
58
54
check_and_unset_inject_value(int value)
60
Session *session= current_session;
61
if (session->error_inject_value == (uint)value)
56
THD *thd= current_thd;
57
if (thd->error_inject_value == (uint)value)
63
session->error_inject_value= 0;
59
thd->error_inject_value= 0;
96
92
Sometimes it is necessary to perform error inject actions as a serie
97
of events. In this case one can use one variable on the Session object.
93
of events. In this case one can use one variable on the THD object.
98
94
Thus one sets this value by using e.g. SET_ERROR_INJECT_VALUE(100).
99
95
Then one can later test for it by using ERROR_INJECT_CRASH_VALUE,
100
96
ERROR_INJECT_ACTION_VALUE and ERROR_INJECT_VALUE. This have the same
102
98
error inject value instead of a code used by debug macros.
104
100
#define SET_ERROR_INJECT_VALUE(x) \
105
current_session->error_inject_value= (x)
101
current_thd->error_inject_value= (x)
106
102
#define ERROR_INJECT_ACTION(code, action) \
107
103
(check_and_unset_keyword(code) ? ((action), 0) : 0)
108
104
#define ERROR_INJECT(code) \