1 /* 2 Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License, version 2.0, 6 as published by the Free Software Foundation. 7 8 This program is also distributed with certain software (including 9 but not limited to OpenSSL) that is licensed under separate terms, 10 as designated in a particular file or component or in included license 11 documentation. The authors of MySQL hereby grant you an additional 12 permission to link the program and your derivative works with the 13 separately licensed software that they have included with MySQL. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License, version 2.0, for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 */ 24 25 #ifndef UTIL_PREPARE_REQ_HPP 26 #define UTIL_PREPARE_REQ_HPP 27 28 #include "SignalData.hpp" 29 #include <SimpleProperties.hpp> 30 31 #ifdef NDB_WIN32 32 #ifdef NO_ERROR 33 #undef NO_ERROR 34 #endif 35 #endif 36 37 /** 38 * UTIL_PREPARE_REQ, UTIL_PREPARE_CONF, UTIL_PREPARE_REF 39 */ 40 41 /** 42 * @class UtilPrepareReq 43 * @brief Prepare transaction in Util block 44 * 45 * Data format: 46 * - UTIL_PREPARE_REQ <NoOfOps> (<OperationType> <TableName> <AttrName>+)+ 47 */ 48 class UtilPrepareReq { 49 /** 50 * Sender(s) / Receiver(s) 51 */ 52 friend class DbUtil; 53 friend class Trix; 54 55 /** 56 * For printing 57 */ 58 friend bool printUTIL_PREPARE_REQ(FILE * output, 59 const Uint32 * theData, 60 Uint32 len, 61 Uint16 receiverBlockNo); 62 63 public: 64 enum OperationTypeValue { 65 Read = 0, 66 Update = 1, 67 Insert = 2, 68 Delete = 3, 69 Write = 4 70 71 }; 72 73 enum KeyValue { 74 NoOfOperations = 1, ///< No of operations in transaction 75 OperationType = 2, /// 76 TableName = 3, ///< String 77 AttributeName = 4, ///< String 78 TableId = 5, 79 AttributeId = 6, 80 ScanTakeOverInd = 7, 81 ReorgInd = 8 82 }; 83 84 // Signal constants 85 STATIC_CONST( SignalLength = 3 ); 86 STATIC_CONST( PROPERTIES_SECTION = 0 ); 87 STATIC_CONST( NoOfSections = 1 ); 88 89 GET_SET_SENDERREF 90 GET_SET_SENDERDATA 91 private: 92 Uint32 senderData; // MUST be no 1! 93 Uint32 senderRef; 94 Uint32 schemaTransId; 95 }; 96 97 /** 98 * @class UtilPrepareConf 99 * 100 * Data format: 101 * - UTIL_PREPARE_CONF <UtilPrepareId> 102 */ 103 104 class UtilPrepareConf { 105 /** 106 * Sender(s) / Receiver(s) 107 */ 108 friend class DbUtil; 109 friend class Trix; 110 111 /** 112 * For printing 113 */ 114 friend bool printUTIL_PREPARE_CONF(FILE * output, 115 const Uint32 * theData, 116 Uint32 len, 117 Uint16 receiverBlockNo); 118 119 public: 120 STATIC_CONST( SignalLength = 2 ); 121 122 GET_SET_SENDERDATA 123 GET_SET_PREPAREID 124 private: 125 Uint32 senderData; // MUST be no 1! 126 Uint32 prepareId; 127 }; 128 129 130 /** 131 * @class UtilPrepareRef 132 * 133 * Data format: 134 * - UTIL_PREPARE_REF 135 */ 136 137 class UtilPrepareRef { 138 /** 139 * Sender(s) / Receiver(s) 140 */ 141 friend class Dbdict; 142 friend class DbUtil; 143 friend class Trix; 144 145 /** 146 * For printing 147 */ 148 friend bool printUTIL_PREPARE_REF(FILE * output, 149 const Uint32 * theData, 150 Uint32 len, 151 Uint16 receiverBlockNo); 152 153 public: 154 enum ErrorCode { 155 NO_ERROR = 0, 156 PREPARE_SEIZE_ERROR = 1, 157 PREPARE_PAGES_SEIZE_ERROR = 2, 158 PREPARED_OPERATION_SEIZE_ERROR = 3, 159 DICT_TAB_INFO_ERROR = 4, 160 MISSING_PROPERTIES_SECTION = 5 161 }; 162 163 STATIC_CONST( SignalLength = 3 ); 164 165 GET_SET_SENDERDATA 166 GET_SET_ERRORCODE 167 private: 168 Uint32 senderData; // MUST be no 1! 169 Uint32 errorCode; 170 Uint32 dictErrCode; // If errorCode == DICT_TAB_INFO_ERROR 171 }; 172 173 174 #endif 175