MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrigAttrInfo.hpp
1 /*
2  Copyright (C) 2003, 2005, 2006 MySQL AB
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef TRIG_ATTRINFO_HPP
20 #define TRIG_ATTRINFO_HPP
21 
22 #include "SignalData.hpp"
23 #include <NodeBitmask.hpp>
24 #include <trigger_definitions.h>
25 #include <string.h>
26 
33 class TrigAttrInfo {
37  // API
38 
42  friend class Dbtup;
43 
47  friend class Dbtc;
48  friend class Backup;
49  friend class SumaParticipant;
50 
54  friend bool printTRIG_ATTRINFO(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
55 
56 public:
57 enum AttrInfoType {
58  PRIMARY_KEY = 0,
59  BEFORE_VALUES = 1,
60  AFTER_VALUES = 2
61 };
62 
63  STATIC_CONST( DataLength = 22 );
64  STATIC_CONST( StaticLength = 3 );
65 
66 private:
67  Uint32 m_connectionPtr;
68  Uint32 m_trigId;
69  Uint32 m_type;
70  Uint32 m_data[DataLength];
71 
72  // Public methods
73 public:
74  Uint32 getConnectionPtr() const;
75  void setConnectionPtr(Uint32);
76  AttrInfoType getAttrInfoType() const;
77  void setAttrInfoType(AttrInfoType anAttrType);
78  Uint32 getTriggerId() const;
79  void setTriggerId(Uint32 aTriggerId);
80  Uint32 getTransactionId1() const;
81  void setTransactionId1(Uint32 aTransId);
82  Uint32 getTransactionId2() const;
83  void setTransactionId2(Uint32 aTransId);
84  Uint32* getData() const;
85  int setData(Uint32* aDataBuf, Uint32 aDataLen);
86 };
87 
88 inline
89 Uint32 TrigAttrInfo::getConnectionPtr() const
90 {
91  return m_connectionPtr;
92 }
93 
94 inline
95 void TrigAttrInfo::setConnectionPtr(Uint32 aConnectionPtr)
96 {
97  m_connectionPtr = aConnectionPtr;
98 }
99 
100 inline
101 TrigAttrInfo::AttrInfoType TrigAttrInfo::getAttrInfoType() const
102 {
103  return (TrigAttrInfo::AttrInfoType) m_type;
104 }
105 
106 inline
107 void TrigAttrInfo::setAttrInfoType(TrigAttrInfo::AttrInfoType anAttrType)
108 {
109  m_type = (Uint32) anAttrType;
110 }
111 
112 inline
113 Uint32 TrigAttrInfo::getTriggerId() const
114 {
115  return m_trigId;
116 }
117 
118 inline
119 void TrigAttrInfo::setTriggerId(Uint32 aTriggerId)
120 {
121  m_trigId = aTriggerId;
122 }
123 
124 inline
125 Uint32* TrigAttrInfo::getData() const
126 {
127  return (Uint32*)&m_data[0];
128 }
129 
130 inline
131 int TrigAttrInfo::setData(Uint32* aDataBuf, Uint32 aDataLen)
132 {
133  if (aDataLen > DataLength)
134  return -1;
135  memcpy(m_data, aDataBuf, aDataLen*sizeof(Uint32));
136 
137  return 0;
138 }
139 
140 #endif