~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/error_injection.h

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 */
 
1
/* Copyright (C) 2000-2003 MySQL AB
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
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 */
19
15
 
20
16
#ifndef ERROR_INJECT_SUPPORT
21
17
/**  
47
43
  char total_str[200];
48
44
  if (_db_strict_keyword_ (dbug_str))
49
45
  {
50
 
    strxmov(total_str, extra_str, dbug_str, NULL);
 
46
    strxmov(total_str, extra_str, dbug_str, NullS);
51
47
    return 1;
52
48
  }
53
49
  return 0;
57
53
inline bool
58
54
check_and_unset_inject_value(int value)
59
55
{
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)
62
58
  {
63
 
    session->error_inject_value= 0;
 
59
    thd->error_inject_value= 0;
64
60
    return 1;
65
61
  }
66
62
  return 0;
94
90
  code is removed.
95
91
 
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.
103
99
*/
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) \