~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

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_PREPARE_REQ_HPP
 
17
#define UTIL_PREPARE_REQ_HPP
 
18
 
 
19
#include "SignalData.hpp"
 
20
#include <SimpleProperties.hpp>
 
21
 
 
22
#ifdef NDB_WIN32
 
23
#ifdef NO_ERROR
 
24
#undef NO_ERROR
 
25
#endif
 
26
#endif
 
27
 
 
28
/**
 
29
 * UTIL_PREPARE_REQ, UTIL_PREPARE_CONF, UTIL_PREPARE_REF
 
30
 */
 
31
 
 
32
/**
 
33
 * @class UtilPrepareReq
 
34
 * @brief Prepare transaction in Util block
 
35
 *
 
36
 * Data format:
 
37
 * - UTIL_PREPARE_REQ <NoOfOps> (<OperationType> <TableName> <AttrName>+)+
 
38
 */
 
39
class UtilPrepareReq {
 
40
  /**
 
41
   * Sender(s) / Receiver(s)
 
42
   */
 
43
  friend class DbUtil;
 
44
  friend class Trix;
 
45
 
 
46
  /**
 
47
   * For printing
 
48
   */
 
49
  friend bool printUTIL_PREPARE_REQ(FILE * output, 
 
50
                                    const Uint32 * theData, 
 
51
                                    Uint32 len, 
 
52
                                    Uint16 receiverBlockNo);
 
53
 
 
54
public:
 
55
  enum OperationTypeValue {
 
56
    Read               = 0,
 
57
    Update             = 1,
 
58
    Insert             = 2,
 
59
    Delete             = 3,
 
60
    Write              = 4
 
61
 
 
62
  };
 
63
 
 
64
  enum KeyValue {
 
65
    NoOfOperations     = 1,  ///< No of operations in transaction
 
66
    OperationType      = 2,  /// 
 
67
    TableName          = 3,  ///< String
 
68
    AttributeName      = 4,  ///< String
 
69
    TableId            = 5,
 
70
    AttributeId        = 6
 
71
  };
 
72
 
 
73
  // Signal constants
 
74
  STATIC_CONST( SignalLength = 2 );
 
75
  STATIC_CONST( PROPERTIES_SECTION = 0 );
 
76
  STATIC_CONST( NoOfSections = 1 );
 
77
 
 
78
  GET_SET_SENDERREF
 
79
  GET_SET_SENDERDATA
 
80
private:  
 
81
  Uint32 senderData; // MUST be no 1!
 
82
  Uint32 senderRef;
 
83
};
 
84
 
 
85
/**
 
86
 * @class UtilPrepareConf
 
87
 *
 
88
 * Data format:
 
89
 * - UTIL_PREPARE_CONF <UtilPrepareId> 
 
90
 */
 
91
 
 
92
class UtilPrepareConf {
 
93
  /**
 
94
   * Sender(s) / Receiver(s)
 
95
   */
 
96
  friend class DbUtil;
 
97
  friend class Trix;
 
98
 
 
99
  /**
 
100
   * For printing
 
101
   */
 
102
  friend bool printUTIL_PREPARE_CONF(FILE * output, 
 
103
                                     const Uint32 * theData, 
 
104
                                     Uint32 len, 
 
105
                                     Uint16 receiverBlockNo);
 
106
 
 
107
public:
 
108
  STATIC_CONST( SignalLength = 2 );
 
109
 
 
110
  GET_SET_SENDERDATA
 
111
  GET_SET_PREPAREID
 
112
private:
 
113
  Uint32 senderData; // MUST be no 1!
 
114
  Uint32 prepareId; 
 
115
};
 
116
 
 
117
 
 
118
/**
 
119
 * @class UtilPrepareRef
 
120
 *
 
121
 * Data format:
 
122
 * - UTIL_PREPARE_REF 
 
123
 */
 
124
 
 
125
class UtilPrepareRef {
 
126
  /**
 
127
   * Sender(s) / Receiver(s)
 
128
   */
 
129
  friend class DbUtil;
 
130
  friend class Trix;
 
131
 
 
132
  /**
 
133
   * For printing
 
134
   */
 
135
  friend bool printUTIL_PREPARE_REF(FILE * output, 
 
136
                                    const Uint32 * theData, 
 
137
                                    Uint32 len, 
 
138
                                    Uint16 receiverBlockNo);
 
139
 
 
140
public:
 
141
  enum ErrorCode {
 
142
    NO_ERROR = 0,
 
143
    PREPARE_SEIZE_ERROR = 1,
 
144
    PREPARE_PAGES_SEIZE_ERROR = 2,
 
145
    PREPARED_OPERATION_SEIZE_ERROR = 3,
 
146
    DICT_TAB_INFO_ERROR = 4,
 
147
    MISSING_PROPERTIES_SECTION = 5
 
148
  };
 
149
 
 
150
  STATIC_CONST( SignalLength = 2 );
 
151
 
 
152
  GET_SET_SENDERDATA
 
153
  GET_SET_ERRORCODE
 
154
private:
 
155
  Uint32 senderData; // MUST be no 1!
 
156
  Uint32 errorCode;
 
157
};
 
158
 
 
159
 
 
160
#endif