mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / include / kernel / signaldata / TrigAttrInfo.hpp
blob94fe90843d2800492657be3405c8e8daf3fe5438
1 /* Copyright (c) 2003, 2005 MySQL AB
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef TRIG_ATTRINFO_HPP
17 #define TRIG_ATTRINFO_HPP
19 #include "SignalData.hpp"
20 #include <NodeBitmask.hpp>
21 #include <trigger_definitions.h>
22 #include <string.h>
24 /**
25 * TrigAttrInfo
27 * This signal is sent by TUP to signal
28 * that a trigger has fired
30 class TrigAttrInfo {
31 /**
32 * Sender(s)
34 // API
36 /**
37 * Sender(s) / Reciver(s)
39 friend class Dbtup;
41 /**
42 * Reciver(s)
44 friend class Dbtc;
45 friend class Backup;
46 friend class SumaParticipant;
48 /**
49 * For printing
51 friend bool printTRIG_ATTRINFO(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
53 public:
54 enum AttrInfoType {
55 PRIMARY_KEY = 0,
56 BEFORE_VALUES = 1,
57 AFTER_VALUES = 2
60 STATIC_CONST( DataLength = 22 );
61 STATIC_CONST( StaticLength = 3 );
63 private:
64 Uint32 m_connectionPtr;
65 Uint32 m_trigId;
66 Uint32 m_type;
67 Uint32 m_data[DataLength];
69 // Public methods
70 public:
71 Uint32 getConnectionPtr() const;
72 void setConnectionPtr(Uint32);
73 AttrInfoType getAttrInfoType() const;
74 void setAttrInfoType(AttrInfoType anAttrType);
75 Uint32 getTriggerId() const;
76 void setTriggerId(Uint32 aTriggerId);
77 Uint32 getTransactionId1() const;
78 void setTransactionId1(Uint32 aTransId);
79 Uint32 getTransactionId2() const;
80 void setTransactionId2(Uint32 aTransId);
81 Uint32* getData() const;
82 int setData(Uint32* aDataBuf, Uint32 aDataLen);
85 inline
86 Uint32 TrigAttrInfo::getConnectionPtr() const
88 return m_connectionPtr;
91 inline
92 void TrigAttrInfo::setConnectionPtr(Uint32 aConnectionPtr)
94 m_connectionPtr = aConnectionPtr;
97 inline
98 TrigAttrInfo::AttrInfoType TrigAttrInfo::getAttrInfoType() const
100 return (TrigAttrInfo::AttrInfoType) m_type;
103 inline
104 void TrigAttrInfo::setAttrInfoType(TrigAttrInfo::AttrInfoType anAttrType)
106 m_type = (Uint32) anAttrType;
109 inline
110 Uint32 TrigAttrInfo::getTriggerId() const
112 return m_trigId;
115 inline
116 void TrigAttrInfo::setTriggerId(Uint32 aTriggerId)
118 m_trigId = aTriggerId;
121 inline
122 Uint32* TrigAttrInfo::getData() const
124 return (Uint32*)&m_data[0];
127 inline
128 int TrigAttrInfo::setData(Uint32* aDataBuf, Uint32 aDataLen)
130 if (aDataLen > DataLength)
131 return -1;
132 memcpy(m_data, aDataBuf, aDataLen*sizeof(Uint32));
134 return 0;
137 #endif