~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/error_injection.h

enable remaining subselect tests, merge with latest from the trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 */
 
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
 */
15
19
 
16
20
#ifndef ERROR_INJECT_SUPPORT
17
 
/**  
18
 
 * @file 
 
21
/**
 
22
 * @file
19
23
 *
20
 
 * Simple compile-time error injection module to enable easy 
 
24
 * Simple compile-time error injection module to enable easy
21
25
 * error printing in case of a crash
22
26
 */
23
27
#ifndef DRIZZLE_SERVER_ERROR_INJECTION_H
43
47
  char total_str[200];
44
48
  if (_db_strict_keyword_ (dbug_str))
45
49
  {
46
 
    strxmov(total_str, extra_str, dbug_str, NullS);
 
50
    strxmov(total_str, extra_str, dbug_str, NULL);
47
51
    return 1;
48
52
  }
49
53
  return 0;
53
57
inline bool
54
58
check_and_unset_inject_value(int value)
55
59
{
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)
58
62
  {
59
 
    thd->error_inject_value= 0;
 
63
    session->error_inject_value= 0;
60
64
    return 1;
61
65
  }
62
66
  return 0;
90
94
  code is removed.
91
95
 
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.
99
103
*/
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) \