~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-201203300109

« back to all changes in this revision

Viewing changes to storage/ndb/include/kernel/signaldata/UtilExecute.hpp

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-11-08 11:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20111108113113-3ulw01fvi4vn8m25
Tags: upstream-5.5.17
ImportĀ upstreamĀ versionĀ 5.5.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 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 */
 
15
 
 
16
#ifndef UTIL_EXECUTE_HPP
 
17
#define UTIL_EXECUTE_HPP
 
18
 
 
19
#include "SignalData.hpp"
 
20
#include <SimpleProperties.hpp>
 
21
 
 
22
/**
 
23
 * UTIL_EXECUTE_REQ, UTIL_EXECUTE_CONF, UTIL_EXECUTE_REF
 
24
 */
 
25
 
 
26
/**
 
27
 * @class UtilExecuteReq
 
28
 * @brief Execute transaction in Util block
 
29
 *
 
30
 * Data format:
 
31
 * - UTIL_EXECUTE_REQ <prepareId> <ListOfAttributeHeaderValuePairs>
 
32
 */
 
33
 
 
34
class UtilExecuteReq {
 
35
  /** Sender(s) / Receiver(s) */
 
36
  friend class DbUtil;
 
37
  friend class Trix;
 
38
 
 
39
  /** For printing */
 
40
  friend bool printUTIL_EXECUTE_REQ(FILE * output, const Uint32 * theData, 
 
41
                                    Uint32 len, Uint16 receiverBlockNo);
 
42
public:
 
43
  STATIC_CONST( SignalLength = 3 );
 
44
  STATIC_CONST( HEADER_SECTION = 0 );
 
45
  STATIC_CONST( DATA_SECTION = 1 );
 
46
  STATIC_CONST( NoOfSections = 2 );
 
47
 
 
48
  GET_SET_SENDERREF
 
49
  GET_SET_SENDERDATA
 
50
  void setPrepareId(Uint32 pId) { prepareId = pId; }; // !! unsets release flag
 
51
  Uint32 getPrepareId() const { return prepareId & 0xFF; };
 
52
  void setReleaseFlag() { prepareId |= 0x100; };
 
53
  bool getReleaseFlag() const { return (prepareId & 0x100) != 0; };
 
54
private:
 
55
  Uint32 senderData; // MUST be no 1!
 
56
  Uint32 senderRef;
 
57
  Uint32 prepareId;     // Which prepared transaction to execute
 
58
};
 
59
 
 
60
/**
 
61
 * @class UtilExecuteConf
 
62
 *
 
63
 * Data format:
 
64
 * - UTIL_PREPARE_CONF <UtilPrepareId> 
 
65
 */
 
66
 
 
67
class UtilExecuteConf {
 
68
  /**
 
69
   * Sender(s) / Receiver(s)
 
70
   */
 
71
  friend class DbUtil;
 
72
  friend class Trix;
 
73
 
 
74
  /**
 
75
   * For printing
 
76
   */
 
77
  friend bool printUTIL_EXECUTE_CONF(FILE * output, 
 
78
                                     const Uint32 * theData, 
 
79
                                     Uint32 len, 
 
80
                                     Uint16 receiverBlockNo);
 
81
public:
 
82
  STATIC_CONST( SignalLength = 1 );
 
83
 
 
84
  GET_SET_SENDERDATA
 
85
private:
 
86
  Uint32 senderData; // MUST be no 1!
 
87
};
 
88
 
 
89
 
 
90
/**
 
91
 * @class UtilExecuteRef
 
92
 *
 
93
 * Data format:
 
94
 * - UTIL_PREPARE_REF 
 
95
 */
 
96
 
 
97
class UtilExecuteRef {
 
98
  /**
 
99
   * Sender(s) / Receiver(s)
 
100
   */
 
101
  friend class DbUtil;
 
102
  friend class Trix;
 
103
 
 
104
  /**
 
105
   * For printing
 
106
   */
 
107
  friend bool printUTIL_EXECUTE_REF(FILE * output, 
 
108
                                    const Uint32 * theData, 
 
109
                                    Uint32 len, 
 
110
                                    Uint16 receiverBlockNo);
 
111
 
 
112
public:
 
113
  STATIC_CONST( SignalLength = 3 );
 
114
 
 
115
  enum ErrorCode {
 
116
    IllegalKeyNumber = 1,
 
117
    IllegalAttrNumber = 2,
 
118
    TCError = 3,
 
119
    AllocationError = 5,
 
120
    MissingDataSection = 6,
 
121
    MissingData = 7
 
122
  };
 
123
 
 
124
  GET_SET_SENDERDATA
 
125
  GET_SET_ERRORCODE
 
126
  GET_SET_TCERRORCODE
 
127
private:
 
128
  Uint32 senderData; // MUST be no 1!
 
129
  Uint32 errorCode;
 
130
  Uint32 TCErrorCode;
 
131
};
 
132
 
 
133
 
 
134
#endif