1 /* 2 Copyright (c) 2011, 2012, 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 26 #ifndef CREATE_FK_IMPL_HPP 27 #define CREATE_FK_IMPL_HPP 28 29 #include "SignalData.hpp" 30 31 #define JAM_FILE_ID 208 32 33 34 struct CreateFKImplReq 35 { 36 /** 37 * Sender(s) / Reciver(s) 38 */ 39 friend class Dbdict; 40 41 /** 42 * For printing 43 */ 44 friend bool printCREATE_FK_IMPL_REQ(FILE*, const Uint32*, Uint32, Uint16); 45 46 STATIC_CONST( SignalLength = 10 ); 47 STATIC_CONST( PARENT_COLUMNS = 0); // section no 48 STATIC_CONST( CHILD_COLUMNS = 1); // section no 49 50 enum { 51 RT_PARSE = 0x1, 52 RT_PREPARE = 0x2, 53 RT_ABORT = 0x3, 54 RT_COMMIT = 0x4, 55 RT_COMPLETE = 0x5 56 }; 57 58 enum Bits 59 { 60 FK_PARENT_UI = 1, // Parent index is an unique index 61 FK_PARENT_OI = 2, // Parent index is an ordered index 62 FK_CHILD_UI = 4, // Child index is an unique index 63 FK_CHILD_OI = 8, // Child index is an ordered index 64 FK_UPDATE_RESTRICT = 16, // On update restrict 65 FK_UPDATE_CASCADE = 32, // On update cascade 66 FK_UPDATE_SET_NULL = 64, // On update set null 67 FK_UPDATE_SET_DEFAULT = 128, // On update set default 68 FK_DELETE_RESTRICT = 256, // On delete restrict 69 FK_DELETE_CASCADE = 512, // On delete cascade 70 FK_DELETE_SET_NULL = 1024,// On delete set null 71 FK_DELETE_SET_DEFAULT = 2048,// On delete set default 72 73 FK_UPDATE_MASK = (FK_UPDATE_RESTRICT | 74 FK_UPDATE_CASCADE | 75 FK_UPDATE_SET_NULL | 76 FK_UPDATE_SET_DEFAULT), 77 78 FK_DELETE_MASK = (FK_DELETE_RESTRICT | 79 FK_DELETE_CASCADE | 80 FK_DELETE_SET_NULL | 81 FK_DELETE_SET_DEFAULT), 82 83 FK_ACTION_MASK = (FK_UPDATE_MASK | FK_DELETE_MASK), 84 85 FK_UPDATE_ACTION = (FK_UPDATE_CASCADE | 86 FK_UPDATE_SET_NULL | 87 FK_UPDATE_SET_DEFAULT), 88 89 FK_DELETE_ACTION = (FK_DELETE_CASCADE | 90 FK_DELETE_SET_NULL | 91 FK_DELETE_SET_DEFAULT), 92 93 FK_ON_ACTION = (FK_UPDATE_ACTION | FK_DELETE_ACTION), 94 95 FK_END = 0 // marker 96 }; 97 98 Uint32 senderData; 99 Uint32 senderRef; 100 Uint32 requestType; 101 Uint32 fkId; 102 Uint32 fkVersion; 103 Uint32 bits; 104 Uint32 parentTableId; 105 Uint32 parentIndexId; 106 Uint32 childTableId; 107 Uint32 childIndexId; 108 }; 109 110 struct CreateFKImplRef 111 { 112 /** 113 * Sender(s) 114 */ 115 friend class Dbdict; 116 117 /** 118 * For printing 119 */ 120 friend bool printCREATE_FK_IMPL_REF(FILE*, const Uint32*, Uint32, Uint16); 121 122 STATIC_CONST( SignalLength = 3 ); 123 124 Uint32 senderData; 125 Uint32 senderRef; 126 Uint32 errorCode; 127 128 enum ErrCode 129 { 130 ObjectAlreadyExist = 21030, 131 NoMoreObjectRecords = 21031, 132 InvalidFormat = 21032 133 }; 134 }; 135 136 struct CreateFKImplConf 137 { 138 /** 139 * Sender(s) 140 */ 141 friend class Dbdict; 142 143 /** 144 * For printing 145 */ 146 friend bool printCREATE_FK_IMPL_CONF(FILE*, const Uint32*, Uint32, Uint16); 147 148 STATIC_CONST( SignalLength = 4 ); 149 150 Uint32 senderData; 151 Uint32 senderRef; 152 }; 153 154 155 #undef JAM_FILE_ID 156 157 #endif 158